diff --git a/docs/endpointFunctionList.md b/docs/endpointFunctionList.md index 929acee..8d289a7 100644 --- a/docs/endpointFunctionList.md +++ b/docs/endpointFunctionList.md @@ -50,280 +50,296 @@ This table includes all endpoints from the official Exchange API docs and corres | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [getAnnouncements()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L450) | | GET | `/api/v2/public/annoucements` | -| [getServerTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L462) | | GET | `/api/v2/public/time` | -| [getTradeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L470) | :closed_lock_with_key: | GET | `/api/v2/common/trade-rate` | -| [getSpotTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L485) | :closed_lock_with_key: | GET | `/api/v2/tax/spot-record` | -| [getFuturesTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L491) | :closed_lock_with_key: | GET | `/api/v2/tax/future-record` | -| [getMarginTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L497) | :closed_lock_with_key: | GET | `/api/v2/tax/margin-record` | -| [getP2PTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L503) | :closed_lock_with_key: | GET | `/api/v2/tax/p2p-record` | -| [getP2PMerchantList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L515) | :closed_lock_with_key: | GET | `/api/v2/p2p/merchantList` | -| [getP2PMerchantInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L524) | :closed_lock_with_key: | GET | `/api/v2/p2p/merchantInfo` | -| [getP2PMerchantOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L528) | :closed_lock_with_key: | GET | `/api/v2/p2p/orderList` | -| [getP2PMerchantAdvertisementList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L537) | :closed_lock_with_key: | GET | `/api/v2/p2p/advList` | -| [getSpotWhaleNetFlowData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L554) | :closed_lock_with_key: | GET | `/api/v2/spot/market/whale-net-flow` | -| [getFuturesActiveTakerBuySellVolumeData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L560) | | GET | `/api/v2/mix/market/taker-buy-sell` | -| [getFuturesActiveLongShortPositionData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L567) | | GET | `/api/v2/mix/market/position-long-short` | -| [getFuturesLongShortRatio()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L574) | | GET | `/api/v2/mix/market/long-short-ratio` | -| [getMarginLoanGrowthRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L582) | | GET | `/api/v2/mix/market/loan-growth` | -| [getIsolatedMarginBorrowingRatio()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L590) | | GET | `/api/v2/mix/market/isolated-borrow-rate` | -| [getFuturesActiveBuySellVolumeData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L597) | | GET | `/api/v2/mix/market/long-short` | -| [getSpotFundFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L604) | | GET | `/api/v2/spot/market/fund-flow` | -| [getTradeDataSupportSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L611) | | GET | `/api/v2/spot/market/support-symbols` | -| [getSpotFundNetFlowData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L620) | | GET | `/api/v2/spot/market/fund-net-flow` | -| [getFuturesActiveLongShortAccountData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L631) | | GET | `/api/v2/mix/market/account-long-short` | -| [createVirtualSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L644) | :closed_lock_with_key: | POST | `/api/v2/user/create-virtual-subaccount` | -| [modifyVirtualSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L650) | :closed_lock_with_key: | POST | `/api/v2/user/modify-virtual-subaccount` | -| [batchCreateVirtualSubaccountAndAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L658) | :closed_lock_with_key: | POST | `/api/v2/user/batch-create-subaccount-and-apikey` | -| [getVirtualSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L667) | :closed_lock_with_key: | GET | `/api/v2/user/virtual-subaccount-list` | -| [createVirtualSubaccountAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L680) | :closed_lock_with_key: | POST | `/api/v2/user/create-virtual-subaccount-apikey` | -| [modifyVirtualSubaccountAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L689) | :closed_lock_with_key: | POST | `/api/v2/user/modify-virtual-subaccount-apikey` | -| [getVirtualSubaccountAPIKeys()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L698) | :closed_lock_with_key: | GET | `/api/v2/user/virtual-subaccount-apikey-list` | -| [getFundingAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L712) | :closed_lock_with_key: | GET | `/api/v2/account/funding-assets` | -| [getBotAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L718) | :closed_lock_with_key: | GET | `/api/v2/account/bot-assets` | -| [getBalances()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L725) | :closed_lock_with_key: | GET | `/api/v2/account/all-account-balance` | -| [getConvertCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L742) | :closed_lock_with_key: | GET | `/api/v2/convert/currencies` | -| [getConvertQuotedPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L746) | :closed_lock_with_key: | GET | `/api/v2/convert/quoted-price` | -| [convert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L752) | :closed_lock_with_key: | POST | `/api/v2/convert/trade` | -| [getConvertHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L758) | :closed_lock_with_key: | GET | `/api/v2/convert/convert-record` | -| [getConvertBGBCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L773) | :closed_lock_with_key: | GET | `/api/v2/convert/bgb-convert-coin-list` | -| [convertBGB()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L781) | :closed_lock_with_key: | POST | `/api/v2/convert/bgb-convert` | -| [getConvertBGBHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L787) | :closed_lock_with_key: | GET | `/api/v2/convert/bgb-convert-records` | -| [getSpotCoinInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L807) | :closed_lock_with_key: | GET | `/api/v2/spot/public/coins` | -| [getSpotSymbolInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L813) | :closed_lock_with_key: | GET | `/api/v2/spot/public/symbols` | -| [getSpotVIPFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L819) | :closed_lock_with_key: | GET | `/api/v2/spot/market/vip-fee-rate` | -| [getSpotTicker()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L823) | :closed_lock_with_key: | GET | `/api/v2/spot/market/tickers` | -| [getSpotMergeDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L829) | :closed_lock_with_key: | GET | `/api/v2/spot/market/merge-depth` | -| [getSpotOrderBookDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L837) | :closed_lock_with_key: | GET | `/api/v2/spot/market/orderbook` | -| [getSpotCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L845) | :closed_lock_with_key: | GET | `/api/v2/spot/market/candles` | -| [getSpotHistoricCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L851) | :closed_lock_with_key: | GET | `/api/v2/spot/market/history-candles` | -| [getSpotRecentTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L857) | :closed_lock_with_key: | GET | `/api/v2/spot/market/fills` | -| [getSpotHistoricTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L864) | :closed_lock_with_key: | GET | `/api/v2/spot/market/fills-history` | -| [spotSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L876) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/place-order` | -| [spotCancelandSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L885) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-replace-order` | -| [spotBatchCancelandSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L891) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-replace-order` | -| [spotCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L900) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-order` | -| [spotBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L909) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-orders` | -| [spotBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L915) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-order` | -| [spotCancelSymbolOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L921) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-symbol-order` | -| [getSpotOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L929) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/orderInfo` | -| [getSpotOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L935) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/unfilled-orders` | -| [getSpotHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L941) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/history-orders` | -| [getSpotFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L947) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/fills` | -| [spotSubmitPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L959) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/place-plan-order` | -| [spotModifyPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L968) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/modify-plan-order` | -| [spotCancelPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L977) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-plan-order` | -| [getSpotCurrentPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L988) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/current-plan-order` | -| [getSpotPlanSubOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L998) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/plan-sub-order` | -| [getSpotHistoricPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1004) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/history-plan-order` | -| [spotCancelPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1014) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-plan-order` | -| [getSpotAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1029) | :closed_lock_with_key: | GET | `/api/v2/spot/account/info` | -| [getSpotAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1033) | :closed_lock_with_key: | GET | `/api/v2/spot/account/assets` | -| [getSpotSubAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1040) | :closed_lock_with_key: | GET | `/api/v2/spot/account/subaccount-assets` | -| [spotModifyDepositAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1044) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/modify-deposit-account` | -| [getSpotAccountBills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1054) | :closed_lock_with_key: | GET | `/api/v2/spot/account/bills` | -| [spotTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1060) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/transfer` | -| [getSpotTransferableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1069) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/transfer-coin-info` | -| [spotSubTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1076) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/subaccount-transfer` | -| [spotWithdraw()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1085) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/withdrawal` | -| [getSpotMainSubTransferRecord()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1094) | :closed_lock_with_key: | GET | `/api/v2/spot/account/sub-main-trans-record` | -| [getSpotTransferHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1103) | :closed_lock_with_key: | GET | `/api/v2/spot/account/transferRecords` | -| [spotSwitchBGBDeduct()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1109) | :closed_lock_with_key: | POST | `/api/v2/spot/account/switch-deduct` | -| [getSpotDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1115) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/deposit-address` | -| [getSpotSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1123) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/subaccount-deposit-address` | -| [getSpotBGBDeductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1135) | :closed_lock_with_key: | GET | `/api/v2/spot/account/deduct-info` | -| [spotCancelWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1143) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/cancel-withdrawal` | -| [getSubAccountDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1149) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/subaccount-deposit-records` | -| [getSpotWithdrawalHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1158) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/withdrawal-records` | -| [getSpotDepositHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1164) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/deposit-records` | -| [upgradeToUnifiedAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1179) | :closed_lock_with_key: | POST | `/api/v2/spot/account/upgrade` | -| [getUnifiedAccountSwitchStatus()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1189) | :closed_lock_with_key: | GET | `/api/v2/spot/account/upgrade-status` | -| [getFuturesVIPFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1211) | | GET | `/api/v2/mix/market/vip-fee-rate` | -| [getFuturesInterestRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1215) | | GET | `/api/v2/mix/market/union-interest-rate-history` | -| [getFuturesInterestExchangeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1224) | | GET | `/api/v2/mix/market/exchange-rate` | -| [getFuturesDiscountRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1235) | | GET | `/api/v2/mix/market/discount-rate` | -| [getFuturesMergeDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1239) | | GET | `/api/v2/mix/market/merge-depth` | -| [getFuturesTicker()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1245) | | GET | `/api/v2/mix/market/ticker` | -| [getFuturesAllTickers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1252) | | GET | `/api/v2/mix/market/tickers` | -| [getFuturesRecentTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1258) | | GET | `/api/v2/mix/market/fills` | -| [getFuturesHistoricTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1264) | | GET | `/api/v2/mix/market/fills-history` | -| [getFuturesCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1270) | | GET | `/api/v2/mix/market/candles` | -| [getFuturesHistoricCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1276) | | GET | `/api/v2/mix/market/history-candles` | -| [getFuturesHistoricIndexPriceCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1282) | | GET | `/api/v2/mix/market/history-index-candles` | -| [getFuturesHistoricMarkPriceCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1288) | | GET | `/api/v2/mix/market/history-mark-candles` | -| [getFuturesOpenInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1294) | | GET | `/api/v2/mix/market/open-interest` | -| [getFuturesNextFundingTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1306) | | GET | `/api/v2/mix/market/funding-time` | -| [getFuturesSymbolPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1313) | | GET | `/api/v2/mix/market/symbol-price` | -| [getFuturesHistoricFundingRates()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1320) | | GET | `/api/v2/mix/market/history-fund-rate` | -| [getFuturesCurrentFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1329) | | GET | `/api/v2/mix/market/current-fund-rate` | -| [getFuturesContractConfig()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1347) | | GET | `/api/v2/mix/market/contracts` | -| [getFuturesAccountAsset()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1360) | :closed_lock_with_key: | GET | `/api/v2/mix/account/account` | -| [getFuturesAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1366) | :closed_lock_with_key: | GET | `/api/v2/mix/account/accounts` | -| [getFuturesSubAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1372) | :closed_lock_with_key: | GET | `/api/v2/mix/account/sub-account-assets` | -| [getFuturesInterestHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1385) | :closed_lock_with_key: | GET | `/api/v2/mix/account/interest-history` | -| [getFuturesOpenCount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1391) | :closed_lock_with_key: | GET | `/api/v2/mix/account/open-count` | -| [setFuturesPositionAutoMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1399) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-auto-margin` | -| [setFuturesLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1405) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-leverage` | -| [setFuturesPositionMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1411) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-margin` | -| [setFuturesAssetMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1417) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-asset-mode` | -| [setFuturesMarginMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1424) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-margin-mode` | -| [setFuturesPositionMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1430) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-position-mode` | -| [getFuturesAccountBills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1441) | :closed_lock_with_key: | GET | `/api/v2/mix/account/bill` | -| [getUnionTransferLimits()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1456) | :closed_lock_with_key: | GET | `/api/v2/mix/account/transfer-limits` | -| [getUnionConfig()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1468) | :closed_lock_with_key: | GET | `/api/v2/mix/account/union-config` | -| [getSwitchUnionUsdt()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1478) | :closed_lock_with_key: | GET | `/api/v2/mix/account/switch-union-usdt` | -| [unionConvert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1488) | :closed_lock_with_key: | POST | `/api/v2/mix/account/union-convert` | -| [getFuturesMaxOpenableQuantity()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1500) | :closed_lock_with_key: | GET | `/api/v2/mix/account/max-open` | -| [getFuturesLiquidationPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1512) | :closed_lock_with_key: | GET | `/api/v2/mix/account/liq-price` | -| [getFuturesIsolatedSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1524) | :closed_lock_with_key: | GET | `/api/v2/mix/account/isolated-symbols` | -| [getFuturesPositionTier()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1536) | | GET | `/api/v2/mix/market/query-position-lever` | -| [getFuturesPosition()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1543) | :closed_lock_with_key: | GET | `/api/v2/mix/position/single-position` | -| [getFuturesPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1551) | :closed_lock_with_key: | GET | `/api/v2/mix/position/all-position` | -| [getFuturesHistoricPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1558) | :closed_lock_with_key: | GET | `/api/v2/mix/position/history-position` | -| [futuresSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1575) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-order` | -| [futuresSubmitReversal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1584) | :closed_lock_with_key: | POST | `/api/v2/mix/order/click-backhand` | -| [futuresBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1593) | :closed_lock_with_key: | POST | `/api/v2/mix/order/batch-place-order` | -| [futuresModifyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1599) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-order` | -| [futuresCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1608) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-order` | -| [futuresBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1617) | :closed_lock_with_key: | POST | `/api/v2/mix/order/batch-cancel-orders` | -| [futuresFlashClosePositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1623) | :closed_lock_with_key: | POST | `/api/v2/mix/order/close-positions` | -| [getFuturesOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1629) | :closed_lock_with_key: | GET | `/api/v2/mix/order/detail` | -| [getFuturesFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1635) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fills` | -| [getFuturesHistoricOrderFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1644) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fill-history` | -| [getFuturesOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1655) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-pending` | -| [getFuturesHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1664) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-history` | -| [futuresCancelAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1673) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-all-orders` | -| [getFuturesTriggerSubOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1685) | :closed_lock_with_key: | GET | `/api/v2/mix/order/plan-sub-order` | -| [futuresSubmitTPSLOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1693) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-tpsl-order` | -| [futuresSubmitPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1702) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-plan-order` | -| [futuresModifyTPSLPOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1711) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-tpsl-order` | -| [futuresModifyPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1720) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-plan-order` | -| [getFuturesPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1729) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-plan-pending` | -| [futuresCancelPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1738) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-plan-order` | -| [getFuturesHistoricPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1744) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-plan-history` | -| [modifySubaccountEmail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1769) | :closed_lock_with_key: | POST | `/api/v2/broker/account/modify-subaccount-email` | -| [getBrokerInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1779) | :closed_lock_with_key: | GET | `/api/v2/broker/account/info` | -| [createSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1789) | :closed_lock_with_key: | POST | `/api/v2/broker/account/create-subaccount` | -| [getSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1796) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-list` | -| [modifySubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1806) | :closed_lock_with_key: | POST | `/api/v2/broker/account/modify-subaccount` | -| [getSubaccountEmail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1812) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-email` | -| [getSubaccountSpotAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1818) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-spot-assets` | -| [getSubaccountFuturesAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1833) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-future-assets` | -| [createSubaccountDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1847) | :closed_lock_with_key: | POST | `/api/v2/broker/account/subaccount-address` | -| [subaccountWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1858) | :closed_lock_with_key: | POST | `/api/v2/broker/account/subaccount-withdrawal` | -| [subaccountSetAutoTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1870) | :closed_lock_with_key: | POST | `/api/v2/broker/account/set-subaccount-autotransfer` | -| [subaccountDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1886) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-deposit` | -| [subaccountWithdrawalRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1897) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-withdrawal` | -| [createSubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1912) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/create-subaccount-apikey` | -| [getSubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1921) | :closed_lock_with_key: | GET | `/api/v2/broker/manage/subaccount-apikey-list` | -| [modifySubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1930) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/modify-subaccount-apikey` | -| [getAllSubDepositWithdrawalRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1946) | :closed_lock_with_key: | GET | `/api/v2/broker/all-sub-deposit-withdrawal` | -| [getBrokerSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1963) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccounts` | -| [getBrokerCommissions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1975) | :closed_lock_with_key: | GET | `/api/v2/broker/commissions` | -| [getBrokerTradeVolume()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1987) | :closed_lock_with_key: | GET | `/api/v2/broker/trade-volume` | -| [getBrokerTotalCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2007) | :closed_lock_with_key: | GET | `/api/v2/broker/total-commission` | -| [getBrokerOrderCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2029) | :closed_lock_with_key: | GET | `/api/v2/broker/order-commission` | -| [getBrokerRebateInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2042) | :closed_lock_with_key: | GET | `/api/v2/broker/rebate-info` | -| [getMarginCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2062) | | GET | `/api/v2/margin/currencies` | -| [getMarginBorrowHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2072) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/borrow-history` | -| [getMarginRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2089) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/repay-history` | -| [getMarginInterestHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2106) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/interest-history` | -| [getMarginLiquidationHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2123) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/liquidation-history` | -| [getMarginFinancialHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2140) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/financial-records` | -| [getMarginAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2163) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/assets` | -| [marginBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2174) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/borrow` | -| [marginRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2197) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/repay` | -| [getMarginRiskRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2222) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/risk-rate` | -| [getMarginMaxBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2234) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/max-borrowable-amount` | -| [getMarginMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2247) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/max-transfer-out-amount` | -| [getMarginInterestRateAndMaxBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2262) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/interest-rate-and-limit` | -| [getMarginTierConfiguration()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2278) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/tier-data` | -| [marginFlashRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2290) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/flash-repay` | -| [getMarginFlashRepayResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2308) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/query-flash-repay-status` | -| [marginSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2332) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/place-order` | -| [marginBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2345) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/batch-place-order` | -| [marginCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2356) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/cancel-order` | -| [marginBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2376) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/batch-cancel-order` | -| [getMarginOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2390) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/open-orders` | -| [getMarginHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2404) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/history-orders` | -| [getMarginHistoricOrderFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2421) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/fills` | -| [getMarginLiquidationOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2435) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/liquidation-order` | -| [getFuturesTraderCurrentOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2467) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-current-track` | -| [getFuturesTraderHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2476) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-history-track` | -| [modifyFuturesTraderOrderTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2485) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/order-modify-tpsl` | -| [getFuturesTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2494) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-total-detail` | -| [getFuturesTraderProfitHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2500) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-history-summarys` | -| [getFuturesTraderProfitShareHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2506) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-history-details` | -| [closeFuturesTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2515) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/order-close-positions` | -| [getFuturesTraderProfitShare()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2534) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-details` | -| [getFuturesTraderProfitShareGroup()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2550) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profits-group-coin-date` | -| [getFuturesTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2568) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/config-query-symbols` | -| [updateFuturesTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2577) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-setting-symbols` | -| [updateFuturesTraderGlobalSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2586) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-settings-base` | -| [getFuturesTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2597) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/config-query-followers` | -| [removeFuturesTraderFollower()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2606) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-remove-follower` | -| [getFuturesFollowerCurrentOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2623) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-current-orders` | -| [getFuturesFollowerHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2632) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-history-orders` | -| [updateFuturesFollowerTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2641) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/setting-tpsl` | -| [updateFuturesFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2647) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/settings` | -| [getFuturesFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2653) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-settings` | -| [closeFuturesFollowerPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2659) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/close-positions` | -| [getFuturesFollowerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2672) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-traders` | -| [getFuturesFollowerFollowLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2678) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-quantity-limit` | -| [unfollowFuturesTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2696) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/cancel-trader` | -| [getBrokerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2710) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-traders` | -| [getBrokerTradersHistoricalOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2714) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-history-traces` | -| [getBrokerTradersPendingOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2721) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-current-traces` | -| [getSpotTraderProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2736) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-summarys` | -| [getSpotTraderHistoryProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2740) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-history-details` | -| [getSpotTraderUnrealizedProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2749) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-details` | -| [getSpotTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2757) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-total-detail` | -| [modifySpotTraderOrderTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2761) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/order-modify-tpsl` | -| [getSpotTraderHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2772) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-history-track` | -| [getSpotTraderCurrentOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2781) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-current-track` | -| [sellSpotTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2790) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/order-close-tracking` | -| [getSpotTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2800) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/config-setting-symbols` | -| [removeSpotTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2810) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/config-remove-follower` | -| [getSpotTraderConfiguration()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2819) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/config-query-settings` | -| [getSpotTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2823) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/config-query-followers` | -| [cancelSpotFollowerOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2840) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/stop-order` | -| [updateSpotFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2846) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/settings` | -| [updateSpotFollowerTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2855) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/setting-tpsl` | -| [getSpotFollowerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2863) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-traders` | -| [getSpotFollowerCurrentTraderSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2872) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-trader-symbols` | -| [getSpotFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2883) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-settings` | -| [getSpotFollowerHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2889) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-history-orders` | -| [getSpotFollowerOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2898) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-current-orders` | -| [sellSpotFollower()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2907) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/order-close-tracking` | -| [unfollowSpotTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2917) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/cancel-trader` | -| [getEarnSavingsProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2931) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/product` | -| [getEarnSavingsAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2938) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/account` | -| [getEarnSavingsAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2942) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/assets` | -| [getEarnSavingsRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2948) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/records` | -| [getEarnSavingsSubscription()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2954) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/subscribe-info` | -| [earnSubscribeSavings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2961) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/subscribe` | -| [getEarnSavingsSubscriptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2974) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/subscribe-result` | -| [earnRedeemSavings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2986) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/redeem` | -| [getEarnSavingsRedemptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2995) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/redeem-result` | -| [getEarnAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3015) | :closed_lock_with_key: | GET | `/api/v2/earn/account/assets` | -| [getSharkfinProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3034) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/product` | -| [getSharkfinAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3042) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/account` | -| [getSharkfinAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3046) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/assets` | -| [getSharkfinRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3052) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/records` | -| [getSharkfinSubscription()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3058) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/subscribe-info` | -| [subscribeSharkfin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3064) | :closed_lock_with_key: | POST | `/api/v2/earn/sharkfin/subscribe` | -| [getSharkfinSubscriptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3073) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/subscribe-result` | -| [getLoanCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3090) | | GET | `/api/v2/earn/loan/public/coinInfos` | -| [getLoanEstInterestAndBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3096) | | GET | `/api/v2/earn/loan/public/hour-interest` | -| [borrowLoan()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3107) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/borrow` | -| [getOngoingLoanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3115) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/ongoing-orders` | -| [repayLoan()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3123) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/repay` | -| [getRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3129) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/repay-history` | -| [updateLoanPledgeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3135) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/revise-pledge` | -| [getLoanPledgeRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3145) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/revise-history` | -| [getLoanHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3151) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/borrow-history` | -| [getLoanDebts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3157) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/debts` | -| [getLoanLiquidationRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3161) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/reduces` | +| [getAnnouncements()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L480) | | GET | `/api/v2/public/annoucements` | +| [getServerTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L492) | | GET | `/api/v2/public/time` | +| [getTradeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L500) | :closed_lock_with_key: | GET | `/api/v2/common/trade-rate` | +| [getSpotTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L515) | :closed_lock_with_key: | GET | `/api/v2/tax/spot-record` | +| [getFuturesTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L521) | :closed_lock_with_key: | GET | `/api/v2/tax/future-record` | +| [getMarginTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L527) | :closed_lock_with_key: | GET | `/api/v2/tax/margin-record` | +| [getP2PTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L533) | :closed_lock_with_key: | GET | `/api/v2/tax/p2p-record` | +| [getP2PMerchantList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L545) | :closed_lock_with_key: | GET | `/api/v2/p2p/merchantList` | +| [getP2PMerchantInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L554) | :closed_lock_with_key: | GET | `/api/v2/p2p/merchantInfo` | +| [getP2PMerchantOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L558) | :closed_lock_with_key: | GET | `/api/v2/p2p/orderList` | +| [getP2PMerchantAdvertisementList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L567) | :closed_lock_with_key: | GET | `/api/v2/p2p/advList` | +| [getSpotWhaleNetFlowData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L584) | :closed_lock_with_key: | GET | `/api/v2/spot/market/whale-net-flow` | +| [getFuturesActiveTakerBuySellVolumeData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L590) | | GET | `/api/v2/mix/market/taker-buy-sell` | +| [getFuturesActiveLongShortPositionData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L597) | | GET | `/api/v2/mix/market/position-long-short` | +| [getFuturesLongShortRatio()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L604) | | GET | `/api/v2/mix/market/long-short-ratio` | +| [getMarginLoanGrowthRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L612) | | GET | `/api/v2/mix/market/loan-growth` | +| [getIsolatedMarginBorrowingRatio()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L620) | | GET | `/api/v2/mix/market/isolated-borrow-rate` | +| [getFuturesActiveBuySellVolumeData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L627) | | GET | `/api/v2/mix/market/long-short` | +| [getSpotFundFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L634) | | GET | `/api/v2/spot/market/fund-flow` | +| [getTradeDataSupportSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L641) | | GET | `/api/v2/spot/market/support-symbols` | +| [getSpotFundNetFlowData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L650) | | GET | `/api/v2/spot/market/fund-net-flow` | +| [getFuturesActiveLongShortAccountData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L661) | | GET | `/api/v2/mix/market/account-long-short` | +| [createVirtualSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L674) | :closed_lock_with_key: | POST | `/api/v2/user/create-virtual-subaccount` | +| [modifyVirtualSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L680) | :closed_lock_with_key: | POST | `/api/v2/user/modify-virtual-subaccount` | +| [batchCreateVirtualSubaccountAndAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L688) | :closed_lock_with_key: | POST | `/api/v2/user/batch-create-subaccount-and-apikey` | +| [getVirtualSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L697) | :closed_lock_with_key: | GET | `/api/v2/user/virtual-subaccount-list` | +| [createVirtualSubaccountAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L710) | :closed_lock_with_key: | POST | `/api/v2/user/create-virtual-subaccount-apikey` | +| [modifyVirtualSubaccountAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L719) | :closed_lock_with_key: | POST | `/api/v2/user/modify-virtual-subaccount-apikey` | +| [getVirtualSubaccountAPIKeys()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L728) | :closed_lock_with_key: | GET | `/api/v2/user/virtual-subaccount-apikey-list` | +| [getFundingAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L742) | :closed_lock_with_key: | GET | `/api/v2/account/funding-assets` | +| [getBotAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L748) | :closed_lock_with_key: | GET | `/api/v2/account/bot-assets` | +| [getBalances()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L755) | :closed_lock_with_key: | GET | `/api/v2/account/all-account-balance` | +| [getConvertCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L772) | :closed_lock_with_key: | GET | `/api/v2/convert/currencies` | +| [getConvertQuotedPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L776) | :closed_lock_with_key: | GET | `/api/v2/convert/quoted-price` | +| [convert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L782) | :closed_lock_with_key: | POST | `/api/v2/convert/trade` | +| [getConvertHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L788) | :closed_lock_with_key: | GET | `/api/v2/convert/convert-record` | +| [getConvertBGBCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L803) | :closed_lock_with_key: | GET | `/api/v2/convert/bgb-convert-coin-list` | +| [convertBGB()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L811) | :closed_lock_with_key: | POST | `/api/v2/convert/bgb-convert` | +| [getConvertBGBHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L817) | :closed_lock_with_key: | GET | `/api/v2/convert/bgb-convert-records` | +| [getSpotCoinInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L837) | :closed_lock_with_key: | GET | `/api/v2/spot/public/coins` | +| [getSpotSymbolInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L843) | :closed_lock_with_key: | GET | `/api/v2/spot/public/symbols` | +| [getSpotVIPFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L849) | :closed_lock_with_key: | GET | `/api/v2/spot/market/vip-fee-rate` | +| [getSpotTicker()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L853) | :closed_lock_with_key: | GET | `/api/v2/spot/market/tickers` | +| [getSpotMergeDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L859) | :closed_lock_with_key: | GET | `/api/v2/spot/market/merge-depth` | +| [getSpotOrderBookDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L867) | :closed_lock_with_key: | GET | `/api/v2/spot/market/orderbook` | +| [getSpotCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L875) | :closed_lock_with_key: | GET | `/api/v2/spot/market/candles` | +| [getSpotHistoricCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L881) | :closed_lock_with_key: | GET | `/api/v2/spot/market/history-candles` | +| [getSpotRecentTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L887) | :closed_lock_with_key: | GET | `/api/v2/spot/market/fills` | +| [getSpotHistoricTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L894) | :closed_lock_with_key: | GET | `/api/v2/spot/market/fills-history` | +| [spotSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L906) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/place-order` | +| [spotCancelandSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L915) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-replace-order` | +| [spotBatchCancelandSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L921) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-replace-order` | +| [spotCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L930) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-order` | +| [spotBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L939) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-orders` | +| [spotBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L945) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-order` | +| [spotCancelSymbolOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L951) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-symbol-order` | +| [getSpotOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L959) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/orderInfo` | +| [getSpotOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L965) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/unfilled-orders` | +| [getSpotHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L971) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/history-orders` | +| [getSpotFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L977) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/fills` | +| [spotSubmitPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L989) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/place-plan-order` | +| [spotModifyPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L998) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/modify-plan-order` | +| [spotCancelPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1007) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-plan-order` | +| [getSpotCurrentPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1018) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/current-plan-order` | +| [getSpotPlanSubOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1028) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/plan-sub-order` | +| [getSpotHistoricPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1034) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/history-plan-order` | +| [spotCancelPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1044) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-plan-order` | +| [getSpotAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1059) | :closed_lock_with_key: | GET | `/api/v2/spot/account/info` | +| [getSpotAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1063) | :closed_lock_with_key: | GET | `/api/v2/spot/account/assets` | +| [getSpotSubAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1070) | :closed_lock_with_key: | GET | `/api/v2/spot/account/subaccount-assets` | +| [spotModifyDepositAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1074) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/modify-deposit-account` | +| [getSpotAccountBills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1084) | :closed_lock_with_key: | GET | `/api/v2/spot/account/bills` | +| [spotTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1090) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/transfer` | +| [getSpotTransferableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1099) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/transfer-coin-info` | +| [spotSubTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1106) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/subaccount-transfer` | +| [spotWithdraw()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1115) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/withdrawal` | +| [getSpotMainSubTransferRecord()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1124) | :closed_lock_with_key: | GET | `/api/v2/spot/account/sub-main-trans-record` | +| [getSpotTransferHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1133) | :closed_lock_with_key: | GET | `/api/v2/spot/account/transferRecords` | +| [spotSwitchBGBDeduct()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1139) | :closed_lock_with_key: | POST | `/api/v2/spot/account/switch-deduct` | +| [getSpotDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1145) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/deposit-address` | +| [getSpotSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1153) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/subaccount-deposit-address` | +| [getSpotBGBDeductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1165) | :closed_lock_with_key: | GET | `/api/v2/spot/account/deduct-info` | +| [spotCancelWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1173) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/cancel-withdrawal` | +| [getSubAccountDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1179) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/subaccount-deposit-records` | +| [getSpotWithdrawalHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1188) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/withdrawal-records` | +| [getSpotDepositHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1194) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/deposit-records` | +| [upgradeToUnifiedAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1209) | :closed_lock_with_key: | POST | `/api/v2/spot/account/upgrade` | +| [getUnifiedAccountSwitchStatus()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1219) | :closed_lock_with_key: | GET | `/api/v2/spot/account/upgrade-status` | +| [getFuturesVIPFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1241) | | GET | `/api/v2/mix/market/vip-fee-rate` | +| [getFuturesInterestRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1245) | | GET | `/api/v2/mix/market/union-interest-rate-history` | +| [getFuturesInterestExchangeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1254) | | GET | `/api/v2/mix/market/exchange-rate` | +| [getFuturesDiscountRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1265) | | GET | `/api/v2/mix/market/discount-rate` | +| [getFuturesMergeDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1269) | | GET | `/api/v2/mix/market/merge-depth` | +| [getFuturesTicker()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1275) | | GET | `/api/v2/mix/market/ticker` | +| [getFuturesAllTickers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1282) | | GET | `/api/v2/mix/market/tickers` | +| [getFuturesRecentTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1288) | | GET | `/api/v2/mix/market/fills` | +| [getFuturesHistoricTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1294) | | GET | `/api/v2/mix/market/fills-history` | +| [getFuturesCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1300) | | GET | `/api/v2/mix/market/candles` | +| [getFuturesHistoricCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1306) | | GET | `/api/v2/mix/market/history-candles` | +| [getFuturesHistoricIndexPriceCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1312) | | GET | `/api/v2/mix/market/history-index-candles` | +| [getFuturesHistoricMarkPriceCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1318) | | GET | `/api/v2/mix/market/history-mark-candles` | +| [getFuturesOpenInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1324) | | GET | `/api/v2/mix/market/open-interest` | +| [getFuturesNextFundingTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1336) | | GET | `/api/v2/mix/market/funding-time` | +| [getFuturesSymbolPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1343) | | GET | `/api/v2/mix/market/symbol-price` | +| [getFuturesHistoricFundingRates()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1350) | | GET | `/api/v2/mix/market/history-fund-rate` | +| [getFuturesCurrentFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1359) | | GET | `/api/v2/mix/market/current-fund-rate` | +| [getFuturesContractConfig()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1377) | | GET | `/api/v2/mix/market/contracts` | +| [getFuturesAccountAsset()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1390) | :closed_lock_with_key: | GET | `/api/v2/mix/account/account` | +| [getFuturesAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1396) | :closed_lock_with_key: | GET | `/api/v2/mix/account/accounts` | +| [getFuturesSubAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1402) | :closed_lock_with_key: | GET | `/api/v2/mix/account/sub-account-assets` | +| [getFuturesInterestHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1415) | :closed_lock_with_key: | GET | `/api/v2/mix/account/interest-history` | +| [getFuturesOpenCount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1421) | :closed_lock_with_key: | GET | `/api/v2/mix/account/open-count` | +| [setFuturesPositionAutoMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1429) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-auto-margin` | +| [setFuturesLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1435) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-leverage` | +| [setFuturesPositionMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1441) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-margin` | +| [setFuturesAssetMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1447) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-asset-mode` | +| [setFuturesMarginMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1454) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-margin-mode` | +| [setFuturesPositionMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1460) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-position-mode` | +| [getFuturesAccountBills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1471) | :closed_lock_with_key: | GET | `/api/v2/mix/account/bill` | +| [getUnionTransferLimits()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1486) | :closed_lock_with_key: | GET | `/api/v2/mix/account/transfer-limits` | +| [getUnionConfig()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1498) | :closed_lock_with_key: | GET | `/api/v2/mix/account/union-config` | +| [getSwitchUnionUsdt()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1508) | :closed_lock_with_key: | GET | `/api/v2/mix/account/switch-union-usdt` | +| [unionConvert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1518) | :closed_lock_with_key: | POST | `/api/v2/mix/account/union-convert` | +| [getFuturesMaxOpenableQuantity()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1530) | :closed_lock_with_key: | GET | `/api/v2/mix/account/max-open` | +| [getFuturesLiquidationPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1542) | :closed_lock_with_key: | GET | `/api/v2/mix/account/liq-price` | +| [getFuturesIsolatedSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1554) | :closed_lock_with_key: | GET | `/api/v2/mix/account/isolated-symbols` | +| [getFuturesPositionTier()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1566) | | GET | `/api/v2/mix/market/query-position-lever` | +| [getFuturesPosition()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1573) | :closed_lock_with_key: | GET | `/api/v2/mix/position/single-position` | +| [getFuturesPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1581) | :closed_lock_with_key: | GET | `/api/v2/mix/position/all-position` | +| [getFuturesHistoricPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1588) | :closed_lock_with_key: | GET | `/api/v2/mix/position/history-position` | +| [futuresSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1605) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-order` | +| [futuresSubmitReversal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1614) | :closed_lock_with_key: | POST | `/api/v2/mix/order/click-backhand` | +| [futuresBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1623) | :closed_lock_with_key: | POST | `/api/v2/mix/order/batch-place-order` | +| [futuresModifyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1629) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-order` | +| [futuresCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1638) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-order` | +| [futuresBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1647) | :closed_lock_with_key: | POST | `/api/v2/mix/order/batch-cancel-orders` | +| [futuresFlashClosePositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1653) | :closed_lock_with_key: | POST | `/api/v2/mix/order/close-positions` | +| [getFuturesOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1659) | :closed_lock_with_key: | GET | `/api/v2/mix/order/detail` | +| [getFuturesFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1665) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fills` | +| [getFuturesHistoricOrderFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1674) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fill-history` | +| [getFuturesOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1685) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-pending` | +| [getFuturesHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1694) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-history` | +| [futuresCancelAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1703) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-all-orders` | +| [getFuturesTriggerSubOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1715) | :closed_lock_with_key: | GET | `/api/v2/mix/order/plan-sub-order` | +| [futuresSubmitTPSLOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1723) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-tpsl-order` | +| [futuresSubmitPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1732) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-plan-order` | +| [futuresModifyTPSLPOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1741) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-tpsl-order` | +| [futuresModifyPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1750) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-plan-order` | +| [getFuturesPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1759) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-plan-pending` | +| [futuresCancelPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1768) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-plan-order` | +| [getFuturesHistoricPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1774) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-plan-history` | +| [modifySubaccountEmail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1799) | :closed_lock_with_key: | POST | `/api/v2/broker/account/modify-subaccount-email` | +| [getBrokerInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1809) | :closed_lock_with_key: | GET | `/api/v2/broker/account/info` | +| [createSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1819) | :closed_lock_with_key: | POST | `/api/v2/broker/account/create-subaccount` | +| [getSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1826) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-list` | +| [modifySubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1836) | :closed_lock_with_key: | POST | `/api/v2/broker/account/modify-subaccount` | +| [getSubaccountEmail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1842) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-email` | +| [getSubaccountSpotAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1848) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-spot-assets` | +| [getSubaccountFuturesAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1863) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-future-assets` | +| [createSubaccountDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1877) | :closed_lock_with_key: | POST | `/api/v2/broker/account/subaccount-address` | +| [subaccountWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1888) | :closed_lock_with_key: | POST | `/api/v2/broker/account/subaccount-withdrawal` | +| [subaccountSetAutoTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1900) | :closed_lock_with_key: | POST | `/api/v2/broker/account/set-subaccount-autotransfer` | +| [subaccountDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1916) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-deposit` | +| [subaccountWithdrawalRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1927) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-withdrawal` | +| [createSubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1942) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/create-subaccount-apikey` | +| [getSubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1951) | :closed_lock_with_key: | GET | `/api/v2/broker/manage/subaccount-apikey-list` | +| [modifySubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1960) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/modify-subaccount-apikey` | +| [getAllSubDepositWithdrawalRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1976) | :closed_lock_with_key: | GET | `/api/v2/broker/all-sub-deposit-withdrawal` | +| [getBrokerSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1993) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccounts` | +| [getBrokerCommissions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2005) | :closed_lock_with_key: | GET | `/api/v2/broker/commissions` | +| [getBrokerTradeVolume()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2017) | :closed_lock_with_key: | GET | `/api/v2/broker/trade-volume` | +| [getBrokerTotalCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2037) | :closed_lock_with_key: | GET | `/api/v2/broker/total-commission` | +| [getBrokerOrderCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2059) | :closed_lock_with_key: | GET | `/api/v2/broker/order-commission` | +| [getBrokerRebateInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2072) | :closed_lock_with_key: | GET | `/api/v2/broker/rebate-info` | +| [getAgentCustomerCommissions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2084) | :closed_lock_with_key: | GET | `/api/v2/broker/customer-commissions` | +| [getAgentSubCustomerList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2090) | :closed_lock_with_key: | GET | `/api/v2/broker/sub-customer-list` | +| [getAgentCustomerTradeVolume()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2096) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-trade-volume` | +| [getAgentCustomerList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2102) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-list` | +| [getAgentCustomerKycResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2108) | :closed_lock_with_key: | GET | `/api/v2/broker/customer-kyc-result` | +| [getAgentCustomerDeposits()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2114) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-deposit` | +| [getAgentCustomerAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2120) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-asset` | +| [getAgentCommissionDetail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2126) | :closed_lock_with_key: | GET | `/api/v2/broker/agent-commission` | +| [getMarginCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2146) | | GET | `/api/v2/margin/currencies` | +| [getMarginBorrowHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2156) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/borrow-history` | +| [getMarginRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2173) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/repay-history` | +| [getMarginInterestHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2190) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/interest-history` | +| [getMarginLiquidationHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2207) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/liquidation-history` | +| [getMarginFinancialHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2224) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/financial-records` | +| [getMarginAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2247) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/assets` | +| [marginBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2258) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/borrow` | +| [marginRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2281) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/repay` | +| [getMarginRiskRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2306) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/risk-rate` | +| [getMarginMaxBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2318) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/max-borrowable-amount` | +| [getMarginMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2331) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/max-transfer-out-amount` | +| [getMarginInterestRateAndMaxBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2346) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/interest-rate-and-limit` | +| [getMarginTierConfiguration()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2362) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/tier-data` | +| [marginFlashRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2374) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/flash-repay` | +| [getMarginFlashRepayResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2392) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/query-flash-repay-status` | +| [marginSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2416) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/place-order` | +| [marginBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2429) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/batch-place-order` | +| [marginCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2440) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/cancel-order` | +| [marginBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2460) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/batch-cancel-order` | +| [getMarginOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2474) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/open-orders` | +| [getMarginHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2488) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/history-orders` | +| [getMarginHistoricOrderFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2505) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/fills` | +| [getMarginLiquidationOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2519) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/liquidation-order` | +| [getFuturesTraderCurrentOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2551) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-current-track` | +| [getFuturesTraderHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2560) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-history-track` | +| [modifyFuturesTraderOrderTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2569) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/order-modify-tpsl` | +| [getFuturesTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2578) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-total-detail` | +| [getFuturesTraderProfitHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2584) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-history-summarys` | +| [getFuturesTraderProfitShareHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2590) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-history-details` | +| [closeFuturesTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2599) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/order-close-positions` | +| [getFuturesTraderProfitShare()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2618) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-details` | +| [getFuturesTraderProfitShareGroup()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2634) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profits-group-coin-date` | +| [getFuturesTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2652) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/config-query-symbols` | +| [updateFuturesTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2661) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-setting-symbols` | +| [updateFuturesTraderGlobalSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2670) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-settings-base` | +| [getFuturesTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2681) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/config-query-followers` | +| [removeFuturesTraderFollower()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2690) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-remove-follower` | +| [getFuturesFollowerCurrentOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2707) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-current-orders` | +| [getFuturesFollowerHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2716) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-history-orders` | +| [updateFuturesFollowerTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2725) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/setting-tpsl` | +| [updateFuturesFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2731) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/settings` | +| [getFuturesFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2737) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-settings` | +| [closeFuturesFollowerPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2743) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/close-positions` | +| [getFuturesFollowerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2756) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-traders` | +| [getFuturesFollowerFollowLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2762) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-quantity-limit` | +| [unfollowFuturesTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2780) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/cancel-trader` | +| [getBrokerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2794) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-traders` | +| [getBrokerTradersHistoricalOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2798) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-history-traces` | +| [getBrokerTradersPendingOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2805) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-current-traces` | +| [getSpotTraderProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2820) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-summarys` | +| [getSpotTraderHistoryProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2824) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-history-details` | +| [getSpotTraderUnrealizedProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2833) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-details` | +| [getSpotTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2841) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-total-detail` | +| [modifySpotTraderOrderTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2845) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/order-modify-tpsl` | +| [getSpotTraderHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2856) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-history-track` | +| [getSpotTraderCurrentOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2865) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-current-track` | +| [sellSpotTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2874) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/order-close-tracking` | +| [getSpotTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2884) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/config-setting-symbols` | +| [removeSpotTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2894) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/config-remove-follower` | +| [getSpotTraderConfiguration()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2903) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/config-query-settings` | +| [getSpotTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2907) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/config-query-followers` | +| [cancelSpotFollowerOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2924) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/stop-order` | +| [updateSpotFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2930) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/settings` | +| [updateSpotFollowerTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2939) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/setting-tpsl` | +| [getSpotFollowerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2947) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-traders` | +| [getSpotFollowerCurrentTraderSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2956) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-trader-symbols` | +| [getSpotFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2967) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-settings` | +| [getSpotFollowerHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2973) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-history-orders` | +| [getSpotFollowerOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2982) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-current-orders` | +| [sellSpotFollower()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2991) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/order-close-tracking` | +| [unfollowSpotTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3001) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/cancel-trader` | +| [getEarnSavingsProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3015) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/product` | +| [getEarnSavingsAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3022) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/account` | +| [getEarnSavingsAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3026) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/assets` | +| [getEarnSavingsRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3032) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/records` | +| [getEarnSavingsSubscription()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3038) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/subscribe-info` | +| [earnSubscribeSavings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3045) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/subscribe` | +| [getEarnSavingsSubscriptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3058) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/subscribe-result` | +| [earnRedeemSavings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3070) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/redeem` | +| [getEarnSavingsRedemptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3079) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/redeem-result` | +| [getEarnAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3099) | :closed_lock_with_key: | GET | `/api/v2/earn/account/assets` | +| [getEarnEliteProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3118) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/product` | +| [getEarnEliteAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3122) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/assets` | +| [getEarnEliteRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3126) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/records` | +| [getEarnEliteSubscribeInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3132) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/subscribe-info` | +| [subscribeEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3138) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/subscribe` | +| [getEarnEliteSubscribeResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3144) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/subscribe-result` | +| [getEarnEliteRedeemInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3150) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/redeem-info` | +| [redeemEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3156) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/redeem` | +| [getSharkfinProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3170) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/product` | +| [getSharkfinAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3178) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/account` | +| [getSharkfinAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3182) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/assets` | +| [getSharkfinRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3188) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/records` | +| [getSharkfinSubscription()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3194) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/subscribe-info` | +| [subscribeSharkfin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3200) | :closed_lock_with_key: | POST | `/api/v2/earn/sharkfin/subscribe` | +| [getSharkfinSubscriptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3209) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/subscribe-result` | +| [getLoanCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3226) | | GET | `/api/v2/earn/loan/public/coinInfos` | +| [getLoanEstInterestAndBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3232) | | GET | `/api/v2/earn/loan/public/hour-interest` | +| [borrowLoan()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3243) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/borrow` | +| [getOngoingLoanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3251) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/ongoing-orders` | +| [repayLoan()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3259) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/repay` | +| [getRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3265) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/repay-history` | +| [updateLoanPledgeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3271) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/revise-pledge` | +| [getLoanPledgeRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3281) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/revise-history` | +| [getLoanHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3287) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/borrow-history` | +| [getLoanDebts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3293) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/debts` | +| [getLoanLiquidationRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3297) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/reduces` | # rest-client-v3.ts @@ -331,115 +347,127 @@ This table includes all endpoints from the official Exchange API docs and corres | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [getServerTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L294) | | GET | `/api/v3/public/time` | -| [getInstruments()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L311) | | GET | `/api/v3/market/instruments` | -| [getMarketFeeGroup()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L320) | | GET | `/api/v3/market/fee-group` | -| [getMarketScoreWeights()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L329) | | GET | `/api/v3/market/score-weights` | -| [getTickers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L338) | | GET | `/api/v3/market/tickers` | -| [getOrderBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L345) | | GET | `/api/v3/market/orderbook` | -| [getFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L354) | | GET | `/api/v3/market/fills` | -| [getProofOfReserves()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L363) | | GET | `/api/v3/market/proof-of-reserves` | -| [getOpenInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L370) | | GET | `/api/v3/market/open-interest` | -| [getCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L380) | | GET | `/api/v3/market/candles` | -| [getHistoryCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L389) | | GET | `/api/v3/market/history-candles` | -| [getCurrentFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L398) | | GET | `/api/v3/market/current-fund-rate` | -| [getHistoryFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L407) | | GET | `/api/v3/market/history-fund-rate` | -| [getRiskReserve()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L416) | | GET | `/api/v3/market/risk-reserve` | -| [getDiscountRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L425) | | GET | `/api/v3/market/discount-rate` | -| [getMarginLoans()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L432) | | GET | `/api/v3/market/margin-loans` | -| [getPositionTier()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L441) | | GET | `/api/v3/market/position-tier` | -| [getContractsOi()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L450) | | GET | `/api/v3/market/oi-limit` | -| [getIndexComponents()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L459) | | GET | `/api/v3/market/index-components` | -| [getBalances()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L474) | :closed_lock_with_key: | GET | `/api/v3/account/assets` | -| [getFundingAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L481) | :closed_lock_with_key: | GET | `/api/v3/account/funding-assets` | -| [getAccountSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L490) | :closed_lock_with_key: | GET | `/api/v3/account/settings` | -| [setLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L497) | :closed_lock_with_key: | POST | `/api/v3/account/set-leverage` | -| [setHoldMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L504) | :closed_lock_with_key: | POST | `/api/v3/account/set-hold-mode` | -| [getFinancialRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L513) | :closed_lock_with_key: | GET | `/api/v3/account/financial-records` | -| [getRepayableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L525) | :closed_lock_with_key: | GET | `/api/v3/account/repayable-coins` | -| [getPaymentCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L537) | :closed_lock_with_key: | GET | `/api/v3/account/payment-coins` | -| [submitRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L549) | :closed_lock_with_key: | POST | `/api/v3/account/repay` | -| [getConvertRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L556) | :closed_lock_with_key: | GET | `/api/v3/account/convert-records` | -| [setDepositAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L571) | :closed_lock_with_key: | POST | `/api/v3/account/deposit-account` | -| [switchDeduct()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L580) | :closed_lock_with_key: | POST | `/api/v3/account/switch-deduct` | -| [getDeductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L587) | :closed_lock_with_key: | GET | `/api/v3/account/deduct-info` | -| [getFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L598) | :closed_lock_with_key: | GET | `/api/v3/account/fee-rate` | -| [getMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L614) | :closed_lock_with_key: | GET | `/api/v3/account/max-transferable` | -| [getOpenInterestLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L626) | :closed_lock_with_key: | GET | `/api/v3/account/open-interest-limit` | -| [downgradeAccountToClassic()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L641) | :closed_lock_with_key: | POST | `/api/v3/account/switch` | -| [getUnifiedAccountSwitchStatus()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L649) | :closed_lock_with_key: | GET | `/api/v3/account/switch-status` | -| [getTaxRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L665) | :closed_lock_with_key: | GET | `/api/v3/tax/records` | -| [createSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L680) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub` | -| [freezeSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L689) | :closed_lock_with_key: | POST | `/api/v3/user/freeze-sub` | -| [getSubUnifiedAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L698) | :closed_lock_with_key: | GET | `/api/v3/account/sub-unified-assets` | -| [getSubAccountList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L707) | :closed_lock_with_key: | GET | `/api/v3/user/sub-list` | -| [createSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L720) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub-api` | -| [updateSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L729) | :closed_lock_with_key: | POST | `/api/v3/user/update-sub-api` | -| [deleteSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L738) | :closed_lock_with_key: | POST | `/api/v3/user/delete-sub-api` | -| [getSubAccountApiKeys()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L747) | :closed_lock_with_key: | GET | `/api/v3/user/sub-api-list` | -| [getTransferableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L766) | :closed_lock_with_key: | GET | `/api/v3/account/transferable-coins` | -| [submitTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L775) | :closed_lock_with_key: | POST | `/api/v3/account/transfer` | -| [subAccountTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L784) | :closed_lock_with_key: | POST | `/api/v3/account/sub-transfer` | -| [getSubTransferRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L796) | :closed_lock_with_key: | GET | `/api/v3/account/sub-transfer-record` | -| [getDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L814) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-address` | -| [getSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L823) | :closed_lock_with_key: | GET | `/api/v3/account/sub-deposit-address` | -| [getDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L832) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-records` | -| [getSubDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L841) | :closed_lock_with_key: | POST | `/api/v3/account/sub-deposit-records` | -| [submitWithdraw()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L856) | :closed_lock_with_key: | POST | `/api/v3/account/withdraw` | -| [getWithdrawRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L865) | :closed_lock_with_key: | GET | `/api/v3/account/withdrawal-records` | -| [submitNewOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L880) | :closed_lock_with_key: | POST | `/api/v3/trade/place-order` | -| [modifyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L889) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-order` | -| [cancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L898) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-order` | -| [placeBatchOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L907) | :closed_lock_with_key: | POST | `/api/v3/trade/place-batch` | -| [batchModifyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L916) | :closed_lock_with_key: | POST | `/api/v3/trade/batch-modify-order` | -| [cancelBatchOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L925) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-batch` | -| [cancelAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L934) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-symbol-order` | -| [closeAllPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L943) | :closed_lock_with_key: | POST | `/api/v3/trade/close-positions` | -| [getOrderInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L952) | :closed_lock_with_key: | GET | `/api/v3/trade/order-info` | -| [getUnfilledOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L961) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-orders` | -| [getHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L973) | :closed_lock_with_key: | GET | `/api/v3/trade/history-orders` | -| [getTradeFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L985) | :closed_lock_with_key: | GET | `/api/v3/trade/fills` | -| [getCurrentPosition()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L997) | :closed_lock_with_key: | GET | `/api/v3/position/current-position` | -| [getPositionHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1008) | :closed_lock_with_key: | GET | `/api/v3/position/history-position` | -| [getMaxOpenAvailable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1020) | :closed_lock_with_key: | POST | `/api/v3/account/max-open-available` | -| [getPositionAdlRank()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1029) | :closed_lock_with_key: | GET | `/api/v3/position/adlRank` | -| [countdownCancelAll()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1036) | :closed_lock_with_key: | POST | `/api/v3/trade/countdown-cancel-all` | -| [getLoanTransfered()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1051) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/transfered` | -| [getLoanSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1060) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/symbols` | -| [getLoanRiskUnit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1069) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/risk-unit` | -| [getLoanRepaidHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1080) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/repaid-history` | -| [getLoanProductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1089) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/product-infos` | -| [getLoanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1098) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/loan-order` | -| [getLoanLTVConvert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1107) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/ltv-convert` | -| [getLoanMarginCoinInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1116) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/ensure-coins-convert` | -| [bindLoanUid()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1128) | :closed_lock_with_key: | POST | `/api/v3/ins-loan/bind-uid` | -| [getLoanCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1143) | :closed_lock_with_key: | GET | `/api/v3/loan/coins` | -| [getLoanInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1152) | :closed_lock_with_key: | GET | `/api/v3/loan/interest` | -| [loanBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1161) | :closed_lock_with_key: | POST | `/api/v3/loan/borrow` | -| [getLoanBorrowOngoing()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1170) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-ongoing` | -| [getLoanBorrowHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1179) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-history` | -| [loanRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1188) | :closed_lock_with_key: | POST | `/api/v3/loan/repay` | -| [getLoanRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1197) | :closed_lock_with_key: | GET | `/api/v3/loan/repay-history` | -| [loanRevisePledge()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1206) | :closed_lock_with_key: | POST | `/api/v3/loan/revise-pledge` | -| [getLoanPledgeRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1215) | :closed_lock_with_key: | GET | `/api/v3/loan/pledge-rate-history` | -| [getLoanDebts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1224) | :closed_lock_with_key: | GET | `/api/v3/loan/debts` | -| [getLoanReduces()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1231) | :closed_lock_with_key: | GET | `/api/v3/loan/reduces` | -| [submitStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1246) | :closed_lock_with_key: | POST | `/api/v3/trade/place-strategy-order` | -| [modifyStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1255) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-strategy-order` | -| [cancelStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1264) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-strategy-order` | -| [getUnfilledStrategyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1273) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-strategy-orders` | -| [getHistoryStrategyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1282) | :closed_lock_with_key: | GET | `/api/v3/trade/history-strategy-orders` | -| [createBrokerSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1303) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub` | -| [getBrokerSubAccountList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1315) | :closed_lock_with_key: | GET | `/api/v3/broker/sub-list` | -| [modifyBrokerSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1327) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub` | -| [brokerSubWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1342) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-withdrawal` | -| [getBrokerSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1354) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-deposit-address` | -| [getBrokerAllSubDepositWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1366) | :closed_lock_with_key: | GET | `/api/v3/broker/all-sub-deposit-withdrawal` | -| [getBrokerCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1378) | :closed_lock_with_key: | GET | `/api/v3/broker/commission` | -| [createBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1390) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub-apikey` | -| [modifyBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1402) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub-apikey` | -| [deleteBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1418) | :closed_lock_with_key: | POST | `/api/v3/broker/delete-sub-apikey` | -| [getBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1430) | :closed_lock_with_key: | GET | `/api/v3/broker/query-sub-apikey` | +| [getServerTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L319) | | GET | `/api/v3/public/time` | +| [getInstruments()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L336) | | GET | `/api/v3/market/instruments` | +| [getMarketFeeGroup()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L345) | | GET | `/api/v3/market/fee-group` | +| [getMarketScoreWeights()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L354) | | GET | `/api/v3/market/score-weights` | +| [getTickers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L363) | | GET | `/api/v3/market/tickers` | +| [getOrderBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L370) | | GET | `/api/v3/market/orderbook` | +| [getFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L379) | | GET | `/api/v3/market/fills` | +| [getProofOfReserves()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L388) | | GET | `/api/v3/market/proof-of-reserves` | +| [getOpenInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L395) | | GET | `/api/v3/market/open-interest` | +| [getCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L405) | | GET | `/api/v3/market/candles` | +| [getHistoryCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L414) | | GET | `/api/v3/market/history-candles` | +| [getCurrentFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L423) | | GET | `/api/v3/market/current-fund-rate` | +| [getHistoryFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L432) | | GET | `/api/v3/market/history-fund-rate` | +| [getRiskReserve()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L441) | | GET | `/api/v3/market/risk-reserve` | +| [getRiskReserveHour()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L450) | | GET | `/api/v3/market/risk-reserve-hour` | +| [getRiskReserveAll()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L459) | | GET | `/api/v3/market/risk-reserve-all` | +| [getDiscountRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L468) | | GET | `/api/v3/market/discount-rate` | +| [getMarginLoans()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L475) | | GET | `/api/v3/market/margin-loans` | +| [getPositionTier()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L484) | | GET | `/api/v3/market/position-tier` | +| [getContractsOi()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L493) | | GET | `/api/v3/market/oi-limit` | +| [getIndexComponents()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L502) | | GET | `/api/v3/market/index-components` | +| [getCopyFuturesTradingPairs()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L519) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/trading-pairs` | +| [getCopyFuturesPositionSummary()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L530) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/position-summary` | +| [getBalances()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L545) | :closed_lock_with_key: | GET | `/api/v3/account/assets` | +| [getFundingAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L552) | :closed_lock_with_key: | GET | `/api/v3/account/funding-assets` | +| [getAccountSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L561) | :closed_lock_with_key: | GET | `/api/v3/account/settings` | +| [setLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L568) | :closed_lock_with_key: | POST | `/api/v3/account/set-leverage` | +| [setHoldMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L575) | :closed_lock_with_key: | POST | `/api/v3/account/set-hold-mode` | +| [getFinancialRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L584) | :closed_lock_with_key: | GET | `/api/v3/account/financial-records` | +| [getRepayableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L596) | :closed_lock_with_key: | GET | `/api/v3/account/repayable-coins` | +| [getPaymentCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L608) | :closed_lock_with_key: | GET | `/api/v3/account/payment-coins` | +| [submitRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L620) | :closed_lock_with_key: | POST | `/api/v3/account/repay` | +| [getConvertRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L627) | :closed_lock_with_key: | GET | `/api/v3/account/convert-records` | +| [setDepositAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L642) | :closed_lock_with_key: | POST | `/api/v3/account/deposit-account` | +| [switchDeduct()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L651) | :closed_lock_with_key: | POST | `/api/v3/account/switch-deduct` | +| [getDeductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L658) | :closed_lock_with_key: | GET | `/api/v3/account/deduct-info` | +| [getFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L669) | :closed_lock_with_key: | GET | `/api/v3/account/fee-rate` | +| [getMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L685) | :closed_lock_with_key: | GET | `/api/v3/account/max-transferable` | +| [getOpenInterestLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L697) | :closed_lock_with_key: | GET | `/api/v3/account/open-interest-limit` | +| [downgradeAccountToClassic()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L712) | :closed_lock_with_key: | POST | `/api/v3/account/switch` | +| [getUnifiedAccountSwitchStatus()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L720) | :closed_lock_with_key: | GET | `/api/v3/account/switch-status` | +| [getTaxRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L736) | :closed_lock_with_key: | GET | `/api/v3/tax/records` | +| [createSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L751) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub` | +| [freezeSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L760) | :closed_lock_with_key: | POST | `/api/v3/user/freeze-sub` | +| [getSubUnifiedAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L769) | :closed_lock_with_key: | GET | `/api/v3/account/sub-unified-assets` | +| [getSubAccountList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L778) | :closed_lock_with_key: | GET | `/api/v3/user/sub-list` | +| [createSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L791) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub-api` | +| [updateSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L800) | :closed_lock_with_key: | POST | `/api/v3/user/update-sub-api` | +| [deleteSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L809) | :closed_lock_with_key: | POST | `/api/v3/user/delete-sub-api` | +| [getSubAccountApiKeys()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L818) | :closed_lock_with_key: | GET | `/api/v3/user/sub-api-list` | +| [getTransferableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L837) | :closed_lock_with_key: | GET | `/api/v3/account/transferable-coins` | +| [submitTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L846) | :closed_lock_with_key: | POST | `/api/v3/account/transfer` | +| [subAccountTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L855) | :closed_lock_with_key: | POST | `/api/v3/account/sub-transfer` | +| [getSubTransferRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L867) | :closed_lock_with_key: | GET | `/api/v3/account/sub-transfer-record` | +| [getDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L885) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-address` | +| [getSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L894) | :closed_lock_with_key: | GET | `/api/v3/account/sub-deposit-address` | +| [getDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L903) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-records` | +| [getSubDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L912) | :closed_lock_with_key: | POST | `/api/v3/account/sub-deposit-records` | +| [submitWithdraw()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L927) | :closed_lock_with_key: | POST | `/api/v3/account/withdraw` | +| [getWithdrawRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L936) | :closed_lock_with_key: | GET | `/api/v3/account/withdrawal-records` | +| [submitNewOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L951) | :closed_lock_with_key: | POST | `/api/v3/trade/place-order` | +| [modifyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L960) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-order` | +| [cancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L969) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-order` | +| [placeBatchOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L978) | :closed_lock_with_key: | POST | `/api/v3/trade/place-batch` | +| [batchModifyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L987) | :closed_lock_with_key: | POST | `/api/v3/trade/batch-modify-order` | +| [cancelBatchOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L996) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-batch` | +| [cancelAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1005) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-symbol-order` | +| [closeAllPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1014) | :closed_lock_with_key: | POST | `/api/v3/trade/close-positions` | +| [getOrderInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1023) | :closed_lock_with_key: | GET | `/api/v3/trade/order-info` | +| [getUnfilledOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1032) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-orders` | +| [getHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1044) | :closed_lock_with_key: | GET | `/api/v3/trade/history-orders` | +| [getTradeFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1056) | :closed_lock_with_key: | GET | `/api/v3/trade/fills` | +| [getCurrentPosition()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1068) | :closed_lock_with_key: | GET | `/api/v3/position/current-position` | +| [getPositionHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1079) | :closed_lock_with_key: | GET | `/api/v3/position/history-position` | +| [getMaxOpenAvailable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1091) | :closed_lock_with_key: | POST | `/api/v3/account/max-open-available` | +| [getPositionAdlRank()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1100) | :closed_lock_with_key: | GET | `/api/v3/position/adlRank` | +| [countdownCancelAll()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1107) | :closed_lock_with_key: | POST | `/api/v3/trade/countdown-cancel-all` | +| [getLoanTransfered()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1122) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/transfered` | +| [getLoanSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1131) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/symbols` | +| [getLoanRiskUnit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1140) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/risk-unit` | +| [getLoanRepaidHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1151) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/repaid-history` | +| [getLoanProductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1160) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/product-infos` | +| [getLoanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1169) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/loan-order` | +| [getLoanLTVConvert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1178) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/ltv-convert` | +| [getLoanMarginCoinInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1187) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/ensure-coins-convert` | +| [bindLoanUid()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1199) | :closed_lock_with_key: | POST | `/api/v3/ins-loan/bind-uid` | +| [getLoanCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1214) | :closed_lock_with_key: | GET | `/api/v3/loan/coins` | +| [getLoanInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1223) | :closed_lock_with_key: | GET | `/api/v3/loan/interest` | +| [loanBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1232) | :closed_lock_with_key: | POST | `/api/v3/loan/borrow` | +| [getLoanBorrowOngoing()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1241) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-ongoing` | +| [getLoanBorrowHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1250) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-history` | +| [loanRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1259) | :closed_lock_with_key: | POST | `/api/v3/loan/repay` | +| [getLoanRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1268) | :closed_lock_with_key: | GET | `/api/v3/loan/repay-history` | +| [loanRevisePledge()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1277) | :closed_lock_with_key: | POST | `/api/v3/loan/revise-pledge` | +| [getLoanPledgeRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1286) | :closed_lock_with_key: | GET | `/api/v3/loan/pledge-rate-history` | +| [getLoanDebts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1295) | :closed_lock_with_key: | GET | `/api/v3/loan/debts` | +| [getLoanReduces()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1302) | :closed_lock_with_key: | GET | `/api/v3/loan/reduces` | +| [submitStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1317) | :closed_lock_with_key: | POST | `/api/v3/trade/place-strategy-order` | +| [modifyStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1326) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-strategy-order` | +| [cancelStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1335) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-strategy-order` | +| [getUnfilledStrategyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1344) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-strategy-orders` | +| [getHistoryStrategyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1353) | :closed_lock_with_key: | GET | `/api/v3/trade/history-strategy-orders` | +| [createBrokerSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1374) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub` | +| [getBrokerSubAccountList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1386) | :closed_lock_with_key: | GET | `/api/v3/broker/sub-list` | +| [modifyBrokerSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1398) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub` | +| [brokerSubWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1413) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-withdrawal` | +| [getBrokerSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1425) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-deposit-address` | +| [getBrokerAllSubDepositWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1437) | :closed_lock_with_key: | GET | `/api/v3/broker/all-sub-deposit-withdrawal` | +| [getBrokerCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1449) | :closed_lock_with_key: | GET | `/api/v3/broker/commission` | +| [createBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1461) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub-apikey` | +| [modifyBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1473) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub-apikey` | +| [deleteBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1489) | :closed_lock_with_key: | POST | `/api/v3/broker/delete-sub-apikey` | +| [getBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1501) | :closed_lock_with_key: | GET | `/api/v3/broker/query-sub-apikey` | +| [getEarnEliteProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1513) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-product` | +| [getEarnEliteAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1517) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-assets` | +| [getEarnEliteRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1521) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-records` | +| [getEarnEliteSubscribeInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1527) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-subscribe-info` | +| [subscribeEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1533) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-subscribe` | +| [getEarnEliteSubscribeResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1539) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-subscribe-result` | +| [getEarnEliteRedeemInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1545) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-redeem-info` | +| [redeemEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1551) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-redeem` | # websocket-api-client.ts diff --git a/examples/apidoc/RestClientV2/getAgentCommissionDetail.js b/examples/apidoc/RestClientV2/getAgentCommissionDetail.js new file mode 100644 index 0000000..0a439fc --- /dev/null +++ b/examples/apidoc/RestClientV2/getAgentCommissionDetail.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/broker/agent-commission +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getAgentCommissionDetail(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getAgentCustomerAssets.js b/examples/apidoc/RestClientV2/getAgentCustomerAssets.js new file mode 100644 index 0000000..d5dd2e0 --- /dev/null +++ b/examples/apidoc/RestClientV2/getAgentCustomerAssets.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/broker/customer-asset +// METHOD: POST +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getAgentCustomerAssets(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getAgentCustomerCommissions.js b/examples/apidoc/RestClientV2/getAgentCustomerCommissions.js new file mode 100644 index 0000000..0cfc279 --- /dev/null +++ b/examples/apidoc/RestClientV2/getAgentCustomerCommissions.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/broker/customer-commissions +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getAgentCustomerCommissions(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getAgentCustomerDeposits.js b/examples/apidoc/RestClientV2/getAgentCustomerDeposits.js new file mode 100644 index 0000000..71b3fb4 --- /dev/null +++ b/examples/apidoc/RestClientV2/getAgentCustomerDeposits.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/broker/customer-deposit +// METHOD: POST +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getAgentCustomerDeposits(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getAgentCustomerKycResult.js b/examples/apidoc/RestClientV2/getAgentCustomerKycResult.js new file mode 100644 index 0000000..bee1ad1 --- /dev/null +++ b/examples/apidoc/RestClientV2/getAgentCustomerKycResult.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/broker/customer-kyc-result +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getAgentCustomerKycResult(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getAgentCustomerList.js b/examples/apidoc/RestClientV2/getAgentCustomerList.js new file mode 100644 index 0000000..bf89425 --- /dev/null +++ b/examples/apidoc/RestClientV2/getAgentCustomerList.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/broker/customer-list +// METHOD: POST +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getAgentCustomerList(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getAgentCustomerTradeVolume.js b/examples/apidoc/RestClientV2/getAgentCustomerTradeVolume.js new file mode 100644 index 0000000..e6f40b1 --- /dev/null +++ b/examples/apidoc/RestClientV2/getAgentCustomerTradeVolume.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/broker/customer-trade-volume +// METHOD: POST +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getAgentCustomerTradeVolume(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getAgentSubCustomerList.js b/examples/apidoc/RestClientV2/getAgentSubCustomerList.js new file mode 100644 index 0000000..042df1f --- /dev/null +++ b/examples/apidoc/RestClientV2/getAgentSubCustomerList.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/broker/sub-customer-list +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getAgentSubCustomerList(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getEarnEliteAssets.js b/examples/apidoc/RestClientV2/getEarnEliteAssets.js new file mode 100644 index 0000000..29aae64 --- /dev/null +++ b/examples/apidoc/RestClientV2/getEarnEliteAssets.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/earn/elite/assets +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getEarnEliteAssets(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getEarnEliteProducts.js b/examples/apidoc/RestClientV2/getEarnEliteProducts.js new file mode 100644 index 0000000..d462de1 --- /dev/null +++ b/examples/apidoc/RestClientV2/getEarnEliteProducts.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/earn/elite/product +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getEarnEliteProducts(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getEarnEliteRecords.js b/examples/apidoc/RestClientV2/getEarnEliteRecords.js new file mode 100644 index 0000000..34c4264 --- /dev/null +++ b/examples/apidoc/RestClientV2/getEarnEliteRecords.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/earn/elite/records +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getEarnEliteRecords(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getEarnEliteRedeemInfo.js b/examples/apidoc/RestClientV2/getEarnEliteRedeemInfo.js new file mode 100644 index 0000000..f25fcf6 --- /dev/null +++ b/examples/apidoc/RestClientV2/getEarnEliteRedeemInfo.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/earn/elite/redeem-info +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getEarnEliteRedeemInfo(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getEarnEliteSubscribeInfo.js b/examples/apidoc/RestClientV2/getEarnEliteSubscribeInfo.js new file mode 100644 index 0000000..28286fd --- /dev/null +++ b/examples/apidoc/RestClientV2/getEarnEliteSubscribeInfo.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/earn/elite/subscribe-info +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getEarnEliteSubscribeInfo(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/getEarnEliteSubscribeResult.js b/examples/apidoc/RestClientV2/getEarnEliteSubscribeResult.js new file mode 100644 index 0000000..00045c6 --- /dev/null +++ b/examples/apidoc/RestClientV2/getEarnEliteSubscribeResult.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/earn/elite/subscribe-result +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getEarnEliteSubscribeResult(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/redeemEarnElite.js b/examples/apidoc/RestClientV2/redeemEarnElite.js new file mode 100644 index 0000000..a373ff8 --- /dev/null +++ b/examples/apidoc/RestClientV2/redeemEarnElite.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/earn/elite/redeem +// METHOD: POST +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.redeemEarnElite(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV2/subscribeEarnElite.js b/examples/apidoc/RestClientV2/subscribeEarnElite.js new file mode 100644 index 0000000..230be1e --- /dev/null +++ b/examples/apidoc/RestClientV2/subscribeEarnElite.js @@ -0,0 +1,24 @@ +import { RestClientV2 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV2 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v2/earn/elite/subscribe +// METHOD: POST +// PUBLIC: NO + +const client = new RestClientV2({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.subscribeEarnElite(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/getCopyFuturesPositionSummary.js b/examples/apidoc/RestClientV3/getCopyFuturesPositionSummary.js new file mode 100644 index 0000000..dd9633e --- /dev/null +++ b/examples/apidoc/RestClientV3/getCopyFuturesPositionSummary.js @@ -0,0 +1,24 @@ +import { RestClientV3 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV3 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v3/copy/futures/position-summary +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getCopyFuturesPositionSummary(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/getCopyFuturesTradingPairs.js b/examples/apidoc/RestClientV3/getCopyFuturesTradingPairs.js new file mode 100644 index 0000000..0f25dc0 --- /dev/null +++ b/examples/apidoc/RestClientV3/getCopyFuturesTradingPairs.js @@ -0,0 +1,24 @@ +import { RestClientV3 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV3 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v3/copy/futures/trading-pairs +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getCopyFuturesTradingPairs(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/getEarnEliteAssets.js b/examples/apidoc/RestClientV3/getEarnEliteAssets.js new file mode 100644 index 0000000..cba80d2 --- /dev/null +++ b/examples/apidoc/RestClientV3/getEarnEliteAssets.js @@ -0,0 +1,24 @@ +import { RestClientV3 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV3 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v3/earn/elite-assets +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getEarnEliteAssets(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/getEarnEliteProducts.js b/examples/apidoc/RestClientV3/getEarnEliteProducts.js new file mode 100644 index 0000000..3ee4bb9 --- /dev/null +++ b/examples/apidoc/RestClientV3/getEarnEliteProducts.js @@ -0,0 +1,24 @@ +import { RestClientV3 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV3 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v3/earn/elite-product +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getEarnEliteProducts(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/getEarnEliteRecords.js b/examples/apidoc/RestClientV3/getEarnEliteRecords.js new file mode 100644 index 0000000..ec2789b --- /dev/null +++ b/examples/apidoc/RestClientV3/getEarnEliteRecords.js @@ -0,0 +1,24 @@ +import { RestClientV3 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV3 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v3/earn/elite-records +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getEarnEliteRecords(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/getEarnEliteRedeemInfo.js b/examples/apidoc/RestClientV3/getEarnEliteRedeemInfo.js new file mode 100644 index 0000000..d882526 --- /dev/null +++ b/examples/apidoc/RestClientV3/getEarnEliteRedeemInfo.js @@ -0,0 +1,24 @@ +import { RestClientV3 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV3 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v3/earn/elite-redeem-info +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getEarnEliteRedeemInfo(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/getEarnEliteSubscribeInfo.js b/examples/apidoc/RestClientV3/getEarnEliteSubscribeInfo.js new file mode 100644 index 0000000..5248280 --- /dev/null +++ b/examples/apidoc/RestClientV3/getEarnEliteSubscribeInfo.js @@ -0,0 +1,24 @@ +import { RestClientV3 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV3 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v3/earn/elite-subscribe-info +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getEarnEliteSubscribeInfo(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/getEarnEliteSubscribeResult.js b/examples/apidoc/RestClientV3/getEarnEliteSubscribeResult.js new file mode 100644 index 0000000..7c5f911 --- /dev/null +++ b/examples/apidoc/RestClientV3/getEarnEliteSubscribeResult.js @@ -0,0 +1,24 @@ +import { RestClientV3 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV3 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v3/earn/elite-subscribe-result +// METHOD: GET +// PUBLIC: NO + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getEarnEliteSubscribeResult(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/getRiskReserveAll.js b/examples/apidoc/RestClientV3/getRiskReserveAll.js new file mode 100644 index 0000000..ba51542 --- /dev/null +++ b/examples/apidoc/RestClientV3/getRiskReserveAll.js @@ -0,0 +1,24 @@ +import { RestClientV3 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV3 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v3/market/risk-reserve-all +// METHOD: GET +// PUBLIC: YES + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getRiskReserveAll(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/getRiskReserveHour.js b/examples/apidoc/RestClientV3/getRiskReserveHour.js new file mode 100644 index 0000000..ea34be3 --- /dev/null +++ b/examples/apidoc/RestClientV3/getRiskReserveHour.js @@ -0,0 +1,24 @@ +import { RestClientV3 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV3 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v3/market/risk-reserve-hour +// METHOD: GET +// PUBLIC: YES + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.getRiskReserveHour(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/redeemEarnElite.js b/examples/apidoc/RestClientV3/redeemEarnElite.js new file mode 100644 index 0000000..c05d39e --- /dev/null +++ b/examples/apidoc/RestClientV3/redeemEarnElite.js @@ -0,0 +1,24 @@ +import { RestClientV3 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV3 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v3/earn/elite-redeem +// METHOD: POST +// PUBLIC: NO + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.redeemEarnElite(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/subscribeEarnElite.js b/examples/apidoc/RestClientV3/subscribeEarnElite.js new file mode 100644 index 0000000..192a51d --- /dev/null +++ b/examples/apidoc/RestClientV3/subscribeEarnElite.js @@ -0,0 +1,24 @@ +import { RestClientV3 } from 'bitget-api'; +// or if you want to use the require syntax +// const { RestClientV3 } = require('bitget-api'); + + +// This example shows how to call this Bitget API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "bitget-api" for Bitget exchange +// This Bitget API SDK is available on npm via "npm install bitget-api" +// ENDPOINT: /api/v3/earn/elite-subscribe +// METHOD: POST +// PUBLIC: NO + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client.subscribeEarnElite(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/llms.txt b/llms.txt index 02c5488..502f4d9 100644 --- a/llms.txt +++ b/llms.txt @@ -95,6 +95,7 @@ src/ v3/ account.ts broker.ts + earn.ts loan.ts public.ts strategy.ts @@ -112,6 +113,8 @@ src/ v3/ account.ts broker.ts + copytrading.ts + earn.ts loan.ts public.ts strategy.ts @@ -912,6 +915,51 @@ export interface GetLiquidationRecordsRequestV2 { pageNo?: string; pageSize?: string; } +⋮---- +/** + * + * + * 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; +} ================ File: src/types/request/v2/margin.ts @@ -1421,129 +1469,51 @@ export interface GetSpotDepositRecordRequestV2 { } ================ -File: src/types/request/v3/loan.ts +File: src/types/request/v3/earn.ts ================ -export interface GetTransferedRequestV3 { - userId?: string; - coin: string; -} -⋮---- -export interface GetSymbolsRequestV3 { - productId: string; -} +/** + * + * + * Earn | On-Chain Elite (UTA) + * + * + */ ⋮---- -export interface GetRepaidHistoryRequestV3 { +export interface GetEarnEliteRecordsRequestV3 { + type: 'subscribe' | 'redeem' | 'interest'; startTime?: string; endTime?: string; limit?: string; + cursor?: string; } ⋮---- -export interface GetProductInfosRequestV3 { - productId: string; -} -⋮---- -export interface GetLoanOrderRequestV3 { - orderId?: string; - startTime?: string; - endTime?: string; -} -⋮---- -export interface GetEnsureCoinsRequestV3 { +export interface GetEarnEliteSubscribeInfoRequestV3 { productId: string; } ⋮---- -export interface BindUidRequestV3 { - riskUnitId?: string; - uid: string; - operate: 'bind' | 'unbind'; -} -⋮---- -export interface GetLTVConvertRequestV3 { - riskUnitId?: string; -} -⋮---- -/* Unified Account Staking & Lending (Crypto Loans) - /api/v3/loan/* */ -⋮---- -export interface GetLoanCoinsRequestV3 { +export interface EarnEliteSubscribeRequestV3 { + productSubId: string; + amount: string; coin?: string; + paymentAccount?: 'spot' | 'unified'; } ⋮---- -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 GetLoanBorrowHistoryRequestV3 { - orderId?: string; - loanCoin?: string; - pledgeCoin?: string; - status?: 'ROLLBACK' | 'FORCE' | 'REPAY'; - startTime: string; - endTime: string; - pageNum?: string; - pageSize?: string; -} -⋮---- -export interface LoanRepayRequestV3 { +export interface GetEarnEliteSubscribeResultRequestV3 { orderId: string; - method: 'borrowed_coin' | 'collateral'; - repayAll: 'yes' | 'no'; - amount?: string; - repayUnlock?: 'yes' | 'no'; } ⋮---- -export interface GetLoanRepayHistoryRequestV3 { - orderId?: string; - loanCoin?: string; - pledgeCoin?: string; - startTime: string; - endTime: string; - pageNum?: string; - pageSize?: string; +export interface GetEarnEliteRedeemInfoRequestV3 { + productId: string; } ⋮---- -export interface LoanRevisePledgeRequestV3 { - orderId: string; +export interface RedeemEarnEliteRequestV3 { + productId: string; + productSubId: string; + redeemType: 'fast' | 'standard'; amount: string; - pledgeCoin: string; - reviseType?: 'OUT' | 'IN'; -} -⋮---- -export interface GetLoanPledgeRateHistoryRequestV3 { - orderId?: string; - reviseSide?: 'down' | 'up'; - pledgeCoin?: string; - startTime: string; - endTime: string; - pageNum?: string; - pageSize?: string; -} -⋮---- -export interface GetLoanReducesRequestV3 { - orderId?: string; - loanCoin?: string; - pledgeCoin?: string; - status?: 'COMPLETE' | 'WAIT'; - startTime: string; - endTime: string; - pageNum?: string; - pageSize?: string; + receiveAccount: 'spot' | 'unified'; + advancedSettle?: 'yes' | 'no'; + coin?: string; } ================ @@ -2999,6 +2969,138 @@ export interface EarnLoanLiquidationRecordsV2 { runlockAmount: string; repayLoanAmount: string; } +⋮---- +/** + * + * + * Earn | On-Chain Elite + * + * + */ +⋮---- +export interface EarnEliteSubscriptionCoinV2 { + subscriptionCoin: string; + precision: string; + feeRate: string; + exchangeRate: string; + remainQuota?: string; + minAmount?: string; +} +⋮---- +export interface EarnEliteProductV2 { + productId: string; + coin: string; + minApr: string; + maxApr: string; + subscriptionCoinList: EarnEliteSubscriptionCoinV2[]; + sellOut: 'YES' | 'NO' | string; +} +⋮---- +export interface EarnEliteAssetProjectV2 { + projectName: string; +} +⋮---- +export interface EarnEliteAssetV2 { + productId: string; + productCoin: string; + holdingAmount: string; + usdtHoldingAmount: string; + exchangeRate: string; + apr: string; + minApy?: string; + maxApy?: string; + subscriptionCoin: string; + exchangeAmount: string; + projectList?: EarnEliteAssetProjectV2[]; + unsettledBGPoints: string; + interestCoin: string; + totalProfit: string; +} +⋮---- +export interface EarnEliteAssetsV2 { + resultList: EarnEliteAssetV2[]; +} +⋮---- +export interface EarnEliteRecordV2 { + recordId: string; + productId: string; + coin: string; + status: string; + exchangeRate: string; + receivedCoin: string; + receivedAmount: string; + investAmount: string; + feeRate: string; + redeemType?: string | string[]; + receivingAccount: string; + actualReceivingAccount: string; + paymentAccount?: string[]; + settlePoints: string; + fee: string; +} +⋮---- +export interface EarnEliteRecordsV2 { + recordList: EarnEliteRecordV2[]; + endId: string; +} +⋮---- +export interface EarnEliteSubscribeInfoV2 { + productSubId: string; + minAmount: string; + remainQuota: string; + exchangeRate: string; + productCoin: string; + interestTime: string; + settleTime: string; + precision: string; + feeRate: string; + /** Present for BGUSD per API docs. */ + subscriptionCoinList?: EarnEliteSubscriptionCoinV2[]; +} +⋮---- +/** Present for BGUSD per API docs. */ +⋮---- +export interface EarnEliteSubscribeResultV2 { + orderId: string; +} +⋮---- +export interface EarnEliteSubscribeStatusV2 { + result: 'settled' | 'pending' | 'rejected' | string; +} +⋮---- +export interface EarnEliteRedeemInfoBgusdReceiveCoinV2 { + bgusdReceiveCoin: string; + bgusdExchangeRate: string; +} +⋮---- +export interface EarnEliteRedeemModeV2 { + redeemFeeRate: string; + remainQuota: string; + redeemType: 'fast' | 'standard' | string; + redeemScale: string; + redeemDelayDate: string; + minRedeemAmount: string; + redeemTime: string; +} +⋮---- +export interface EarnEliteRedeemInfoV2 { + productId: string; + productSubId: string; + productCoin: string; + subscriptionCoin: string; + profitCoin: string; + exchangeRate: string; + totalUnPayInterestAmount: string; + preSettleApr: string; + receivedCoin: string; + unsettledPoints: string; + bgusdReceiveCoinList: EarnEliteRedeemInfoBgusdReceiveCoinV2[]; + redeemModeList: EarnEliteRedeemModeV2[]; +} +⋮---- +export interface RedeemEarnEliteResultV2 { + orderId: string; +} ================ File: src/types/response/v2/margin.ts @@ -3355,6 +3457,8 @@ export interface SpotSymbolInfoV2 { sellLimitPriceRatio: string; orderQuantity: string; areaSymbol: string; + maxLimitOrderValue?: string; + maxMarketOrderValue?: string; } ⋮---- export interface SpotVipFeeRateV2 { @@ -3734,39 +3838,212 @@ export interface SpotDepositRecordV2 { } ================ -File: src/types/response/v3/strategy.ts +File: src/types/response/v3/copytrading.ts ================ -export interface PlaceStrategyOrderResponseV3 { - orderId: string; - clientOid: string; +/** + * + * + * Copy Trading | Futures (UTA) + * + * + */ +⋮---- +export interface CopyFuturesMarginDetailV3 { + marginCoin: string; + maxLongCount: string; + remainingLongCount: string; + maxShortCount: string; + remainingShortCount: string; } ⋮---- -export interface ModifyStrategyOrderResponseV3 { - orderId: string; - clientOid: string; +export interface CopyFuturesTradingPairV3 { + symbol: string; + leverage: string; + marginDetails: CopyFuturesMarginDetailV3[]; } ⋮---- -export interface StrategyOrderV3 { - orderId: string; - clientOid: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +export interface CopyFuturesPositionSummaryV3 { + unrealizedPnl: string; + realizedPnl: string; + holdSize: string; + avgPrice: string; symbol: string; - qty: string; - posSide: 'long' | 'short'; - tpTriggerBy: 'market' | 'mark'; - slTriggerBy: 'market' | 'mark'; - takeProfit: string; - stopLoss: string; - tpOrderType: 'limit' | 'market'; - slOrderType: 'limit' | 'market'; - tpLimitPrice: string; - slLimitPrice: string; - createdTime: string; - updatedTime: string; + leverage: string; + marginMode: string; + liqPrice: string; + margin: string; + holdSide: string; + roi: string; + markPrice: string; + positionValue: string; } ================ -File: src/types/websockets/ws-api-request.ts +File: src/types/response/v3/earn.ts +================ +/** + * + * + * Earn | On-Chain Elite (UTA) + * + * + */ +⋮---- +export interface EarnEliteSubscriptionCoinV3 { + subscriptionCoin: string; + precision: string; + feeRate: string; + exchangeRate: string; + remainQuota?: string; + minAmount?: string; +} +⋮---- +export interface EarnEliteProductV3 { + productId: string; + coin: string; + minApr: string; + maxApr: string; + subscriptionCoinList: EarnEliteSubscriptionCoinV3[]; + sellOut: 'YES' | 'NO' | string; +} +⋮---- +export interface EarnEliteAssetProjectV3 { + projectName: string; +} +⋮---- +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 EarnEliteAssetsV3 { + resultList: EarnEliteAssetV3[]; +} +⋮---- +export interface EarnEliteRecordV3 { + recordId: string; + productId: string; + coin: string; + status: string; + exchangeRate: string; + receivedCoin: string; + receivedAmount: string; + investAmount: string; + feeRate: string; + redeemType?: string | string[]; + receivingAccount: string; + actualReceivingAccount: string; + paymentAccount?: string[]; + settlePoints: string; + fee: string; +} +⋮---- +export interface EarnEliteRecordsV3 { + recordList: EarnEliteRecordV3[]; + endId: 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 EarnEliteSubscribeResultV3 { + orderId: string; +} +⋮---- +export interface EarnEliteSubscribeStatusV3 { + result: 'settled' | 'pending' | 'rejected' | string; +} +⋮---- +export interface EarnEliteRedeemInfoBgusdReceiveCoinV3 { + bgusdReceiveCoin: string; + bgusdExchangeRate: string; +} +⋮---- +export interface EarnEliteRedeemModeV3 { + redeemFeeRate: string; + remainQuota: string; + redeemType: 'fast' | 'standard' | string; + redeemScale: string; + redeemDelayDate: string; + minRedeemAmount: string; + redeemTime: 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 RedeemEarnEliteResultV3 { + orderId: string; +} + +================ +File: src/types/response/v3/strategy.ts +================ +export interface PlaceStrategyOrderResponseV3 { + orderId: string; + clientOid: string; +} +⋮---- +export interface ModifyStrategyOrderResponseV3 { + orderId: string; + clientOid: string; +} +⋮---- +export interface StrategyOrderV3 { + orderId: string; + clientOid: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + qty: string; + posSide: 'long' | 'short'; + tpTriggerBy: 'market' | 'mark'; + slTriggerBy: 'market' | 'mark'; + takeProfit: string; + stopLoss: string; + tpOrderType: 'limit' | 'market'; + slOrderType: 'limit' | 'market'; + tpLimitPrice: string; + slLimitPrice: string; + createdTime: string; + updatedTime: string; +} + +================ +File: src/types/websockets/ws-api-request.ts ================ export interface WSAPIPlaceOrderRequestV3 { symbol: string; @@ -4255,332 +4532,79 @@ protected resolveEmittableEvents( async sendWSAPIRequest(): Promise ================ -File: src/websocket-client-v3.ts +File: .eslintrc.cjs +================ +// 'no-unused-vars': ['warn'], + +================ +File: .jshintrc +================ +{ + "esversion": 8, + "asi": true, + "laxbreak": true, + "predef": [ "-Promise" ] +} + +================ +File: .nvmrc +================ +v22.17.1 + +================ +File: .prettierrc +================ +{ + "tabWidth": 2, + "singleQuote": true, + "trailingComma": "all" +} + +================ +File: jest.config.ts ================ -import { - WsAPIOperationResponseMap, - WSAPIRequestBitgetV3, - WSAPIRequestFlags, - WsAPITopicRequestParamMap, - WsAPIWsKeyTopicMap, - WSOperation, - WSOperationLoginParams, - WsRequestOperationBitget, -} from './types/websockets/ws-api.js'; -import { MessageEventLike } from './types/websockets/ws-events.js'; -import { - BitgetInstTypeV3, - WsKey, - WsTopicV3, -} from './types/websockets/ws-general.js'; -import { - BaseWebsocketClient, - EmittableEvent, - MidflightWsRequestEvent, -} from './util/BaseWSClient.js'; -import { isWsPong } from './util/requestUtils.js'; -import { isWSAPIResponse } from './util/type-guards.js'; -import { SignAlgorithm, signMessage } from './util/webCryptoAPI.js'; -import { - getMaxTopicsPerSubscribeEvent, - getNormalisedTopicRequests, - getPromiseRefForWSAPIRequest, - getWsUrl, - WS_AUTH_ON_CONNECT_KEYS, - WS_KEY_MAP, - WS_LOGGER_CATEGORY, - WsTopicRequest, -} from './util/websocket-util.js'; -import { WSConnectedResult } from './util/WsStore.types.js'; -⋮---- /** - * WebSocket client dedicated to the unified account (V3) WebSockets. - * - * Your Bitget account needs to be upgraded to unified account mode, to use the account-level WebSocket topics. + * For a detailed explanation regarding each configuration property, visit: + * https://jestjs.io/docs/configuration */ -export class WebsocketClientV3 extends BaseWebsocketClient< ⋮---- -WsRequestOperationBitget // subscribe requests have an "args" parameter with an object within +import type { Config } from 'jest'; ⋮---- -/** - * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library - */ -public connectAll(): Promise[] +// All imported modules in your tests should be mocked automatically +// automock: false, ⋮---- -/** - * 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 +// Stop running tests after `n` failures +// bail: 0, +bail: false, // enable to stop test when an error occur, ⋮---- -/** This call automatically ensures the connection is active AND authenticated before resolving */ +// The directory where Jest should store its cached dependency information +// cacheDirectory: "/private/var/folders/kf/2k3sz4px6c9cbyzj1h_b192h0000gn/T/jest_dx", ⋮---- -/** - * Request subscription to one or more topics. Pass topics as either an array of strings, - * or array of objects (if the topic has parameters). - * - * Objects should be formatted as {topic: string, params: object, category: CategoryV5}. - * - * - Subscriptions are automatically routed to the correct websocket connection. - * - Authentication/connection is automatic. - * - Resubscribe after network issues is automatic. - * - * Call `unsubscribe(topics)` to remove topics - */ -public subscribe( - requests: - | (WsTopicRequest | WsTopicV3) - | (WsTopicRequest | WsTopicV3)[], - wsKey: WsKey, -): Promise +// Automatically clear mock calls, instances, contexts and results before every test ⋮---- -/** - * 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, -) +// Indicates whether the coverage information should be collected while executing the test ⋮---- -/** - * - * - * Internal methods required to integrate with the BaseWSClient - * - * - */ +// An array of glob patterns indicating a set of files for which coverage information should be collected ⋮---- -protected sendPingEvent(wsKey: WsKey): void +// The directory where Jest should output its coverage files ⋮---- -protected sendPongEvent(wsKey: WsKey): void +// An array of regexp pattern strings used to skip coverage collection +// coveragePathIgnorePatterns: [ +// "/node_modules/" +// ], ⋮---- -protected isWsPing(data: any): boolean +// Indicates which provider should be used to instrument code for coverage ⋮---- -protected isWsPong(data: any): boolean +// A list of reporter names that Jest uses when writing coverage reports +// coverageReporters: [ +// "json", +// "text", +// "lcov", +// "clover" +// ], ⋮---- -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 -⋮---- -/** - * @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>[]> -⋮---- -// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values -⋮---- -/** - { - "op":"subscribe", - "args":[ - { - "instType":"spot", - "topic":"ticker", - "symbol":"BTCUSDT" - }, - { - "instType":"spot", - "topic":"candle5m", - "symbol":"BTCUSDT" - } - ] - } - */ -⋮---- -// const request = { -// topic: 'ticker', -// payload: { instType: 'spot', symbol: 'BTCUSDT' }, -// }; -// becomes: -// const request = { -// topic: 'ticker', -// instType: 'spot', -// symbol: 'BTCUSDT', -// }; -⋮---- -private async getWsAuthSignature( - wsKey: WsKey, -): Promise< -⋮---- -private async signMessage( - paramsStr: string, - secret: string, - method: 'hex' | 'base64', - algorithm: SignAlgorithm, -): Promise -⋮---- -protected async getWsAuthRequestEvent( - wsKey: WsKey, -): Promise> -⋮---- -/** - * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) - */ -protected resolveEmittableEvents( - wsKey: WsKey, - event: MessageEventLike, -): EmittableEvent[] -⋮---- -/** - * 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. Proactively close to trigger reconnect. -⋮---- -// 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'); -⋮---- -// 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: .eslintrc.cjs -================ -// 'no-unused-vars': ['warn'], - -================ -File: .jshintrc -================ -{ - "esversion": 8, - "asi": true, - "laxbreak": true, - "predef": [ "-Promise" ] -} - -================ -File: .nvmrc -================ -v22.17.1 - -================ -File: .prettierrc -================ -{ - "tabWidth": 2, - "singleQuote": true, - "trailingComma": "all" -} - -================ -File: jest.config.ts -================ -/** - * For a detailed explanation regarding each configuration property, visit: - * https://jestjs.io/docs/configuration - */ -⋮---- -import type { Config } from 'jest'; -⋮---- -// All imported modules in your tests should be mocked automatically -// automock: false, -⋮---- -// Stop running tests after `n` failures -// bail: 0, -bail: false, // enable to stop test when an error occur, -⋮---- -// The directory where Jest should store its cached dependency information -// cacheDirectory: "/private/var/folders/kf/2k3sz4px6c9cbyzj1h_b192h0000gn/T/jest_dx", -⋮---- -// Automatically clear mock calls, instances, contexts and results before every test -⋮---- -// Indicates whether the coverage information should be collected while executing the test -⋮---- -// An array of glob patterns indicating a set of files for which coverage information should be collected -⋮---- -// The directory where Jest should output its coverage files -⋮---- -// An array of regexp pattern strings used to skip coverage collection -// coveragePathIgnorePatterns: [ -// "/node_modules/" -// ], -⋮---- -// Indicates which provider should be used to instrument code for coverage -⋮---- -// A list of reporter names that Jest uses when writing coverage reports -// coverageReporters: [ -// "json", -// "text", -// "lcov", -// "clover" -// ], -⋮---- -// An object that configures minimum threshold enforcement for coverage results -// coverageThreshold: undefined, +// An object that configures minimum threshold enforcement for coverage results +// coverageThreshold: undefined, ⋮---- // A path to a custom dependency extractor // dependencyExtractor: undefined, @@ -4784,6 +4808,42 @@ File: tsconfig.esm.json "include": ["src/**/*.*"] } +================ +File: tsconfig.json +================ +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "baseUrl": ".", + "noEmitOnError": true, + "declaration": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": false, + "inlineSourceMap": false, + "lib": ["esnext", "DOM"], + "listEmittedFiles": false, + "listFiles": false, + "moduleResolution": "node", + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noUnusedParameters": true, + "pretty": true, + "removeComments": false, + "resolveJsonModule": true, + "skipLibCheck": false, + "sourceMap": true, + "strict": true, + "strictNullChecks": true, + "types": ["node", "jest"], + "module": "commonjs", + "outDir": "dist/cjs", + "target": "esnext" + }, + "compileOnSave": true, + "exclude": ["node_modules", "dist"], + "include": ["src/**/*.*", "test/**/*.*", ".eslintrc.cjs"] +} + ================ File: tsconfig.linting.json ================ @@ -5096,127 +5156,129 @@ export interface GetBrokerSubApiKeyRequestV3 { } ================ -File: src/types/request/v3/public.ts +File: src/types/request/v3/loan.ts ================ -export interface GetPublicFillsRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; - limit?: string; +export interface GetTransferedRequestV3 { + userId?: string; + coin: 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'; +export interface GetSymbolsRequestV3 { + productId: string; +} +⋮---- +export interface GetRepaidHistoryRequestV3 { 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'; +export interface GetProductInfosRequestV3 { + productId: string; +} +⋮---- +export interface GetLoanOrderRequestV3 { + orderId?: string; startTime?: string; endTime?: string; - type?: 'MARKET' | 'MARK' | 'INDEX'; - limit?: string; } ⋮---- -export interface GetContractsOiRequestV3 { - symbol?: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +export interface GetEnsureCoinsRequestV3 { + productId: string; } ⋮---- -export interface GetCurrentFundingRateRequestV3 { - symbol: string; +export interface BindUidRequestV3 { + riskUnitId?: string; + uid: string; + operate: 'bind' | 'unbind'; } ⋮---- -export interface GetHistoryFundingRateRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - cursor?: string; - limit?: string; +export interface GetLTVConvertRequestV3 { + riskUnitId?: string; } ⋮---- -export interface GetMarginLoansRequestV3 { - coin: string; +/* Unified Account Staking & Lending (Crypto Loans) - /api/v3/loan/* */ +⋮---- +export interface GetLoanCoinsRequestV3 { + coin?: string; } ⋮---- -export interface GetOpenInterestRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; +export interface GetLoanInterestRequestV3 { + loanCoin: string; + pledgeCoin: string; + daily: 'SEVEN' | 'THIRTY' | 'FLEXIBLE'; + pledgeAmount: string; } ⋮---- -export interface GetPositionTierRequestV3 { - category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - coin?: string; +export interface LoanBorrowRequestV3 { + loanCoin: string; + pledgeCoin: string; + daily: 'SEVEN' | 'THIRTY' | 'FLEXIBLE'; + pledgeAmount?: string; + loanAmount?: string; } ⋮---- -export interface GetRiskReserveRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; +export interface GetLoanBorrowOngoingRequestV3 { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; } ⋮---- -export interface GetInstrumentsRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; +export interface GetLoanBorrowHistoryRequestV3 { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; + status?: 'ROLLBACK' | 'FORCE' | 'REPAY'; + startTime: string; + endTime: string; + pageNum?: string; + pageSize?: string; } ⋮---- -export interface GetMarketFeeGroupRequestV3 { - category: 'SPOT' | 'FUTURES'; - group?: 'GROUP_A' | 'GROUP_B' | 'GROUP_C'; +export interface LoanRepayRequestV3 { + orderId: string; + method: 'borrowed_coin' | 'collateral'; + repayAll: 'yes' | 'no'; + amount?: string; + repayUnlock?: 'yes' | 'no'; } ⋮---- -export interface GetMarketScoreWeightsRequestV3 { - category?: 'SPOT' | 'FUTURES'; +export interface GetLoanRepayHistoryRequestV3 { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; + startTime: string; + endTime: string; + pageNum?: string; + pageSize?: string; } ⋮---- -export interface GetOrderBookRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - limit?: string; +export interface LoanRevisePledgeRequestV3 { + orderId: string; + amount: string; + pledgeCoin: string; + reviseType?: 'OUT' | 'IN'; } ⋮---- -export interface GetTickersRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; +export interface GetLoanPledgeRateHistoryRequestV3 { + orderId?: string; + reviseSide?: 'down' | 'up'; + pledgeCoin?: string; + startTime: string; + endTime: string; + pageNum?: string; + pageSize?: string; } ⋮---- -export interface GetIndexComponentsRequestV3 { - symbol: string; +export interface GetLoanReducesRequestV3 { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; + status?: 'COMPLETE' | 'WAIT'; + startTime: string; + endTime: string; + pageNum?: string; + pageSize?: string; } ================ @@ -5331,401 +5393,162 @@ export interface GetBrokerSubApiKeyResponseV3 { } ================ -File: src/types/response/v3/loan.ts +File: src/types/shared.ts ================ -export interface LoanTransfersV3 { - coin: string; - transfered: string; - userId: string; -} +import { REST_CLIENT_TYPE_ENUM } from '../util/requestUtils.js'; ⋮---- -export interface LoanSymbolSettingV3 { - symbol: string; - leverage: string; -} +export type numberInString = string; ⋮---- -export interface LoanSymbolsV3 { - productId: string; - spotSymbols: string[]; - marginLeverage: string; - usdtContractLeverage: string; - coinContractLeverage: string; - usdcContractLeverage: string; - usdtContractSymbols: LoanSymbolSettingV3[]; - coinContractSymbols: LoanSymbolSettingV3[]; - usdcContractSymbols: LoanSymbolSettingV3[]; -} +export type OrderSide = 'Buy' | 'Sell'; ⋮---- -export interface RepaidHistoryItemV3 { - repayOrderId: string; - businessType: 'normal' | 'liquidation'; - repayType: 'all' | 'part'; - repaidTime: string; - coin: string; - repayAmount: string; - repayInterest: string; -} +/** + * @deprecated use SpotKlineInterval or FuturesKlineInterval, depending on which API group you're using + */ +export type KlineInterval = + | '1min' + | '5min' + | '15min' + | '30min' + | '1h' + | '4h' + | '6h' + | '12h' + | '1M' + | '1W' + | '1week' + | '6Hutc' + | '12Hutc' + | '1Dutc' + | '3Dutc' + | '1Wutc' + | '1Mutc'; ⋮---- -export interface LoanProductInfoV3 { - productId: string; - leverage: string; - supportUsdtContract: 'YES' | 'NO'; - supportCoinContract: 'YES' | 'NO'; - supportUsdcContract: 'YES' | 'NO'; - transferLine: string; - spotBuyLine: string; - usdtContractOpenLine: string; - coinContractOpenLine: string; - usdcContractOpenLine: string; - liquidationLine: string; - stopLiquidationLine: string; -} +export type RestClientType = + (typeof REST_CLIENT_TYPE_ENUM)[keyof typeof REST_CLIENT_TYPE_ENUM]; ⋮---- -export interface LoanOrderV3 { - orderId: string; - orderProductId: string; - uid: string; - loanTime: string; - loanCoin: string; - loanAmount: string; - unpaidAmount: string; - unpaidInterest: string; - repaidAmount: string; - repaidInterest: string; - reserve: string; - status: 'not_paid_off' | 'paid_off'; -} -⋮---- -/** Tiered conversion rate item (when Tiered Discount Rate Model is enabled) */ -export interface ConvertRatioListItemV3 { - ladder: string; - convertRatio: string; -} -⋮---- -export interface CoinInfoV3 { - coin: string; - convertRatio: string; - maxConvertValue: string; - /** Tiered conversion rate (when margin mode is Tiered Discount Rate Model) */ - convertRatioList?: ConvertRatioListItemV3[]; -} -⋮---- -/** Tiered conversion rate (when margin mode is Tiered Discount Rate Model) */ -⋮---- -export interface BindUidResponseV3 { - riskUnitId: string; - uid: string; - operate: 'bind' | 'unbind'; +export interface APIResponse { + code: string; + requestTime: number; + msg: 'success' | string; + data: T; } + +================ +File: webpack/webpack.config.cjs +================ +function generateConfig(name) ⋮---- -export interface UnpaidInfoV3 { - coin: string; - unpaidQty: string; - unpaidInterest: string; -} +// Add '.ts' and '.tsx' as resolvable extensions. ⋮---- -export interface BalanceInfoV3 { - coin: string; - price: string; - amount: string; - convertedUsdtAmount: 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 LTVConvertResponseV3 { - ltv: string; - subAccountUids: string[]; - unpaidUsdtAmount: string; - usdtBalance: string; - unpaidInfo: UnpaidInfoV3[]; - balanceInfo: BalanceInfoV3[]; -} +// Code is already transpiled from TypeScript, no additional loaders needed + +================ +File: .gitignore +================ +!.gitkeep +.DS_STORE +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json +pids +*.pid +*.seed +*.pid.lock +node_modules/ +.npm +.eslintcache +.node_repl_history +*.tgz +.yarn-integrity +.env +.env.test +.cache +lib +bundleReport.html +.history/ +tiagoSpot.ts +restClientRegex.ts +localtest.sh +privaterepotracker +testfile.ts +dist +repomix.sh +coverage + +================ +File: examples/V2 - Classic/Rest/rest-trade-futures.ts +================ +import { + FuturesPlaceOrderRequestV2, + RestClientV2, + WebsocketClientV2, +} from '../../../src/index.js'; ⋮---- -/* Unified Account Staking & Lending (Crypto Loans) - /api/v3/loan/* */ +// or +// import { FuturesPlaceOrderRequestV2, RestClientV2, WebsocketClientV2 } from '../src'; ⋮---- -export interface LoanCoinInfoV3 { - coin: string; - hourRateFlexible: string; - rateFlexible: string; - hourRate7D: string; - rate7D: string; - hourRate30D: string; - rate30D: string; - minBorrowAmount: string; - maxBorrowAmount: string; - minBorrowLimit: string; - maxBorrowLimit: string; -} +// read from environmental variables ⋮---- -export interface LoanPledgeInfoV3 { - coin: string; - initRate: string; - supRate: string; - forceRate: string; - minPledgeAmount: string; - maxPledgeAmount: 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 GetLoanCoinsResponseV3 { - loanInfos: LoanCoinInfoV3[]; - pledgeInfos: LoanPledgeInfoV3[]; -} +// note the single quotes, preventing special characters such as $ from being incorrectly passed ⋮---- -export interface GetLoanInterestResponseV3 { - hourInterest: string; - loanAmount: string; -} +// apiKey: 'apiKeyHere', +// apiSecret: 'apiSecretHere', +// apiPass: 'apiPassHere', ⋮---- -export interface LoanBorrowResponseV3 { - orderId: string; -} +function logWSEvent(type: string, data: any) ⋮---- -export interface LoanBorrowOngoingItemV3 { - orderId: string; - loanCoin: string; - loanAmount: string; - interestAmount: string; - hourInterestRate: string; - pledgeCoin: string; - pledgeAmount: string; - pledgeRate: string; - supRate: string; - forceRate: string; - borrowTime: string; - expireTime: string; -} +// simple sleep function +function promiseSleep(milliseconds: number) ⋮---- -export interface LoanBorrowHistoryItemV3 { - orderId: string; - loanCoin: string; - pledgeCoin: string; - initPledgeAmount: string; - initLoanAmount: string; - hourRate: string; - daily: string; - borrowTime: string; - status: 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 + * + */ ⋮---- -export interface LoanRepayResponseV3 { - loanCoin: string; - pledgeCoin: string; - repayAmount: string; - payInterest: string; - repayLoanAmount: string; - repayUnlockAmount: string; -} +// Add event listeners to log websocket events on account ⋮---- -export interface LoanRepayHistoryItemV3 { - orderId: string; - loanCoin: string; - pledgeCoin: string; - repayAmount: string; - payInterest: string; - repayLoanAmount: string; - repayUnlockAmount: string; - repayTime: string; -} +// futures private +// : account updates ⋮---- -export interface LoanRevisePledgeResponseV3 { - loanCoin: string; - pledgeCoin: string; - afterPledgeRate: string; -} +// : position updates ⋮---- -export interface LoanPledgeRateHistoryItemV3 { - loanCoin: string; - pledgeCoin: string; - orderId: string; - reviseTime: string; - reviseSide: string; - reviseAmount: string; - afterPledgeRate: string; - beforePledgeRate: string; -} +// : order updates ⋮---- -export interface LoanDebtInfoV3 { - coin: string; - amount: string; - amountUsdt: 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 GetLoanDebtsResponseV3 { - pledgeInfos: LoanDebtInfoV3[]; - loanInfos: LoanDebtInfoV3[]; -} +// const balances = allBalances.filter((bal) => Number(bal.available) != 0); ⋮---- -export interface LoanReduceItemV3 { - orderId: string; - loanCoin: string; - pledgeCoin: string; - reduceTime: string; - pledgeRate: string; - pledgePrice: string; - status: string; - pledgeAmount: string; - reduceFee: string; - residueAmount: string; - runlockAmount: string; - repayLoanAmount: string; -} +// Loop through any active positions and send a closing market order on each position ================ -File: src/types/shared.ts +File: examples/V2 - Classic/Rest/rest-trade-spot.ts ================ -import { REST_CLIENT_TYPE_ENUM } from '../util/requestUtils.js'; +import { + RestClientV2, + SpotOrderRequestV2, + WebsocketClientV2, +} from '../../../src/index.js'; ⋮---- -export type numberInString = string; +// import { RestClientV2, WebsocketClient } from '../src/index'; ⋮---- -export type OrderSide = 'Buy' | 'Sell'; -⋮---- -/** - * @deprecated use SpotKlineInterval or FuturesKlineInterval, depending on which API group you're using - */ -export type KlineInterval = - | '1min' - | '5min' - | '15min' - | '30min' - | '1h' - | '4h' - | '6h' - | '12h' - | '1M' - | '1W' - | '1week' - | '6Hutc' - | '12Hutc' - | '1Dutc' - | '3Dutc' - | '1Wutc' - | '1Mutc'; -⋮---- -export type RestClientType = - (typeof REST_CLIENT_TYPE_ENUM)[keyof typeof REST_CLIENT_TYPE_ENUM]; -⋮---- -export interface APIResponse { - code: string; - requestTime: number; - msg: 'success' | string; - data: T; -} - -================ -File: 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: tsconfig.json -================ -{ - "compilerOptions": { - "allowSyntheticDefaultImports": true, - "baseUrl": ".", - "noEmitOnError": true, - "declaration": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": false, - "inlineSourceMap": false, - "lib": ["esnext", "DOM"], - "listEmittedFiles": false, - "listFiles": false, - "moduleResolution": "node", - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noUnusedParameters": true, - "pretty": true, - "removeComments": false, - "resolveJsonModule": true, - "skipLibCheck": false, - "sourceMap": true, - "strict": true, - "strictNullChecks": true, - "types": ["node", "jest"], - "module": "commonjs", - "outDir": "dist/cjs", - "target": "esnext" - }, - "compileOnSave": true, - "exclude": ["node_modules", "dist"], - "include": ["src/**/*.*", "test/**/*.*", ".eslintrc.cjs"] -} - -================ -File: examples/V2 - Classic/Rest/rest-trade-futures.ts -================ -import { - FuturesPlaceOrderRequestV2, - RestClientV2, - WebsocketClientV2, -} from '../../../src/index.js'; -⋮---- -// or -// 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-trade-futures.ts -⋮---- -// note the single quotes, preventing special characters such as $ from being incorrectly passed -⋮---- -// apiKey: 'apiKeyHere', -// apiSecret: 'apiSecretHere', -// apiPass: 'apiPassHere', -⋮---- -function logWSEvent(type: string, data: any) -⋮---- -// simple sleep function -function promiseSleep(milliseconds: number) -⋮---- -/** - * This is a simple script wrapped in a immediately invoked function expression (to execute the below workflow immediately). - * - * It is designed to: - * - open a private websocket channel to log account events - * - check for any available USDT balance in the 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 - * - */ -⋮---- -// Add event listeners to log websocket events on account -⋮---- -// futures private -// : account updates -⋮---- -// : position updates -⋮---- -// : order updates -⋮---- -// wait briefly for ws to be ready (could also use the response or authenticated events, to make sure topics are subscribed to before starting) -⋮---- -// const balances = allBalances.filter((bal) => Number(bal.available) != 0); -⋮---- -// Loop through any active positions and send a closing market order on each position - -================ -File: examples/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 +// 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 @@ -6387,103 +6210,309 @@ export interface GetBrokerOrderCommissionRequestV2 { export interface GetBrokerRebateInfoRequestV2 { uid: string; } - -================ -File: src/types/response/v2/broker.ts -================ +⋮---- /** * - * * Broker | Subaccount + * * Broker | Agent (affiliate) customer APIs * */ ⋮---- -export interface CreateSubaccountResponseV2 { - subUid: string; - subaccountName: string; - status: string; - permList: string[]; - label: string; - cTime: string; +export interface GetAgentCustomerCommissionsRequestV2 { + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + uid?: string; + coin?: string; + symbol?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface BrokerSubaccountV2 { - subUid: string; - subaccountName: string; - status: string; - permList: string[]; - label: string; - language: string; - cTime: string; - uTime: string; +export interface GetAgentSubCustomerListRequestV2 { + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface ModifySubaccountResponseV2 { - subUid: string; - subaccountName: string; - status: string; - permList: string[]; - label: string; - language: string; - cTime: string; - uTime: string; +export interface AgentCustomerTradeVolumeRequestV2 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface SubaccountEmailV2 { - subUid: string; - subaccountName: string; - subaccountEmail: string; - cTime: string; - uTime: string; +export interface AgentCustomerListRequestV2 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + referralCode?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface BrokerSubaccountSpotAssetV2 { - coin: string; - available: string; - frozen: string; - locked: string; - uTime: string; +export interface GetAgentCustomerKycResultRequestV2 { + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -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 AgentCustomerDepositRequestV2 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface CreateSubaccountDepositAddressV2 { - subUid: string; - coin: string; - address: string; - chain: string; - tag: string; - url: string; - cTime: string; +export interface AgentCustomerAssetRequestV2 { + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -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 GetAgentCommissionDetailRequestV2 { + startTime?: string; + endTime?: string; + limit?: string; + idLessThan?: string; +} + +================ +File: src/types/request/v3/public.ts +================ +export interface GetPublicFillsRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; + limit?: string; +} +⋮---- +export interface 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 { + symbol: string; +} +⋮---- +export interface GetHistoryFundingRateRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + cursor?: string; + limit?: string; +} +⋮---- +export interface GetMarginLoansRequestV3 { + coin: string; +} +⋮---- +export interface GetOpenInterestRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; +} +⋮---- +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?: '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; +} + +================ +File: src/types/response/v2/broker.ts +================ +/** + * + * * Broker | Subaccount + * + */ +⋮---- +export interface CreateSubaccountResponseV2 { + subUid: string; + subaccountName: string; + status: string; + permList: string[]; + label: string; + cTime: string; +} +⋮---- +export interface BrokerSubaccountV2 { + subUid: string; + subaccountName: string; + status: string; + permList: string[]; + label: string; + language: string; + cTime: string; + uTime: 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 BrokerSubaccountWithdrawalV2 { @@ -6669,1046 +6698,1195 @@ export interface BrokerRebateInfoV2 { clientSpotRebateRatio: string; clientFuturesRebateRatio: 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; - }[]; -} +/** + * + * * Broker | Agent (affiliate) customer APIs + * + */ ⋮---- -export interface CancelBatchOrdersResponseV3 { - orderId: string; - clientOid: string; - code?: string; - msg?: 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; +} ⋮---- -export interface CloseAllPositionsResponseV3 { - list: { - orderId: string; - clientOid: string; - code: string; - msg: string; - }[]; +export interface AgentCustomerCommissionsV2 { + endId: string; + commissionList: AgentCustomerCommissionItemV2[]; } ⋮---- -export interface CancelOrderResponseV3 { - orderId: string; - clientOid: string; +export interface AgentSubCustomerItemV2 { + uid: string; + registerTime: string; } ⋮---- -export interface GetMaxOpenAvailableResponseV3 { - available: string; - maxOpen: string; - buyOpenCost: string; - sellOpenCost: string; - maxBuyOpen: string; - maxSellOpen: string; +export interface AgentSubCustomerListV2 { + list: AgentSubCustomerItemV2[]; + minId: string; } ⋮---- -export interface FeeDetailV3 { - feeCoin: string; - fee: string; +export interface AgentCustomerTradeVolumeItemV2 { + uid: string; + /** API field name (Bitget spelling). */ + volumn: string; + spotVolume: string; + futuresVolume: string; + time: 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; - orderStatus: string; - posSide: string; - holdMode: string; - reduceOnly: string; - feeDetail: FeeDetailV3[]; - cancelReason: string; - execType: string; - stpMode?: string; - createdTime: string; - updatedTime: string; +/** API field name (Bitget spelling). */ +⋮---- +export interface AgentCustomerListItemV2 { + uid: string; + registerTime: string; } ⋮---- -export interface FillV3 { - execId: string; - orderId: string; - category: string; - 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 AgentCustomerKycItemV2 { + uid: string; + kycResult: 'passed' | 'not_passed' | 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 AgentCustomerKycResultV2 { + userList: AgentCustomerKycItemV2[]; + endId: string; } ⋮---- -export interface HistoryOrderV3 { +export interface AgentCustomerDepositItemV2 { 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; + uid: string; + depositTime: string; + depositCoin: string; + depositAmount: string; } ⋮---- -export interface PositionHistoryV3 { - positionId: string; - category: string; +export interface AgentCustomerAssetItemV2 { + balance: string; + uid: string; + uTime: string; + remark: string; +} +⋮---- +export interface AgentCommissionDetailItemV2 { + uid: string; + bizType: 'spot' | 'futures' | string; + subBizType: string; symbol: string; - marginCoin: string; - holdMode: string; - posSide: string; - marginMode: string; - openPriceAvg: string; - closePriceAvg: string; - openTotalPos: string; - closeTotalPos: string; - cumRealisedPnl: string; - netProfit: string; - totalFunding: string; - openFeeTotal: string; - closeFeeTotal: string; - createdTime: string; - updatedTime: string; + 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 CurrentPositionV3 { - category: string; +export interface AgentCommissionDetailV2 { + endId: string; + commissionList: AgentCommissionDetailItemV2[]; +} + +================ +File: src/types/response/v3/loan.ts +================ +export interface LoanTransfersV3 { + coin: string; + transfered: string; + userId: string; +} +⋮---- +export interface LoanSymbolSettingV3 { 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; - createdTime: string; - updatedTime: string; } ⋮---- -export interface ModifyOrderResponseV3 { - orderId: string; - clientOid: string; +export interface LoanSymbolsV3 { + productId: string; + spotSymbols: string[]; + marginLeverage: string; + usdtContractLeverage: string; + coinContractLeverage: string; + usdcContractLeverage: string; + usdtContractSymbols: LoanSymbolSettingV3[]; + coinContractSymbols: LoanSymbolSettingV3[]; + usdcContractSymbols: LoanSymbolSettingV3[]; } ⋮---- -export interface PlaceBatchOrdersResponseV3 { - orderId: string; - clientOid: string; - code?: string; - msg?: string; +export interface RepaidHistoryItemV3 { + repayOrderId: string; + businessType: 'normal' | 'liquidation'; + repayType: 'all' | 'part'; + repaidTime: string; + coin: string; + repayAmount: string; + repayInterest: string; } ⋮---- -export interface PlaceOrderResponseV3 { - orderId: string; - clientOid: string; +export interface LoanProductInfoV3 { + productId: string; + leverage: string; + supportUsdtContract: 'YES' | 'NO'; + supportCoinContract: 'YES' | 'NO'; + supportUsdcContract: 'YES' | 'NO'; + transferLine: string; + spotBuyLine: string; + usdtContractOpenLine: string; + coinContractOpenLine: string; + usdcContractOpenLine: string; + liquidationLine: string; + stopLiquidationLine: string; } ⋮---- -export interface PositionAdlRankV3 { - symbol: string; - marginCoin: string; - adlRank: string; - holdSide: 'long' | 'short'; +export interface LoanOrderV3 { + orderId: string; + orderProductId: string; + uid: string; + loanTime: string; + loanCoin: string; + loanAmount: string; + unpaidAmount: string; + unpaidInterest: string; + repaidAmount: string; + repaidInterest: string; + reserve: string; + status: 'not_paid_off' | 'paid_off'; } - -================ -File: src/index.ts -================ - - -================ -File: src/websocket-api-client.ts -================ -import { CancelOrderRequestV3 } from './types/request/v3/trade.js'; -import { CancelOrderResponseV3 } from './types/response/v3/trade.js'; -import { WSAPIResponse } from './types/websockets/ws-api.js'; -import { WSAPIPlaceOrderRequestV3 } from './types/websockets/ws-api-request.js'; -import { WSAPIPlaceOrderResponseV3 } from './types/websockets/ws-api-response.js'; -import { - BitgetInstTypeV3, - WSClientConfigurableOptions, -} from './types/websockets/ws-general.js'; -import { DefaultLogger } from './util/logger.js'; -import { WS_KEY_MAP } from './util/websocket-util.js'; -import { WebsocketClientV3 } from './websocket-client-v3.js'; ⋮---- -/** - * 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; +/** Tiered conversion rate item (when Tiered Discount Rate Model is enabled) */ +export interface ConvertRatioListItemV3 { + ladder: string; + convertRatio: string; } ⋮---- -/** - * Default: true - * - * Attach default event listeners, which will console log any high level - * events (opened/reconnecting/reconnected/etc). - * - * If you disable this, you should set your own event listeners - * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. - */ +export interface CoinInfoV3 { + coin: string; + convertRatio: string; + maxConvertValue: string; + /** Tiered conversion rate (when margin mode is Tiered Discount Rate Model) */ + convertRatioList?: ConvertRatioListItemV3[]; +} ⋮---- -/** - * 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 +/** Tiered conversion rate (when margin mode is Tiered Discount Rate Model) */ ⋮---- -constructor( - options?: WSClientConfigurableOptions & - Partial, - logger?: DefaultLogger, -) +export interface BindUidResponseV3 { + riskUnitId: string; + uid: string; + operate: 'bind' | 'unbind'; +} ⋮---- -public getWSClient(): WebsocketClientV3 +export interface UnpaidInfoV3 { + coin: string; + unpaidQty: string; + unpaidInterest: string; +} ⋮---- -public setTimeOffsetMs(newOffset: number): void +export interface BalanceInfoV3 { + coin: string; + price: string; + amount: string; + convertedUsdtAmount: string; +} ⋮---- -/* - * Bitget WebSocket API Methods - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - */ +export interface LTVConvertResponseV3 { + ltv: string; + subAccountUids: string[]; + unpaidUsdtAmount: string; + usdtBalance: string; + unpaidInfo: UnpaidInfoV3[]; + balanceInfo: BalanceInfoV3[]; +} ⋮---- -/** - * Submit a new order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - * - * @returns - */ -submitNewOrder( - category: BitgetInstTypeV3, - params: WSAPIPlaceOrderRequestV3, -): Promise> +/* Unified Account Staking & Lending (Crypto Loans) - /api/v3/loan/* */ ⋮---- -/** - * Submit a new order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel - * - * @returns - */ -placeBatchOrders( - category: BitgetInstTypeV3, - params: WSAPIPlaceOrderRequestV3[], -): Promise> +export interface LoanCoinInfoV3 { + coin: string; + hourRateFlexible: string; + rateFlexible: string; + hourRate7D: string; + rate7D: string; + hourRate30D: string; + rate30D: string; + minBorrowAmount: string; + maxBorrowAmount: string; + minBorrowLimit: string; + maxBorrowLimit: string; +} ⋮---- -/* - * Bitget WebSocket API Methods - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - */ +export interface LoanPledgeInfoV3 { + coin: string; + initRate: string; + supRate: string; + forceRate: string; + minPledgeAmount: string; + maxPledgeAmount: string; +} ⋮---- -/** - * Cancel Order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel - * - * @returns - */ -cancelOrder( - category: BitgetInstTypeV3, - params: CancelOrderRequestV3, -): Promise> +export interface GetLoanCoinsResponseV3 { + loanInfos: LoanCoinInfoV3[]; + pledgeInfos: LoanPledgeInfoV3[]; +} ⋮---- -/** - * 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 GetLoanInterestResponseV3 { + hourInterest: string; + loanAmount: string; +} ⋮---- -/** - * - * - * - * - * - * - * - * Private methods for handling some of the convenience/automation provided by the WS API Client - * - * - * - * - * - * - * - */ +export interface LoanBorrowResponseV3 { + orderId: string; +} ⋮---- -private setupDefaultEventListeners() +export interface LoanBorrowOngoingItemV3 { + orderId: string; + loanCoin: string; + loanAmount: string; + interestAmount: string; + hourInterestRate: string; + pledgeCoin: string; + pledgeAmount: string; + pledgeRate: string; + supRate: string; + forceRate: string; + borrowTime: string; + expireTime: string; +} ⋮---- -/** - * General event handlers for monitoring the WebsocketClient - */ +export interface LoanBorrowHistoryItemV3 { + orderId: string; + loanCoin: string; + pledgeCoin: string; + initPledgeAmount: string; + initLoanAmount: string; + hourRate: string; + daily: string; + borrowTime: string; + status: string; +} ⋮---- -// Blind JSON.stringify can fail on circular references +export interface LoanRepayResponseV3 { + loanCoin: string; + pledgeCoin: string; + repayAmount: string; + payInterest: string; + repayLoanAmount: string; + repayUnlockAmount: string; +} ⋮---- -// JSON.stringify({ ...data, target: 'WebSocket' }), - -================ -File: .gitignore -================ -!.gitkeep -.DS_STORE -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json -pids -*.pid -*.seed -*.pid.lock -node_modules/ -.npm -.eslintcache -.node_repl_history -*.tgz -.yarn-integrity -.env -.env.test -.cache -lib -bundleReport.html -.history/ -tiagoSpot.ts -restClientRegex.ts -localtest.sh -privaterepotracker -testfile.ts -dist -repomix.sh -coverage - -================ -File: examples/V3 - UTA/WS-API/ws-api-client-trade.ts -================ -import { DefaultLogger, WebsocketAPIClient } from '../../../src/index.js'; +export interface LoanRepayHistoryItemV3 { + orderId: string; + loanCoin: string; + pledgeCoin: string; + repayAmount: string; + payInterest: string; + repayLoanAmount: string; + repayUnlockAmount: string; + repayTime: string; +} ⋮---- -// or -// import { DefaultLogger, WS_KEY_MAP, WebsocketAPIClient } from 'bitget-api'; +export interface LoanRevisePledgeResponseV3 { + loanCoin: string; + pledgeCoin: string; + afterPledgeRate: string; +} ⋮---- -// function attachEventHandlers( -// wsClient: TWSClient, -// ): void { -// wsClient.on('update', (data) => { -// console.log('raw message received ', JSON.stringify(data)); -// }); -// wsClient.on('open', (data) => { -// console.log('ws connected', data.wsKey); -// }); -// wsClient.on('reconnect', ({ wsKey }) => { -// console.log('ws automatically reconnecting.... ', wsKey); -// }); -// wsClient.on('reconnected', (data) => { -// console.log('ws has reconnected ', data?.wsKey); -// }); -// wsClient.on('authenticated', (data) => { -// console.log('ws has authenticated ', data?.wsKey); -// }); -// } +export interface LoanPledgeRateHistoryItemV3 { + loanCoin: string; + pledgeCoin: string; + orderId: string; + reviseTime: string; + reviseSide: string; + reviseAmount: string; + afterPledgeRate: string; + beforePledgeRate: 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 LoanDebtInfoV3 { + coin: string; + amount: string; + amountUsdt: string; +} ⋮---- -// Whether to use the demo trading wss connection -// demoTrading: true, +export interface GetLoanDebtsResponseV3 { + pledgeInfos: LoanDebtInfoV3[]; + loanInfos: LoanDebtInfoV3[]; +} ⋮---- -// If you want your own event handlers instead of the default ones with logs, -// disable this setting and see the `attachEventHandlers` example below: -// attachEventListeners: false +export interface LoanReduceItemV3 { + orderId: string; + loanCoin: string; + pledgeCoin: string; + reduceTime: string; + pledgeRate: string; + pledgePrice: string; + status: string; + pledgeAmount: string; + reduceFee: string; + residueAmount: string; + runlockAmount: string; + repayLoanAmount: string; +} + +================ +File: src/types/response/v3/trade.ts +================ +export interface BatchModifyOrderResponseV3 { + orderId: string; + clientOid: string; +} ⋮---- -logger, // Optional: inject a custom logger +export interface CancelAllOrdersResponseV3 { + list: { + orderId: string; + clientOid: string; + code: string; + msg: string; + }[]; +} ⋮---- -// Optional, see above "attachEventListeners". Attach basic event handlers, so nothing is left unhandled -// attachEventHandlers(wsClient.getWSClient()); +export interface CancelBatchOrdersResponseV3 { + orderId: string; + clientOid: string; + code?: string; + msg?: 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 CloseAllPositionsResponseV3 { + list: { + orderId: string; + clientOid: string; + code: string; + msg: 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 CancelOrderResponseV3 { + orderId: string; + clientOid: string; +} ⋮---- -/** - * Place Order - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters - */ +export interface GetMaxOpenAvailableResponseV3 { + available: string; + maxOpen: string; + buyOpenCost: string; + sellOpenCost: string; + maxBuyOpen: string; + maxSellOpen: 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 FeeDetailV3 { + feeCoin: string; + fee: string; +} ⋮---- -/** - * Batch Place Order Channel - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel - */ +export interface OrderInfoV3 { + orderId: string; + clientOid: string; + category: string; + symbol: string; + orderType: string; + side: string; + price: string; + qty: string; + amount: string; + cumExecQty: string; + cumExecValue: string; + avgPrice: string; + timeInForce: string; + orderStatus: string; + posSide: string; + holdMode: string; + reduceOnly: string; + feeDetail: FeeDetailV3[]; + cancelReason: string; + execType: string; + stpMode?: string; + createdTime: string; + updatedTime: 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 FillV3 { + execId: string; + orderId: string; + category: string; + symbol: string; + orderType: string; + side: string; + execPrice: string; + execQty: string; + execValue: string; + tradeScope: string; + feeDetail: FeeDetailV3[]; + execPnl?: string; + tradeSide?: string; + createdTime: string; + updatedTime: 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" - } - */ -⋮---- -/** - * Cancel Order - * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel - */ -⋮---- -/** - const res = { - "event": "trade", - "id": "1750034870205", - "topic": "cancel-order", - "args": [ - { - "orderId": "xxxxxxxx", - "clientOid": "xxxxxxxx" - } - ], - "code": "0", - "msg": "Success", - "ts": "1750034870597" - } - */ -⋮---- -/** - * Batch Cancel Order - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel - */ -⋮---- -/** - 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/futures.ts -================ -import { FuturesPlanTypeV2, FuturesProductTypeV2 } from '../shared.js'; -⋮---- -export type FuturesKlineInterval = - | '1m' - | '3m' - | '5m' - | '15m' - | '30m' - | '1H' - | '2H' - | '4H' - | '6H' - | '12H' - | '1D' - | '3D' - | '1W' - | '1M' - | '6Hutc' - | '12Hutc' - | '1Dutc' - | '3Dutc' - | '1Wutc' - | '1Mutc'; -⋮---- -export type FuturesKlineTypeV2 = 'MARKET' | 'MARK' | 'INDEX'; -⋮---- -export interface FuturesAccountBillRequestV2 { - productType: FuturesProductTypeV2; - symbol?: string; - coin?: string; - businessType?: string; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; -} -⋮---- -/** - * - * * Futures | Market - * - */ -⋮---- -export interface FuturesMergeDepthRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - precision?: 'scale0' | 'scale1' | 'scale2' | 'scale3'; - limit?: '1' | '5' | '15' | '50' | 'max'; -} -⋮---- -export interface FuturesRecentTradesRequestV2 { +export interface UnfilledOrderV3 { + orderId: string; + clientOid: string; + category: string; symbol: string; - productType: FuturesProductTypeV2; - limit?: 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 FuturesHistoricTradesRequestV2 { +export interface HistoryOrderV3 { + orderId: string; + clientOid: string; + category: string; symbol: string; - productType: FuturesProductTypeV2; - limit?: string; - idLessThan?: string; - startTime?: string; - endTime?: 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 FuturesCandlesRequestV2 { +export interface PositionHistoryV3 { + positionId: string; + category: string; symbol: string; - productType: FuturesProductTypeV2; - granularity: FuturesKlineInterval; - startTime?: string; - endTime?: string; - kLineType?: FuturesKlineTypeV2; - limit?: string; + marginCoin: string; + holdMode: string; + posSide: string; + marginMode: string; + openPriceAvg: string; + closePriceAvg: string; + openTotalPos: string; + closeTotalPos: string; + cumRealisedPnl: string; + netProfit: string; + totalFunding: string; + openFeeTotal: string; + closeFeeTotal: string; + createdTime: string; + updatedTime: string; } ⋮---- -/** - * - * * Futures | Account - * - */ -⋮---- -export interface FuturesSingleAccountRequestV2 { +export interface CurrentPositionV3 { + category: string; symbol: string; - productType: FuturesProductTypeV2; marginCoin: string; + holdMode: string; + posSide: string; + marginMode: string; + positionBalance: string; + available: string; + frozen: string; + total: string; + leverage: string; + curRealisedPnl: string; + avgPrice: string; + positionStatus: string; + unrealisedPnl: string; + liquidationPrice: string; + mmr: string; + profitRate: string; + markPrice: string; + breakEvenPrice: string; + totalFunding: string; + openFeeTotal: string; + closeFeeTotal: string; + createdTime: string; + updatedTime: string; } ⋮---- -export interface FuturesInterestHistoryRequestV2 { - productType: 'USDT-FUTURES' | 'SUSDT-FUTURES'; - coin?: string; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; +export interface ModifyOrderResponseV3 { + orderId: string; + clientOid: string; } ⋮---- -export interface FuturesOpenCountRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - openAmount: string; - openPrice: string; - leverage?: string; +export interface PlaceBatchOrdersResponseV3 { + orderId: string; + clientOid: string; + code?: string; + msg?: string; } ⋮---- -export interface FuturesSetAutoMarginRequestV2 { - symbol: string; - autoMargin: 'on' | 'off'; - marginCoin: string; - amount: string; - holdSide?: 'long' | 'short'; +export interface PlaceOrderResponseV3 { + orderId: string; + clientOid: string; } ⋮---- -export interface FuturesSetLeverageRequestV2 { +export interface PositionAdlRankV3 { symbol: string; - productType: FuturesProductTypeV2; marginCoin: string; - leverage: string; - holdSide?: 'long' | 'short'; + adlRank: string; + holdSide: 'long' | 'short'; } + +================ +File: src/index.ts +================ + + +================ +File: src/websocket-api-client.ts +================ +import { CancelOrderRequestV3 } from './types/request/v3/trade.js'; +import { CancelOrderResponseV3 } from './types/response/v3/trade.js'; +import { WSAPIResponse } from './types/websockets/ws-api.js'; +import { WSAPIPlaceOrderRequestV3 } from './types/websockets/ws-api-request.js'; +import { WSAPIPlaceOrderResponseV3 } from './types/websockets/ws-api-response.js'; +import { + BitgetInstTypeV3, + WSClientConfigurableOptions, +} from './types/websockets/ws-general.js'; +import { DefaultLogger } from './util/logger.js'; +import { WS_KEY_MAP } from './util/websocket-util.js'; +import { WebsocketClientV3 } from './websocket-client-v3.js'; ⋮---- -export interface FuturesSetPositionMarginRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - holdSide: 'long' | 'short'; - amount: string; +/** + * Configurable options specific to only the REST-like WebsocketAPIClient + */ +export interface WSAPIClientConfigurableOptions { + /** + * Default: true + * + * Attach default event listeners, which will console log any high level + * events (opened/reconnecting/reconnected/etc). + * + * If you disable this, you should set your own event listeners + * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. + */ + attachEventListeners: boolean; } ⋮---- -export interface FuturesSetMarginModeRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - marginMode: 'isolated' | 'crossed'; -} +/** + * 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. * - * * Futures | Position + * Note: You can also directly use the sendWSAPIRequest() method to make WS API calls, but some + * may find the below methods slightly more intuitive. * + * Refer to the WS API promises example for a more detailed example on using sendWSAPIRequest() directly: + * https://github.com/tiagosiebler/bitget-api/blob/master/examples/V3/ws-api-trade-raw.ts */ +export class WebsocketAPIClient ⋮---- -export interface FuturesHistoricalPositionsRequestV2 { - symbol?: string; - productType?: FuturesProductTypeV2; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; -} +constructor( + options?: WSClientConfigurableOptions & + Partial, + logger?: DefaultLogger, +) ⋮---- -/** - * - * * Futures | Trade - * - */ +public getWSClient(): WebsocketClientV3 ⋮---- -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'; -} +public setTimeOffsetMs(newOffset: number): void ⋮---- -export interface FuturesReversalOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - size: string; - side?: 'buy' | 'sell'; - tradeSide?: 'open' | 'close'; - clientOid?: string; -} +/* + * Bitget WebSocket API Methods + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel + */ ⋮---- -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'; -} +/** + * Submit a new order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel + * + * @returns + */ +submitNewOrder( + category: BitgetInstTypeV3, + params: WSAPIPlaceOrderRequestV3, +): Promise> ⋮---- -export interface FuturesBatchOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - marginMode: 'isolated' | 'crossed'; - orderList: FuturesBatchOrderItem[]; -} +/** + * Submit a new order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel + * + * @returns + */ +placeBatchOrders( + category: BitgetInstTypeV3, + params: WSAPIPlaceOrderRequestV3[], +): Promise> ⋮---- -export interface FuturesModifyOrderRequestV2 { - orderId?: string; - clientOid?: string; - symbol: string; - productType: FuturesProductTypeV2; - newClientOid: string; - newSize?: string; - newPrice?: string; - newPresetStopSurplusPrice?: string; - newPresetStopLossPrice?: string; -} +/* + * Bitget WebSocket API Methods + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel + */ ⋮---- -export interface FuturesCancelOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin?: string; - orderId?: string; - clientOid?: string; -} +/** + * Cancel Order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel + * + * @returns + */ +cancelOrder( + category: BitgetInstTypeV3, + params: CancelOrderRequestV3, +): Promise> ⋮---- -interface FuturesBatchCancelOrderItem { - orderId?: string; - clientOid?: string; -} +/** + * 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 FuturesBatchCancelOrderRequestV2 { - orderIdList?: FuturesBatchCancelOrderItem[]; - symbol?: string; - productType: FuturesProductTypeV2; - marginCoin?: string; -} +/** + * + * + * + * + * + * + * + * Private methods for handling some of the convenience/automation provided by the WS API Client + * + * + * + * + * + * + * + */ ⋮---- -export interface FuturesFlashClosePositionsRequestV2 { - symbol?: string; - productType: FuturesProductTypeV2; - holdSide?: 'long' | 'short'; -} +private setupDefaultEventListeners() ⋮---- -export interface FuturesGetOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - orderId?: string; - clientOid?: string; -} +/** + * General event handlers for monitoring the WebsocketClient + */ ⋮---- -export interface FuturesGetOrderFillsRequestV2 { - orderId?: string; - symbol?: string; - productType: FuturesProductTypeV2; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; -} +// Blind JSON.stringify can fail on circular references ⋮---- -export interface FuturesGetHistoricalFillsRequestV2 { - orderId?: string; - symbol?: string; - productType: FuturesProductTypeV2; - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: 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 { isWsPong } from './util/requestUtils.js'; +import { isWSAPIResponse } from './util/type-guards.js'; +import { SignAlgorithm, signMessage } from './util/webCryptoAPI.js'; +import { + getMaxTopicsPerSubscribeEvent, + getNormalisedTopicRequests, + getPromiseRefForWSAPIRequest, + getWsUrl, + WS_AUTH_ON_CONNECT_KEYS, + WS_KEY_MAP, + WS_LOGGER_CATEGORY, + WsTopicRequest, +} from './util/websocket-util.js'; +import { WSConnectedResult } from './util/WsStore.types.js'; ⋮---- -export interface FuturesGetOpenOrdersRequestV2 { - orderId?: string; - clientOid?: string; - symbol?: string; - productType: FuturesProductTypeV2; - status?: 'live' | 'partially_filled'; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; -} +/** + * WebSocket client dedicated to the unified account (V3) WebSockets. + * + * Your Bitget account needs to be upgraded to unified account mode, to use the account-level WebSocket topics. + */ +export class WebsocketClientV3 extends BaseWebsocketClient< ⋮---- -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'; +WsRequestOperationBitget // subscribe requests have an "args" parameter with an object within ⋮---- -export interface FuturesGetHistoryOrdersRequestV2 { - orderId?: string; - clientOid?: string; - symbol?: string; - productType: FuturesProductTypeV2; - idLessThan?: string; - orderSource?: FuturesOrderSourceV2; - startTime?: string; - endTime?: string; - limit?: string; -} +/** + * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library + */ +public connectAll(): Promise[] ⋮---- -export interface FuturesCancelAllOrdersRequestV2 { - symbol?: string; - productType: FuturesProductTypeV2; - marginCoin?: string; - requestTime?: string; - receiveWindow?: string; -} +/** + * Ensures the WS API connection is active and ready. + * + * You do not need to call this, but if you call this before making any WS API requests, + * it can accelerate the first request (by preparing the connection in advance). + */ +public connectWSAPI(): Promise +⋮---- +/** This call automatically ensures the connection is active AND authenticated before resolving */ ⋮---- /** - * - * * Futures | Trigger Orders - * - */ + * Request subscription to one or more topics. Pass topics as either an array of strings, + * or array of objects (if the topic has parameters). + * + * Objects should be formatted as {topic: string, params: object, category: CategoryV5}. + * + * - Subscriptions are automatically routed to the correct websocket connection. + * - Authentication/connection is automatic. + * - Resubscribe after network issues is automatic. + * + * Call `unsubscribe(topics)` to remove topics + */ +public subscribe( + requests: + | (WsTopicRequest | WsTopicV3) + | (WsTopicRequest | WsTopicV3)[], + wsKey: WsKey, +): Promise ⋮---- -export type FuturesTriggerTypeV2 = 'fill_price' | 'mark_price'; +/** + * 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 type FuturesStpModeV2 = - | 'none' - | 'cancel_taker' - | 'cancel_maker' - | 'cancel_both'; +/** + * + * + * Internal methods required to integrate with the BaseWSClient + * + * + */ ⋮---- -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; -} +protected sendPingEvent(wsKey: WsKey): void ⋮---- -export type FuturesTriggerPriceTypeV2 = - | 'fill_price' - | 'mark_price' - | 'index_price'; +protected sendPongEvent(wsKey: WsKey): void ⋮---- -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; -} +protected isWsPing(data: any): boolean ⋮---- -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; -} +protected isWsPong(data: any): boolean ⋮---- -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; -} +protected isPrivateTopicRequest( + _request: WsTopicRequest, + wsKey: WsKey, +): boolean ⋮---- -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; -} +protected getPrivateWSKeys(): WsKey[] ⋮---- -interface FuturesCancelPlanOrderItemV2 { - orderId?: string; - clientOid?: string; -} +protected isAuthOnConnectWsKey(wsKey: WsKey): boolean ⋮---- -export type FuturesPlanOrderTypeV2 = - | 'normal_plan' - | 'profit_plan' - | 'loss_plan' - | 'pos_profit' - | 'pos_loss' - | 'moving_plan'; +protected async getWsUrl(wsKey: WsKey): Promise ⋮---- -export interface FuturesCancelPlanOrderRequestV2 { - orderIdList?: FuturesCancelPlanOrderItemV2[]; - symbol?: string; - productType: FuturesProductTypeV2; - marginCoin?: string; - planType?: FuturesPlanOrderTypeV2; -} +protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null ⋮---- -export type FuturesPlanStatusV2 = 'executed' | 'fail_trigger' | 'cancelled'; +/** + * @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 FuturesGetHistoryPlanOrdersRequestV2 { - orderId?: string; - clientOid?: string; - planType: 'normal_plan' | 'track_plan' | 'profit_loss'; - planStatus?: FuturesPlanStatusV2; - symbol?: string; +// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values +⋮---- +/** + { + "op":"subscribe", + "args":[ + { + "instType":"spot", + "topic":"ticker", + "symbol":"BTCUSDT" + }, + { + "instType":"spot", + "topic":"candle5m", + "symbol":"BTCUSDT" + } + ] + } + */ +⋮---- +// const request = { +// topic: 'ticker', +// payload: { instType: 'spot', symbol: 'BTCUSDT' }, +// }; +// becomes: +// const request = { +// topic: 'ticker', +// instType: 'spot', +// symbol: 'BTCUSDT', +// }; +⋮---- +private async getWsAuthSignature( + wsKey: WsKey, +): Promise< +⋮---- +private async signMessage( + paramsStr: string, + secret: string, + method: 'hex' | 'base64', + algorithm: SignAlgorithm, +): Promise +⋮---- +protected async getWsAuthRequestEvent( + wsKey: WsKey, +): Promise> +⋮---- +/** + * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) + */ +protected resolveEmittableEvents( + wsKey: WsKey, + event: MessageEventLike, +): EmittableEvent[] +⋮---- +/** + * 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 + * + * @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'); +⋮---- +// 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: 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, +⋮---- +// 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 +⋮---- +logger, // Optional: inject a custom logger +⋮---- +// Optional, see above "attachEventListeners". Attach basic event handlers, so nothing is left unhandled +// attachEventHandlers(wsClient.getWSClient()); +⋮---- +// 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. +⋮---- +/** + * 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! + */ +⋮---- +/** + * Place Order + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters + */ +⋮---- +/** + 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" + }; + */ +⋮---- +/** + * Batch Place Order Channel + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel + */ +⋮---- +/** + * 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. + */ +⋮---- +/** + 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" + } + */ +⋮---- +/** + * Cancel Order + * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel + */ +⋮---- +/** + const res = { + "event": "trade", + "id": "1750034870205", + "topic": "cancel-order", + "args": [ + { + "orderId": "xxxxxxxx", + "clientOid": "xxxxxxxx" + } + ], + "code": "0", + "msg": "Success", + "ts": "1750034870597" + } + */ +⋮---- +/** + * Batch Cancel Order + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel + */ +⋮---- +/** + 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/futures.ts +================ +import { FuturesPlanTypeV2, FuturesProductTypeV2 } from '../shared.js'; +⋮---- +export type FuturesKlineInterval = + | '1m' + | '3m' + | '5m' + | '15m' + | '30m' + | '1H' + | '2H' + | '4H' + | '6H' + | '12H' + | '1D' + | '3D' + | '1W' + | '1M' + | '6Hutc' + | '12Hutc' + | '1Dutc' + | '3Dutc' + | '1Wutc' + | '1Mutc'; +⋮---- +export type FuturesKlineTypeV2 = 'MARKET' | 'MARK' | 'INDEX'; +⋮---- +export interface FuturesAccountBillRequestV2 { productType: FuturesProductTypeV2; + symbol?: string; + coin?: string; + businessType?: string; idLessThan?: string; startTime?: string; endTime?: string; @@ -7717,352 +7895,484 @@ export interface FuturesGetHistoryPlanOrdersRequestV2 { ⋮---- /** * - * * Futures | Union Margin + * * Futures | Market * */ ⋮---- -export interface GetUnionTransferLimitsRequestV2 { - coin: string; +export interface FuturesMergeDepthRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + precision?: 'scale0' | 'scale1' | 'scale2' | 'scale3'; + limit?: '1' | '5' | '15' | '50' | 'max'; } ⋮---- -export interface UnionConvertRequestV2 { - coin: string; - amount: string; +export interface FuturesRecentTradesRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + limit?: string; } ⋮---- -/** - * - * * Futures | Account | Max Openable Quantity - * - */ -⋮---- -export interface FuturesMaxOpenRequestV2 { +export interface FuturesHistoricTradesRequestV2 { symbol: string; productType: FuturesProductTypeV2; - marginCoin: string; - posSide: 'long' | 'short'; - orderType: 'limit' | 'market'; - openPrice?: string; + limit?: string; + idLessThan?: string; + startTime?: string; + endTime?: string; } ⋮---- -/** - * - * * Futures | Account | Liquidation Price - * - */ -⋮---- -export interface FuturesLiquidationPriceRequestV2 { +export interface FuturesCandlesRequestV2 { symbol: string; productType: FuturesProductTypeV2; - marginCoin: string; - posSide: 'long' | 'short'; - orderType: 'limit' | 'market'; - openAmount: string; - openPrice?: string; + granularity: FuturesKlineInterval; + startTime?: string; + endTime?: string; + kLineType?: FuturesKlineTypeV2; + limit?: string; } ⋮---- /** * - * * Futures | Account | Isolated Symbols + * * Futures | Account * */ ⋮---- -export interface FuturesIsolatedSymbolsRequestV2 { +export interface FuturesSingleAccountRequestV2 { + symbol: string; productType: FuturesProductTypeV2; + marginCoin: string; } - -================ -File: src/types/request/v3/account.ts -================ -// Account Management Request Types ⋮---- -export interface SetLeverageRequestV3 { - category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - leverage: string; +export interface FuturesInterestHistoryRequestV2 { + productType: 'USDT-FUTURES' | 'SUSDT-FUTURES'; coin?: string; - posSide?: 'long' | 'short'; -} -⋮---- -export interface GetConvertRecordsRequestV3 { - fromCoin: string; - toCoin: string; + idLessThan?: string; startTime?: string; endTime?: string; limit?: string; - cursor?: string; } ⋮---- -export interface GetFinancialRecordsRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - coin?: string; - type?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +export interface FuturesOpenCountRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + openAmount: string; + openPrice: string; + leverage?: string; } ⋮---- -export interface RepayRequestV3 { - repayableCoinList: string[]; - paymentCoinList: string[]; +export interface FuturesSetAutoMarginRequestV2 { + symbol: string; + autoMargin: 'on' | 'off'; + marginCoin: string; + amount: string; + holdSide?: 'long' | 'short'; } ⋮---- -// Sub-account Management Request Types +export interface FuturesSetLeverageRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + leverage: string; + holdSide?: 'long' | 'short'; +} ⋮---- -export interface CreateSubAccountApiKeyRequestV3 { - subUid: string; - note: string; - type: 'read_write' | 'read_only'; - passphrase: string; - permissions: string[]; - ips: string[]; +export interface FuturesSetPositionMarginRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + holdSide: 'long' | 'short'; + amount: string; } ⋮---- -export interface DeleteSubAccountApiKeyRequestV3 { - apiKey: string; +export interface FuturesSetMarginModeRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + marginMode: 'isolated' | 'crossed'; } ⋮---- -export interface GetSubAccountApiKeysRequestV3 { - subUid: string; +/** + * + * * Futures | Position + * + */ +⋮---- +export interface FuturesHistoricalPositionsRequestV2 { + symbol?: string; + productType?: FuturesProductTypeV2; + idLessThan?: string; + startTime?: string; + endTime?: string; limit?: string; - cursor?: string; } ⋮---- -export interface UpdateSubAccountApiKeyRequestV3 { - apiKey: string; - passphrase: string; - type?: 'read_write' | 'read_only'; - permissions?: string[]; - ips?: string[]; +/** + * + * * 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 CreateSubAccountRequestV3 { - username: string; - accountMode?: 'classic' | 'unified'; - note?: string; +export interface FuturesReversalOrderRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + size: string; + side?: 'buy' | 'sell'; + tradeSide?: 'open' | 'close'; + clientOid?: string; } ⋮---- -export interface FreezeSubAccountRequestV3 { - subUid: string; - operation: 'freeze' | 'unfreeze'; +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 GetSubAccountListRequestV3 { - limit?: string; - cursor?: string; +export interface FuturesBatchOrderRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + marginMode: 'isolated' | 'crossed'; + orderList: FuturesBatchOrderItem[]; } ⋮---- -// Transfer Request Types +export interface FuturesModifyOrderRequestV2 { + orderId?: string; + clientOid?: string; + symbol: string; + productType: FuturesProductTypeV2; + newClientOid: string; + newSize?: string; + newPrice?: string; + newPresetStopSurplusPrice?: string; + newPresetStopLossPrice?: string; +} ⋮---- -export interface TransferRequestV3 { - 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; +export interface FuturesCancelOrderRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin?: string; + orderId?: string; + clientOid?: string; +} +⋮---- +interface FuturesBatchCancelOrderItem { + orderId?: string; + clientOid?: string; +} +⋮---- +export interface FuturesBatchCancelOrderRequestV2 { + orderIdList?: FuturesBatchCancelOrderItem[]; symbol?: string; - /** Enable automatic margin borrowing when balance insufficient. yes | no */ - allowBorrow?: 'yes' | 'no'; + productType: FuturesProductTypeV2; + marginCoin?: string; } ⋮---- -/** Enable automatic margin borrowing when balance insufficient. yes | no */ +export interface FuturesFlashClosePositionsRequestV2 { + symbol?: string; + productType: FuturesProductTypeV2; + holdSide?: 'long' | 'short'; +} ⋮---- -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 FuturesGetOrderRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + orderId?: string; + clientOid?: string; } ⋮---- -export interface GetSubTransferRecordsRequestV3 { - subUid?: string; - role?: 'initiator' | 'receiver'; - coin?: string; +export interface FuturesGetOrderFillsRequestV2 { + orderId?: string; + symbol?: string; + productType: FuturesProductTypeV2; + idLessThan?: string; startTime?: string; endTime?: string; - clientOid?: string; limit?: string; - cursor?: string; } ⋮---- -export interface SubAccountTransferRequestV3 { - fromType: - | 'spot' - | 'p2p' - | 'usdt_futures' - | 'coin_futures' - | 'usdc_futures' - | 'crossed_margin' - | 'uta'; - toType: - | 'spot' - | 'p2p' - | 'usdt_futures' - | 'coin_futures' - | 'usdc_futures' - | 'crossed_margin' - | 'uta'; - amount: string; - coin: string; - fromUserId: string; - toUserId: string; - clientOid: string; - /** Enable automatic margin borrowing when balance insufficient. yes | no */ - allowBorrow?: 'yes' | 'no'; +export interface FuturesGetHistoricalFillsRequestV2 { + orderId?: string; + symbol?: string; + productType: FuturesProductTypeV2; + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; } ⋮---- -/** Enable automatic margin borrowing when balance insufficient. yes | no */ -⋮---- -export interface GetSubUnifiedAssetsRequestV3 { - subUid?: string; - cursor?: string; +export interface FuturesGetOpenOrdersRequestV2 { + orderId?: string; + clientOid?: string; + symbol?: string; + productType: FuturesProductTypeV2; + status?: 'live' | 'partially_filled'; + idLessThan?: string; + startTime?: string; + endTime?: string; limit?: string; } ⋮---- -export interface GetFeeRateRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol: string; +export type FuturesOrderSourceV2 = + | 'normal' + | 'market' + | 'profit_market' + | 'loss_market' + | 'Trader_delegate' + | 'trader_profit' + | 'trader_loss' + | 'reverse' + | 'trader_reverse' + | 'profit_limit' + | 'loss_limit' + | 'liquidation' + | 'delivery_close_long' + | 'delivery_close_short' + | 'pos_profit_limit' + | 'pos_profit_market' + | 'pos_loss_limit' + | 'pos_loss_market'; +⋮---- +export interface FuturesGetHistoryOrdersRequestV2 { + orderId?: string; + clientOid?: string; + symbol?: string; + productType: FuturesProductTypeV2; + idLessThan?: string; + orderSource?: FuturesOrderSourceV2; + startTime?: string; + endTime?: string; + limit?: string; } ⋮---- -export interface GetFundingAssetsRequestV3 { - coin?: string; +export interface FuturesCancelAllOrdersRequestV2 { + symbol?: string; + productType: FuturesProductTypeV2; + marginCoin?: string; + requestTime?: string; + receiveWindow?: string; } ⋮---- -export interface SwitchDeductRequestV3 { - deduct: 'on' | 'off'; +/** + * + * * Futures | Trigger Orders + * + */ +⋮---- +export type FuturesTriggerTypeV2 = 'fill_price' | 'mark_price'; +⋮---- +export type FuturesStpModeV2 = + | 'none' + | 'cancel_taker' + | 'cancel_maker' + | 'cancel_both'; +⋮---- +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; } ⋮---- -// Deposit Request Types +export type FuturesTriggerPriceTypeV2 = + | 'fill_price' + | 'mark_price' + | 'index_price'; ⋮---- -export interface GetDepositAddressRequestV3 { - coin: string; - chain?: string; - size?: string; +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 GetSubDepositAddressRequestV3 { - subUid: string; - coin: string; - chain?: string; - size?: string; +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; } ⋮---- -export interface GetDepositRecordsRequestV3 { - coin?: string; +export interface FuturesModifyPlanOrderRequestV2 { + planType: 'normal_plan' | 'track_plan'; orderId?: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; + clientOid?: string; + symbol: string; + productType: FuturesProductTypeV2; + newSize?: string; + newPrice?: string; + newCallbackRatio?: string; + newTriggerPrice?: string; + newTriggerType?: 'fill_price' | 'mark_price'; + newStopSurplusTriggerPrice?: string; + newStopSurplusExecutePrice?: string; + newStopSurplusTriggerType?: FuturesTriggerPriceTypeV2; + newStopLossTriggerPrice?: string; + newStopLossExecutePrice?: string; + newStopLossTriggerType?: FuturesTriggerPriceTypeV2; } ⋮---- -export interface GetSubDepositRecordsRequestV3 { - coin?: string; - subUid: string; - startTime: string; - endTime: string; +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; - cursor?: string; } ⋮---- -// Withdraw Request Types -⋮---- -export interface WithdrawRequestV3 { - coin: string; - chain?: string; - transferType: 'on_chain' | 'internal_transfer'; - address: string; - innerToType?: 'uid' | 'email' | 'mobile'; - areaCode?: string; - tag?: string; - size: string; - remark?: string; +interface FuturesCancelPlanOrderItemV2 { + orderId?: string; clientOid?: string; - memberCode?: 'bithumb' | 'korbit' | 'coinone'; - identityType?: 'company' | 'user'; - companyName?: string; - firstName?: string; - lastName?: string; } ⋮---- -export interface GetWithdrawRecordsRequestV3 { - coin?: string; +export type FuturesPlanOrderTypeV2 = + | 'normal_plan' + | 'profit_plan' + | 'loss_plan' + | 'pos_profit' + | 'pos_loss' + | 'moving_plan'; +⋮---- +export interface FuturesCancelPlanOrderRequestV2 { + orderIdList?: FuturesCancelPlanOrderItemV2[]; + symbol?: string; + productType: FuturesProductTypeV2; + marginCoin?: string; + planType?: FuturesPlanOrderTypeV2; +} +⋮---- +export type FuturesPlanStatusV2 = 'executed' | 'fail_trigger' | 'cancelled'; +⋮---- +export interface FuturesGetHistoryPlanOrdersRequestV2 { orderId?: string; clientOid?: string; - startTime: string; - endTime: string; + planType: 'normal_plan' | 'track_plan' | 'profit_loss'; + planStatus?: FuturesPlanStatusV2; + symbol?: string; + productType: FuturesProductTypeV2; + idLessThan?: string; + startTime?: string; + endTime?: string; limit?: string; - cursor?: string; } ⋮---- -export interface SetDepositAccountRequestV3 { +/** + * + * * Futures | Union Margin + * + */ +⋮---- +export interface GetUnionTransferLimitsRequestV2 { coin: string; - accountType: 'funding' | 'unified' | 'otc'; } ⋮---- -export interface GetMaxTransferableRequestV3 { +export interface UnionConvertRequestV2 { coin: string; + amount: string; } ⋮---- -export interface GetOpenInterestLimitRequestV3 { +/** + * + * * Futures | Account | Max Openable Quantity + * + */ +⋮---- +export interface FuturesMaxOpenRequestV2 { symbol: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + productType: FuturesProductTypeV2; + marginCoin: string; + posSide: 'long' | 'short'; + orderType: 'limit' | 'market'; + openPrice?: string; } ⋮---- -export interface GetTaxRecordsRequestV3 { - bizType: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES' - | 'OTHER'; - marginType?: 'isolated' | 'crossed'; - coin?: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; +/** + * + * * Futures | Account | Liquidation Price + * + */ +⋮---- +export interface FuturesLiquidationPriceRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + posSide: 'long' | 'short'; + orderType: 'limit' | 'market'; + openAmount: string; + openPrice?: string; +} +⋮---- +/** + * + * * Futures | Account | Isolated Symbols + * + */ +⋮---- +export interface FuturesIsolatedSymbolsRequestV2 { + productType: FuturesProductTypeV2; } ================ @@ -8676,823 +8986,1140 @@ export interface UnionTransferLimitsV2 { maxTransferIn: string; } ⋮---- -export interface UnionConfigV2 { - imr: string; - mmr: string; - individualLimit: string; - individualLimitRatio: string; -} +export interface UnionConfigV2 { + imr: string; + mmr: string; + individualLimit: string; + individualLimitRatio: string; +} +⋮---- +export interface UnionSwitchUsdtV2 { + usdtAmount: string; +} +⋮---- +export interface UnionConvertV2 { + usdtAmount: string; +} +⋮---- +/** + * + * * Futures | Account | Max Openable Quantity + * + */ +⋮---- +export interface FuturesMaxOpenV2 { + maxOpen: string; +} +⋮---- +/** + * + * * Futures | Account | Liquidation Price + * + */ +⋮---- +export interface FuturesLiquidationPriceV2 { + liqPrice: string; +} +⋮---- +/** + * + * * Futures | Account | Isolated Symbols + * + */ +⋮---- +export interface FuturesIsolatedSymbolV2 { + symbol: string; + marginMode: 'isolated'; +} + +================ +File: src/types/websockets/ws-general.ts +================ +import type { ClientRequestArgs } from 'http'; +import WebSocket from 'isomorphic-ws'; +⋮---- +import { RestClientOptions } from '../../util/requestUtils.js'; +import { WS_KEY_MAP } from '../../util/websocket-util.js'; +import { FuturesProductTypeV2 } from '../request/shared.js'; +⋮---- +export type BitgetInstType = 'SP' | 'SPBL' | 'MC' | 'UMCBL' | 'DMCBL'; +export type BitgetInstTypeV2 = 'SPOT' | FuturesProductTypeV2; +export type BitgetInstTypeV3 = + | 'UTA' // for account-level topics + | 'spot' + | 'usdt-futures' + | 'coin-futures' + | 'usdc-futures'; +⋮---- +| '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 + * + */ +⋮---- +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'; ⋮---- -export interface UnionSwitchUsdtV2 { - usdtAmount: string; -} +// Also update PRIVATE_TOPICS_V2 if this is updated +export type WSPrivateTopicMarginV2 = + | 'orders-crossed' + | 'account-crossed' + | 'account-isolated' + | 'orders-isolated'; ⋮---- -export interface UnionConvertV2 { - usdtAmount: string; -} +// Also update PRIVATE_TOPICS_V2 if this is updated +export type WsPrivateTopicV2 = + | 'account' + | 'orders' + | WSPrivateTopicFuturesV2 + | WSPrivateTopicMarginV2; +⋮---- +export type WsTopicV2 = WsPublicTopicV2 | WsPrivateTopicV2; ⋮---- /** * - * * Futures | Account | Max Openable Quantity + * V3 / UTA list of topics for WebSocket consumers * */ +export type WsPublicTopicV3 = 'ticker' | 'kline' | 'books' | 'publicTrade'; +// Also update PRIVATE_TOPICS_V3 if this is updated +export type WsPrivateTopicV3 = 'account' | 'position' | 'fill' | 'order'; +export type WsTopicV3 = WsPublicTopicV3 | WsPrivateTopicV3; ⋮---- -export interface FuturesMaxOpenV2 { - maxOpen: string; -} +/** This is used to differentiate between each of the available websocket streams */ +export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP]; ⋮---- /** - * - * * Futures | Account | Liquidation Price - * + * Event args for subscribing/unsubscribing */ ⋮---- -export interface FuturesLiquidationPriceV2 { - liqPrice: string; +export interface WsTopicSubscribeEventArgs { + instType: BitgetInstType; + channel: WsTopic; + instId?: string; } ⋮---- -/** - * - * * Futures | Account | Isolated Symbols - * - */ +export type WsTopicSubscribePublicArgsV2 = { + instType: BitgetInstTypeV2; + channel: WsPublicTopicV2; + /** The symbol, e.g. "BTCUSDT" */ + instId: string; +}; ⋮---- -export interface FuturesIsolatedSymbolV2 { - symbol: string; - marginMode: 'isolated'; -} +/** 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; -================ -File: src/types/response/v3/public.ts -================ -export interface PublicFillV3 { - execId: string; - price: string; - size: string; - side: 'sell' | 'buy'; - ts: string; + /** Your API secret */ + apiSecret?: string; + + /** The passphrase you set when creating the API Key (NOT your account password) */ + apiPass?: string; + + /** + * Set to `true` to connect to Bitget's demo trading WebSockets: + * + * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket + * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading + */ + demoTrading?: boolean; + + /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ + recvWindow?: number; + + // Disable ping/pong ws heartbeat mechanism (not recommended) + disableHeartbeat?: boolean; + + /** How often to check if the connection is alive */ + pingInterval?: number; + + /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ + pongTimeout?: number; + + /** Delay in milliseconds before respawning the connection */ + reconnectTimeout?: number; + + requestOptions?: RestClientOptions; + + wsOptions?: { + protocols?: string[]; + agent?: any; + } & Partial; + + wsUrl?: string; + + /** + * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method + * + * Look in the examples folder for a demonstration on using node's createHmac instead. + */ + customSignMessageFn?: (message: string, secret: string) => Promise; } ⋮---- -export 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 -} +/** Your API key */ ⋮---- -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 +/** Your API secret */ ⋮---- -export interface ContractOiV3 { - symbol: string; - notionalValue: string; - totalNotionalValue: string; -} +/** The passphrase you set when creating the API Key (NOT your account password) */ ⋮---- -export interface CurrentFundingRateV3 { - symbol: string; - fundingRate: string; - fundingRateInterval: string; - nextUpdate: string; - minFundingRate: string; - maxFundingRate: string; -} +/** + * Set to `true` to connect to Bitget's demo trading WebSockets: + * + * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket + * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading + */ ⋮---- -export interface DiscountRateTierV3 { - tierStartValue: string; - discountRate: string; -} +/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ ⋮---- -export interface DiscountRateV3 { - coin: string; - list: DiscountRateTierV3[]; -} +// Disable ping/pong ws heartbeat mechanism (not recommended) ⋮---- -export interface HistoryFundingRateV3 { - symbol: string; - fundingRate: string; - fundingRateTimestamp: string; -} +/** How often to check if the connection is alive */ ⋮---- -export interface MarginLoanV3 { - dailyInterest: string; - annualInterest: string; - limit: string; -} +/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ ⋮---- -export interface OpenInterestItemV3 { - symbol: string; - openInterest: string; -} +/** Delay in milliseconds before respawning the connection */ ⋮---- -export interface OpenInterestV3 { - list: OpenInterestItemV3[]; - ts: string; -} +/** + * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method + * + * Look in the examples folder for a demonstration on using node's createHmac instead. + */ ⋮---- -export interface PositionTierV3 { - tier: string; - minTierValue: string; - maxTierValue: string; - leverage: string; - mmr: string; +export interface WebsocketClientOptions extends WSClientConfigurableOptions { + pingInterval: number; + pongTimeout: number; + reconnectTimeout: number; + recvWindow: number; + authPrivateConnectionsOnConnect: boolean; + authPrivateRequests: boolean; } + +================ +File: src/types/request/v3/account.ts +================ +// Account Management Request Types ⋮---- -export interface RiskReserveRecordV3 { - balance: string; - amount: string; - ts: string; +export interface SetLeverageRequestV3 { + category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + leverage: string; + coin?: string; + posSide?: 'long' | 'short'; } ⋮---- -export interface RiskReserveV3 { - coin: string; - riskReserveRecords: RiskReserveRecordV3[]; +export interface GetConvertRecordsRequestV3 { + fromCoin: string; + toCoin: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface InstrumentV3 { - symbol: string; +export interface GetFinancialRecordsRequestV3 { category: | 'SPOT' | 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - baseCoin: string; - quoteCoin: string; - buyLimitPriceRatio: string; - sellLimitPriceRatio: string; - feeRateUpRatio: string; - minOrderQty: string; - maxOrderQty: string; - maxMarketOrderQty: string; - pricePrecision: string; - quantityPrecision: string; - quotePrecision: string; - minOrderAmount: string; - maxSymbolOrderNum: string; - maxProductOrderNum: string; - status: - | 'listed' - | 'online' - | 'limit_open' - | 'limit_close' - | 'offline' - | 'restrictedAPI'; - offTime: string; - limitOpenTime: string; - maintainTime: string; - areaSymbol?: string; - - // Futures specific fields - makerFeeRate?: string; - takerFeeRate?: string; - openCostUpRatio?: string; - priceMultiplier?: string; - quantityMultiplier?: string; - symbolType?: 'perpetual' | 'delivery'; - maxPositionNum?: string; - deliveryTime?: string; - deliveryStartTime?: string; - deliveryPeriod?: string; - /** Launch time - Unix millisecond timestamp. Null for some margin pairs. */ - launchTime?: string | null; - fundInterval?: string; - minLeverage?: string; - maxLeverage?: string; - - // Margin specific fields - isIsolatedBaseBorrowable?: 'YES' | 'NO'; - isIsolatedQuotedBorrowable?: 'YES' | 'NO'; - warningRiskRatio?: string; - liquidationRiskRatio?: string; - maxCrossedLeverage?: string; - maxIsolatedLeverage?: string; - userMinBorrow?: string; + coin?: string; + type?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -// Futures specific fields +export interface RepayRequestV3 { + repayableCoinList: string[]; + paymentCoinList: string[]; +} ⋮---- -/** Launch time - Unix millisecond timestamp. Null for some margin pairs. */ +// Sub-account Management Request Types ⋮---- -// Margin specific fields +export interface CreateSubAccountApiKeyRequestV3 { + subUid: string; + note: string; + type: 'read_write' | 'read_only'; + passphrase: string; + permissions: string[]; + ips: string[]; +} ⋮---- -export interface MarketFeeGroupLabelV3 { - weight: string; - label: string; - symbols: string[]; +export interface DeleteSubAccountApiKeyRequestV3 { + apiKey: string; } ⋮---- -export interface MarketFeeGroupTierV3 { - level: string; - makerFeeRate: string; +export interface GetSubAccountApiKeysRequestV3 { + subUid: string; + limit?: string; + cursor?: string; } ⋮---- -export interface MarketFeeGroupV3 { - category: string; - group: string; - labelList: MarketFeeGroupLabelV3[]; - tierList: MarketFeeGroupTierV3[]; +export interface UpdateSubAccountApiKeyRequestV3 { + apiKey: string; + passphrase: string; + type?: 'read_write' | 'read_only'; + permissions?: string[]; + ips?: string[]; } ⋮---- -export interface MarketScoreWeightV3 { - category: string; - label: string; - symbol: string; - requiredSpread: string; - minMakerVolume: string; - weight: string; +export interface CreateSubAccountRequestV3 { + username: string; + accountMode?: 'classic' | 'unified'; + note?: string; } ⋮---- -export interface OrderBookV3 { - a: string[][]; // asks - [price, size] - b: string[][]; // bids - [price, size] - ts: string; +export interface FreezeSubAccountRequestV3 { + subUid: string; + operation: 'freeze' | 'unfreeze'; } ⋮---- -a: string[][]; // asks - [price, size] -b: string[][]; // bids - [price, size] +export interface GetSubAccountListRequestV3 { + 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; - - // Futures specific fields - indexPrice?: string; - markPrice?: string; - fundingRate?: string; - openInterest?: string; - deliveryStartTime?: string; - deliveryTime?: string; - deliveryStatus?: string; +// Transfer Request Types +⋮---- +export interface TransferRequestV3 { + 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'; } ⋮---- -// Futures specific fields +/** Enable automatic margin borrowing when balance insufficient. yes | no */ ⋮---- -export interface ProofOfReservesV3 { - merkleRootHash: string; - totalReserveRatio: string; - list: { - coin: string; - userAssets: string; - platformAssets: string; - reserveRatio: 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 GetSubTransferRecordsRequestV3 { + subUid?: string; + role?: 'initiator' | 'receiver'; + coin?: string; + startTime?: string; + endTime?: string; + clientOid?: string; + limit?: string; + cursor?: string; +} +⋮---- +export interface SubAccountTransferRequestV3 { + fromType: + | 'spot' + | 'p2p' + | 'usdt_futures' + | 'coin_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'uta'; + toType: + | 'spot' + | 'p2p' + | 'usdt_futures' + | 'coin_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'uta'; + amount: string; + coin: string; + fromUserId: string; + toUserId: string; + clientOid: string; + /** Enable automatic margin borrowing when balance insufficient. yes | no */ + allowBorrow?: 'yes' | 'no'; } ⋮---- -export interface IndexComponentV3 { - exchange: string; - spotPair: string; - equivalentPrice: string; - weight: string; +/** Enable automatic margin borrowing when balance insufficient. yes | no */ +⋮---- +export interface GetSubUnifiedAssetsRequestV3 { + subUid?: string; + cursor?: string; + limit?: string; } ⋮---- -export interface IndexPriceComponentsV3 { +export interface GetFeeRateRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; symbol: string; - componentList: IndexComponentV3[]; } - -================ -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 interface GetFundingAssetsRequestV3 { + coin?: string; +} ⋮---- -export type BitgetInstType = 'SP' | 'SPBL' | 'MC' | 'UMCBL' | 'DMCBL'; -export type BitgetInstTypeV2 = 'SPOT' | FuturesProductTypeV2; -export type BitgetInstTypeV3 = - | 'UTA' // for account-level topics - | 'spot' - | 'usdt-futures' - | 'coin-futures' - | 'usdc-futures'; +export interface SwitchDeductRequestV3 { + deduct: 'on' | 'off'; +} ⋮---- -| 'UTA' // for account-level topics +// Deposit Request Types ⋮---- -/** - * - * V1 list of topics for WebSocket consumers - * - */ +export interface GetDepositAddressRequestV3 { + coin: string; + chain?: string; + size?: string; +} ⋮---- -export type WsPublicSpotTopic = - | 'ticker' - | 'candle1W' - | 'candle1D' - | 'candle12H' - | 'candle4H' - | 'candle1H' - | 'candle30m' - | 'candle15m' - | 'candle5m' - | 'candle1m' - | 'books' - | 'books5' - | 'trade'; +export interface GetSubDepositAddressRequestV3 { + subUid: string; + coin: string; + chain?: string; + size?: string; +} ⋮---- -// Futures currently has the same public topics as spot -export type WsPublicFuturesTopic = WsPublicSpotTopic; -export type WsPrivateSpotTopic = 'account' | 'orders'; +export interface GetDepositRecordsRequestV3 { + coin?: string; + orderId?: string; + startTime: string; + endTime: string; + limit?: string; + cursor?: string; +} ⋮---- -export type WsPrivateFuturesTopic = - | 'account' - | 'positions' - | 'orders' - | 'ordersAlgo'; +export interface GetSubDepositRecordsRequestV3 { + coin?: string; + subUid: string; + startTime: string; + endTime: string; + limit?: string; + cursor?: string; +} ⋮---- -export type WsPublicTopic = WsPublicSpotTopic | WsPublicFuturesTopic; +// Withdraw Request Types ⋮---- -export type WsPrivateTopic = WsPrivateSpotTopic | WsPrivateFuturesTopic; -export type WsTopic = WsPublicTopic | WsPrivateTopic; +export interface WithdrawRequestV3 { + coin: string; + chain?: 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; +} ⋮---- -/** - * - * V2 list of topics for WebSocket consumers - * - */ +export interface GetWithdrawRecordsRequestV3 { + coin?: string; + orderId?: string; + clientOid?: string; + startTime: string; + endTime: string; + limit?: string; + cursor?: string; +} ⋮---- -export type WsPublicTopicV2 = - | 'index-price' // margin only - | 'ticker' - | 'candle1m' - | 'candle5m' - | 'candle15m' - | 'candle30m' - | 'candle1H' - | 'candle4H' - | 'candle6H' - | 'candle12H' - | 'candle1D' - | 'candle3D' - | 'candle1W' - | 'candle1M' - | 'candle6Hutc' - | 'candle12Hutc' - | 'candle1Dutc' - | 'candle3Dutc' - | 'candle1Wutc' - | 'candle1Mutc' - | 'trade' - | 'books' - | 'books1' - | 'books5' - | 'books15'; +export interface SetDepositAccountRequestV3 { + coin: string; + accountType: 'funding' | 'unified' | 'otc'; +} ⋮---- -| 'index-price' // margin only +export interface GetMaxTransferableRequestV3 { + coin: string; +} ⋮---- -// Also update PRIVATE_TOPICS_V2 if this is updated -export type WSPrivateTopicFuturesV2 = - | 'positions' - | 'orders-algo' - | 'positions-history'; +export interface GetOpenInterestLimitRequestV3 { + symbol: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +} ⋮---- -// Also update PRIVATE_TOPICS_V2 if this is updated -export type WSPrivateTopicMarginV2 = - | 'orders-crossed' - | 'account-crossed' - | 'account-isolated' - | 'orders-isolated'; +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; +} + +================ +File: src/types/response/v3/account.ts +================ +// Account Management Response Types +export interface AccountSymbolConfigV3 { + category: string; + symbol: string; + marginMode: string; + leverage: string; +} ⋮---- -// Also update PRIVATE_TOPICS_V2 if this is updated -export type WsPrivateTopicV2 = - | 'account' - | 'orders' - | WSPrivateTopicFuturesV2 - | WSPrivateTopicMarginV2; +export interface AccountCoinConfigV3 { + coin: string; + leverage: string; +} ⋮---- -export type WsTopicV2 = WsPublicTopicV2 | WsPrivateTopicV2; +export interface AccountSettingsV3 { + assetMode: string; + holdMode: string; + symbolConfigList: AccountSymbolConfigV3[]; + coinConfigList: AccountCoinConfigV3[]; +} +⋮---- +export interface AccountAssetV3 { + coin: string; + equity: string; + usdValue: string; + balance: string; + available: string; + debt: string; + locked: string; +} +⋮---- +export interface AccountAssetsV3 { + accountEquity: string; + usdtEquity: string; + btcEquity: string; + unrealisedPnl: string; + usdtUnrealisedPnl: string; + btcUnrealizedPnl: string; + effEquity: string; + mmr: string; + imr: string; + mgnRatio: string; + positionMgnRatio: string; + assets: AccountAssetV3[]; +} +⋮---- +export interface ConvertRecordV3 { + fromCoin: string; + fromCoinSize: string; + toCoin: string; + toCoinSize: string; + price: string; + ts: string; +} ⋮---- -/** - * - * V3 / UTA list of topics for WebSocket consumers - * - */ -export type WsPublicTopicV3 = 'ticker' | 'kline' | 'books' | 'publicTrade'; -// Also update PRIVATE_TOPICS_V3 if this is updated -export type WsPrivateTopicV3 = 'account' | 'position' | 'fill' | 'order'; -export type WsTopicV3 = WsPublicTopicV3 | WsPrivateTopicV3; +export interface FinancialRecordV3 { + category: string; + id: string; + symbol: string; + coin: string; + type: string; + amount: string; + fee: string; + balance: string; + ts: string; +} ⋮---- -/** This is used to differentiate between each of the available websocket streams */ -export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP]; +export interface PaymentCoinV3 { + coin: string; + size: string; + amount: string; +} ⋮---- -/** - * Event args for subscribing/unsubscribing - */ +export interface RepayableCoinV3 { + coin: string; + size: string; + amount: string; +} ⋮---- -export interface WsTopicSubscribeEventArgs { - instType: BitgetInstType; - channel: WsTopic; - instId?: string; +export interface RepayResponseV3 { + result: string; + repayAmount: string; } ⋮---- -export type WsTopicSubscribePublicArgsV2 = { - instType: BitgetInstTypeV2; - channel: WsPublicTopicV2; - /** The symbol, e.g. "BTCUSDT" */ - instId: string; -}; +// Sub-account Management Response Types ⋮---- -/** The symbol, e.g. "BTCUSDT" */ +export interface CreateSubAccountApiKeyResponseV3 { + note: string; + apiKey: string; + secret: string; + type: string; + permissions: string[]; + ips: string[]; +} +export interface SubAccountApiKeyV3 { + apiKey: string; + note: string; + type: string; + permissions: string[]; + ips: string[]; + ts?: string; +} ⋮---- -export type WsInstIdChannelsV2 = - | 'orders' - | WSPrivateTopicFuturesV2 - | 'orders-crossed' - | 'orders-isolated'; +export interface UpdateSubAccountApiKeyResponseV3 { + note: string; + apiKey: string; + type: string; + permissions: string[]; + ips: string[]; +} ⋮---- -export type WsTopicSubscribePrivateInstIdArgsV2 = { - instType: BitgetInstTypeV2; - channel: WsInstIdChannelsV2; - /** The symbol, e.g. "BTCUSDT" */ - instId?: string; -}; +export interface CreateSubAccountResponseV3 { + username: string; + subUid: string; + status: string; + note: string; + createdTime: string; + updatedTime: string; +} ⋮---- -/** The symbol, e.g. "BTCUSDT" */ +export interface SubAccountV3 { + subUid: string; + username: string; + status: string; + accountMode: string; + type: string; + note: string; + createdTime: string; + updatedTime: string; +} ⋮---- -export type WsCoinChannelsV2 = - | 'account' - | 'account-crossed' - | 'account-isolated'; +// Transfer Response Types ⋮---- -export type WsTopicSubscribePrivateCoinArgsV2 = { - instType: BitgetInstTypeV2; - channel: WsCoinChannelsV2; - coin: 'default' | string; -}; +export interface TransferResponseV3 { + transferId: string; +} ⋮---- -export type WsTopicSubscribePrivateArgsV2 = - | WsTopicSubscribePrivateInstIdArgsV2 - | WsTopicSubscribePrivateCoinArgsV2; +export interface SubTransferRecordV3 { + transferId: string; + oldTransferId?: string; + fromType: string; + toType: string; + amount: string; + coin: string; + fromUserId: string; + toUserId: string; + status: string; + clientOid: string; + createdTime: string; + updatedTime: string; +} ⋮---- -export type WsTopicSubscribeEventArgsV2 = - | WsTopicSubscribePublicArgsV2 - | WsTopicSubscribePrivateArgsV2; +export interface SubUnifiedAssetV3 { + coin: string; + equity: string; + usdValue: string; + balance: string; + available: string; + debt: string; + locked: string; +} ⋮---- -/** General configuration for the WebsocketClient */ -export interface WSClientConfigurableOptions { - /** Your API key */ - apiKey?: string; - - /** Your API secret */ - apiSecret?: string; - - /** The passphrase you set when creating the API Key (NOT your account password) */ - apiPass?: string; - - /** - * Set to `true` to connect to Bitget's demo trading WebSockets: - * - * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket - * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading - */ - demoTrading?: boolean; - - /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ - recvWindow?: number; - - // Disable ping/pong ws heartbeat mechanism (not recommended) - disableHeartbeat?: boolean; - - /** How often to check if the connection is alive */ - pingInterval?: number; - - /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ - pongTimeout?: number; - - /** Delay in milliseconds before respawning the connection */ - reconnectTimeout?: number; - - requestOptions?: RestClientOptions; - - wsOptions?: { - protocols?: string[]; - agent?: any; - } & Partial; - - wsUrl?: string; - - /** - * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method - * - * Look in the examples folder for a demonstration on using node's createHmac instead. - */ - customSignMessageFn?: (message: string, secret: string) => Promise; +export interface SubUnifiedAssetV3 { + subUid: string; + cursor: string; + assets: SubUnifiedAssetV3[]; } ⋮---- -/** Your API key */ +export interface GetFeeRateResponseV3 { + makerFeeRate: string; + takerFeeRate: string; +} ⋮---- -/** Your API secret */ +export interface FundingAssetV3 { + coin: string; + available: string; + frozen: string; + balance: string; +} ⋮---- -/** The passphrase you set when creating the API Key (NOT your account password) */ +// Deposit Response Types ⋮---- -/** - * Set to `true` to connect to Bitget's demo trading WebSockets: - * - * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket - * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading - */ +export interface DepositAddressV3 { + address: string; + chain: string; + coin: string; + tag: string; + url: string; +} ⋮---- -/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ +export interface DepositRecordV3 { + orderId: string; + recordId: string; + coin: string; + type: 'deposit'; + dest: 'on_chain' | 'internal_transfer'; + size: string; + status: 'pending' | 'success' | 'fail'; + fromAddress: string; + toAddress: string; + chain: string; + createdTime: string; + updatedTime: string; +} ⋮---- -// Disable ping/pong ws heartbeat mechanism (not recommended) +// Withdraw Response Types ⋮---- -/** How often to check if the connection is alive */ +export interface WithdrawResponseV3 { + orderId: string; + clientOid: string; +} ⋮---- -/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ +export interface WithdrawRecordV3 { + orderId: string; + clientOid: string; + recordId: string; + coin: string; + type: 'withdraw'; + dest: 'on_chain' | 'internal_transfer'; + size: string; + status: 'pending' | 'success' | 'fail'; + fromAddress: string; + toAddress: string; + chain: string; + fee: string; + confirm: string; + tag: string; + createdTime: string; + updatedTime: string; +} ⋮---- -/** Delay in milliseconds before respawning the connection */ +export interface MaxTransferableV3 { + coin: string; + maxTransfer: string; + borrowMaxTransfer: string; +} ⋮---- -/** - * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method - * - * Look in the examples folder for a demonstration on using node's createHmac instead. - */ +export interface OpenInterestLimitV3 { + symbol: string; + singleUserLimit: string; + masterSubLimit: string; + marketMakerLimit: string; +} ⋮---- -export interface WebsocketClientOptions extends WSClientConfigurableOptions { - pingInterval: number; - pongTimeout: number; - reconnectTimeout: number; - recvWindow: number; - authPrivateConnectionsOnConnect: boolean; - authPrivateRequests: boolean; +export interface TaxRecordV3 { + id: string; + coin: string; + type: string; + amount: string; + fee: string; + balance: string; + ts: string; } ================ -File: src/types/response/v3/account.ts +File: src/types/response/v3/public.ts ================ -// Account Management Response Types -export interface AccountSymbolConfigV3 { - category: string; +export interface PublicFillV3 { + execId: string; + price: string; + size: string; + side: 'sell' | 'buy'; + ts: string; +} +⋮---- +export interface CandlestickV3 extends Array { + 0: string; // timestamp + 1: string; // open price + 2: string; // high price + 3: string; // low price + 4: string; // close price + 5: string; // volume + 6: string; // turnover +} +⋮---- +0: string; // timestamp +1: string; // open price +2: string; // high price +3: string; // low price +4: string; // close price +5: string; // volume +6: string; // turnover +⋮---- +export interface ContractOiV3 { symbol: string; - marginMode: string; - leverage: string; + notionalValue: string; + totalNotionalValue: string; } ⋮---- -export interface AccountCoinConfigV3 { - coin: string; - leverage: string; +export interface CurrentFundingRateV3 { + symbol: string; + fundingRate: string; + fundingRateInterval: string; + nextUpdate: string; + minFundingRate: string; + maxFundingRate: string; } ⋮---- -export interface AccountSettingsV3 { - assetMode: string; - holdMode: string; - symbolConfigList: AccountSymbolConfigV3[]; - coinConfigList: AccountCoinConfigV3[]; +export interface DiscountRateTierV3 { + tierStartValue: string; + discountRate: string; } ⋮---- -export interface AccountAssetV3 { +export interface DiscountRateV3 { coin: string; - equity: string; - usdValue: string; - balance: string; - available: string; - debt: string; - locked: string; + list: DiscountRateTierV3[]; } ⋮---- -export interface AccountAssetsV3 { - accountEquity: string; - usdtEquity: string; - btcEquity: string; - unrealisedPnl: string; - usdtUnrealisedPnl: string; - btcUnrealizedPnl: string; - effEquity: string; - mmr: string; - imr: string; - mgnRatio: string; - positionMgnRatio: string; - assets: AccountAssetV3[]; +export interface HistoryFundingRateV3 { + symbol: string; + fundingRate: string; + fundingRateTimestamp: string; } ⋮---- -export interface ConvertRecordV3 { - fromCoin: string; - fromCoinSize: string; - toCoin: string; - toCoinSize: string; - price: string; - ts: string; +export interface MarginLoanV3 { + dailyInterest: string; + annualInterest: string; + limit: string; } ⋮---- -export interface FinancialRecordV3 { - category: string; - id: string; +export interface OpenInterestItemV3 { symbol: string; - coin: string; - type: string; - amount: string; - fee: string; - balance: string; + openInterest: string; +} +⋮---- +export interface OpenInterestV3 { + list: OpenInterestItemV3[]; ts: string; } ⋮---- -export interface PaymentCoinV3 { - coin: string; - size: string; - amount: string; +export interface PositionTierV3 { + tier: string; + minTierValue: string; + maxTierValue: string; + leverage: string; + mmr: string; } ⋮---- -export interface RepayableCoinV3 { - coin: string; - size: string; +export interface RiskReserveRecordV3 { + balance: string; amount: string; + ts: string; + type?: string; } ⋮---- -export interface RepayResponseV3 { - result: string; - repayAmount: string; +export interface RiskReserveV3 { + totalBalance?: string; + coin: string; + riskReserveRecords: RiskReserveRecordV3[]; } ⋮---- -// Sub-account Management Response Types -⋮---- -export interface CreateSubAccountApiKeyResponseV3 { - note: string; - apiKey: string; - secret: string; - type: string; - permissions: string[]; - ips: string[]; +export interface RiskReserveHourRecordV3 { + amount: string; + balance: string; + ts: string; } -export interface SubAccountApiKeyV3 { - apiKey: string; - note: string; - type: string; - permissions: string[]; - ips: string[]; - ts?: string; +⋮---- +export interface RiskReserveHourV3 { + coin: string; + riskReserveRecords: RiskReserveHourRecordV3[]; } ⋮---- -export interface UpdateSubAccountApiKeyResponseV3 { - note: string; - apiKey: string; - type: string; - permissions: string[]; - ips: string[]; +export interface RiskReserveAllItemV3 { + symbols: string[]; + coin: string; + balance: string; } ⋮---- -export interface CreateSubAccountResponseV3 { - username: string; - subUid: string; - status: string; - note: string; - createdTime: string; - updatedTime: string; +export interface RiskReserveAllV3 { + list: RiskReserveAllItemV3[]; } ⋮---- -export interface SubAccountV3 { - subUid: string; - username: string; - status: string; - accountMode: string; - type: string; - note: string; - createdTime: string; - updatedTime: string; +export interface InstrumentV3 { + symbol: string; + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + baseCoin: string; + quoteCoin: string; + buyLimitPriceRatio: string; + sellLimitPriceRatio: string; + feeRateUpRatio: string; + minOrderQty: string; + maxOrderQty: string; + maxMarketOrderQty: string; + pricePrecision: string; + quantityPrecision: string; + quotePrecision: string; + minOrderAmount: string; + maxSymbolOrderNum: string; + maxProductOrderNum: string; + status: + | 'listed' + | 'online' + | 'limit_open' + | 'limit_close' + | 'offline' + | 'restrictedAPI'; + offTime: string; + limitOpenTime: string; + maintainTime: string; + areaSymbol?: string; + + // Futures specific fields + makerFeeRate?: string; + takerFeeRate?: string; + openCostUpRatio?: string; + priceMultiplier?: string; + quantityMultiplier?: string; + symbolType?: 'perpetual' | 'delivery'; + maxPositionNum?: string; + deliveryTime?: string; + deliveryStartTime?: string; + deliveryPeriod?: string; + /** Launch time - Unix millisecond timestamp. Null for some margin pairs. */ + launchTime?: string | null; + fundInterval?: string; + minLeverage?: string; + maxLeverage?: string; + + // Margin specific fields + isIsolatedBaseBorrowable?: 'YES' | 'NO'; + isIsolatedQuotedBorrowable?: 'YES' | 'NO'; + warningRiskRatio?: string; + liquidationRiskRatio?: string; + maxCrossedLeverage?: string; + maxIsolatedLeverage?: string; + userMinBorrow?: string; } ⋮---- -// Transfer Response Types -⋮---- -export interface TransferResponseV3 { - transferId: string; -} +// Futures specific fields ⋮---- -export interface SubTransferRecordV3 { - transferId: string; - oldTransferId?: string; - fromType: string; - toType: string; - amount: string; - coin: string; - fromUserId: string; - toUserId: string; - status: string; - clientOid: string; - createdTime: string; - updatedTime: string; -} +/** Launch time - Unix millisecond timestamp. Null for some margin pairs. */ ⋮---- -export interface SubUnifiedAssetV3 { - coin: string; - equity: string; - usdValue: string; - balance: string; - available: string; - debt: string; - locked: string; -} +// Margin specific fields ⋮---- -export interface SubUnifiedAssetV3 { - subUid: string; - cursor: string; - assets: SubUnifiedAssetV3[]; +export interface MarketFeeGroupLabelV3 { + weight: string; + label: string; + symbols: string[]; } ⋮---- -export interface GetFeeRateResponseV3 { +export interface MarketFeeGroupTierV3 { + level: string; makerFeeRate: string; - takerFeeRate: string; } ⋮---- -export interface FundingAssetV3 { - coin: string; - available: string; - frozen: string; - balance: string; +export interface MarketFeeGroupV3 { + category: string; + group: string; + labelList: MarketFeeGroupLabelV3[]; + tierList: MarketFeeGroupTierV3[]; } ⋮---- -// Deposit Response Types -⋮---- -export interface DepositAddressV3 { - address: string; - chain: string; - coin: string; - tag: string; - url: string; +export interface MarketScoreWeightV3 { + category: string; + label: string; + symbol: string; + requiredSpread: string; + minMakerVolume: string; + weight: string; } ⋮---- -export interface DepositRecordV3 { - orderId: string; - recordId: string; - coin: string; - type: 'deposit'; - dest: 'on_chain' | 'internal_transfer'; - size: string; - status: 'pending' | 'success' | 'fail'; - fromAddress: string; - toAddress: string; - chain: string; - createdTime: string; - updatedTime: string; +export interface OrderBookV3 { + a: string[][]; // asks - [price, size] + b: string[][]; // bids - [price, size] + ts: string; } ⋮---- -// Withdraw Response Types +a: string[][]; // asks - [price, size] +b: string[][]; // bids - [price, size] ⋮---- -export interface WithdrawResponseV3 { - orderId: string; - clientOid: string; +export interface TickerV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + lastPrice: string; + openPrice24h: string; + highPrice24h: string; + lowPrice24h: string; + ask1Price: string; + bid1Price: string; + bid1Size: string; + ask1Size: string; + price24hPcnt: string; + volume24h: string; + turnover24h: string; + + // Futures specific fields + indexPrice?: string; + markPrice?: string; + fundingRate?: string; + openInterest?: string; + deliveryStartTime?: string; + deliveryTime?: string; + deliveryStatus?: string; } ⋮---- -export interface WithdrawRecordV3 { - orderId: string; - clientOid: string; - recordId: string; - coin: string; - type: 'withdraw'; - dest: 'on_chain' | 'internal_transfer'; - size: string; - status: 'pending' | 'success' | 'fail'; - fromAddress: string; - toAddress: string; - chain: string; - fee: string; - confirm: string; - tag: string; - createdTime: string; - updatedTime: string; -} +// Futures specific fields ⋮---- -export interface MaxTransferableV3 { - coin: string; - maxTransfer: string; - borrowMaxTransfer: string; +export interface ProofOfReservesV3 { + merkleRootHash: string; + totalReserveRatio: string; + list: { + coin: string; + userAssets: string; + platformAssets: string; + reserveRatio: string; + }[]; } ⋮---- -export interface OpenInterestLimitV3 { - symbol: string; - singleUserLimit: string; - masterSubLimit: string; - marketMakerLimit: string; +export interface IndexComponentV3 { + exchange: string; + spotPair: string; + equivalentPrice: string; + weight: string; } ⋮---- -export interface TaxRecordV3 { - id: string; - coin: string; - type: string; - amount: string; - fee: string; - balance: string; - ts: string; +export interface IndexPriceComponentsV3 { + symbol: string; + componentList: IndexComponentV3[]; } ================ @@ -9520,7 +10147,7 @@ File: README.md [1]: https://www.npmjs.com/package/bitget-api > [!TIP] -> Upcoming change: As part of the [Siebly.io](https://siebly.io/?ref=ghbitget) brand, this SDK will soon be hosted under the [Siebly.io GitHub organisation](https://github.com/sieblyio). The migration is seamless and requires no user changes. +> Upcoming change: As part of the [Siebly.io](https://siebly.io/) brand, this SDK will soon be hosted under the [Siebly.io GitHub organisation](https://github.com/sieblyio). The migration is seamless and requires no user changes. Updated & performant JavaScript & Node.js SDK for the Bitget V2 REST APIs and WebSockets: @@ -9549,6 +10176,7 @@ Updated & performant JavaScript & Node.js SDK for the Bitget V2 REST APIs and We - Real API calls in e2e tests. - Proxy support via axios integration. - Active community support & collaboration in telegram: [Node.js Algo Traders](https://t.me/nodetraders). +- QuickStart Guide: https://siebly.io/sdk/bitget/javascript ## Table of Contents @@ -9597,7 +10225,7 @@ Refer to the [examples](./examples) folder for implementation demos. Check out our JavaScript/TypeScript/Node.js SDKs & Projects: -- Visit our website: [https://Siebly.io](https://siebly.io/?ref=gh) +- Visit our website: [https://Siebly.io](https://siebly.io/) - Try our REST API & WebSocket SDKs published on npmjs: - [Bybit Node.js SDK: bybit-api](https://www.npmjs.com/package/bybit-api) - [Kraken Node.js SDK: @siebly/kraken-api](https://www.npmjs.com/package/@siebly/kraken-api) @@ -10148,7 +10776,15 @@ File: src/rest-client-v2.ts ================ import { FuturesProductTypeV2, MarginType } from './types/request/shared.js'; import { + AgentCustomerAssetRequestV2, + AgentCustomerDepositRequestV2, + AgentCustomerListRequestV2, + AgentCustomerTradeVolumeRequestV2, CreateSubAccountApiKeyRequestV2, + GetAgentCommissionDetailRequestV2, + GetAgentCustomerCommissionsRequestV2, + GetAgentCustomerKycResultRequestV2, + GetAgentSubCustomerListRequestV2, GetAllSubDepositWithdrawalRequestV2, GetBrokerCommissionsRequestV2, GetBrokerOrderCommissionRequestV2, @@ -10206,6 +10842,12 @@ import { } from './types/request/v2/copytrading.js'; import { BorrowLoanRequestV2, + RedeemEarnEliteRequestV2, + EarnEliteSubscribeRequestV2, + GetEarnEliteRecordsRequestV2, + GetEarnEliteRedeemInfoRequestV2, + GetEarnEliteSubscribeInfoRequestV2, + GetEarnEliteSubscribeResultRequestV2, GetEarnSavingsAssetsRequestV2, GetEarnSavingsRecordsRequestV2, GetLiquidationRecordsRequestV2, @@ -10301,6 +10943,14 @@ import { SpotWithdrawalRequestV2, } from './types/request/v2/spot.js'; import { + AgentCommissionDetailV2, + AgentCustomerAssetItemV2, + AgentCustomerCommissionsV2, + AgentCustomerDepositItemV2, + AgentCustomerKycResultV2, + AgentCustomerListItemV2, + AgentCustomerTradeVolumeItemV2, + AgentSubCustomerListV2, AllSubDepositWithdrawalRecordV2, BrokerCommissionV2, BrokerOrderCommissionV2, @@ -10381,6 +11031,14 @@ import { CTSpotTraderUnrealizedProfitV2, } from './types/response/v2/copy-trading.js'; import { + EarnEliteAssetsV2, + EarnEliteProductV2, + EarnEliteRecordsV2, + EarnEliteRedeemInfoV2, + RedeemEarnEliteResultV2, + EarnEliteSubscribeInfoV2, + EarnEliteSubscribeResultV2, + EarnEliteSubscribeStatusV2, EarnLoanCurrenciesV2, EarnLoanDebtsV2, EarnLoanHistoryV2, @@ -11808,6 +12466,44 @@ getBrokerRebateInfo( params: GetBrokerRebateInfoRequestV2, ): Promise> ⋮---- +/** + * + * * Broker | Agent (affiliate) customer APIs + * + */ +⋮---- +getAgentCustomerCommissions( + params?: GetAgentCustomerCommissionsRequestV2, +): Promise> +⋮---- +getAgentSubCustomerList( + params?: GetAgentSubCustomerListRequestV2, +): Promise> +⋮---- +getAgentCustomerTradeVolume( + params?: AgentCustomerTradeVolumeRequestV2, +): Promise> +⋮---- +getAgentCustomerList( + params?: AgentCustomerListRequestV2, +): Promise> +⋮---- +getAgentCustomerKycResult( + params?: GetAgentCustomerKycResultRequestV2, +): Promise> +⋮---- +getAgentCustomerDeposits( + params?: AgentCustomerDepositRequestV2, +): Promise> +⋮---- +getAgentCustomerAssets( + params?: AgentCustomerAssetRequestV2, +): Promise> +⋮---- +getAgentCommissionDetail( + params?: GetAgentCommissionDetailRequestV2, +): Promise> +⋮---- /** * * @@ -12506,6 +13202,42 @@ getEarnAccount(params?: { coin?: string }): Promise< > { 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> +⋮---- /** * * @@ -12663,6 +13395,14 @@ import { ModifyBrokerSubAccountRequestV3, ModifyBrokerSubApiKeyRequestV3, } from './types/request/v3/broker.js'; +import { + RedeemEarnEliteRequestV3, + EarnEliteSubscribeRequestV3, + GetEarnEliteRecordsRequestV3, + GetEarnEliteRedeemInfoRequestV3, + GetEarnEliteSubscribeInfoRequestV3, + GetEarnEliteSubscribeResultRequestV3, +} from './types/request/v3/earn.js'; import { BindUidRequestV3, GetEnsureCoinsRequestV3, @@ -12698,6 +13438,7 @@ import { GetOrderBookRequestV3, GetPositionTierRequestV3, GetPublicFillsRequestV3, + GetRiskReserveAllRequestV3, GetRiskReserveRequestV3, GetTickersRequestV3, } from './types/request/v3/public.js'; @@ -12763,6 +13504,20 @@ import { ModifyBrokerSubAccountResponseV3, ModifyBrokerSubApiKeyResponseV3, } from './types/response/v3/broker.js'; +import { + CopyFuturesPositionSummaryV3, + CopyFuturesTradingPairV3, +} from './types/response/v3/copytrading.js'; +import { + EarnEliteAssetsV3, + EarnEliteProductV3, + EarnEliteRecordsV3, + EarnEliteRedeemInfoV3, + RedeemEarnEliteResultV3, + EarnEliteSubscribeInfoV3, + EarnEliteSubscribeResultV3, + EarnEliteSubscribeStatusV3, +} from './types/response/v3/earn.js'; import { BindUidResponseV3, CoinInfoV3, @@ -12800,6 +13555,8 @@ import { PositionTierV3, ProofOfReservesV3, PublicFillV3, + RiskReserveAllV3, + RiskReserveHourV3, RiskReserveV3, TickerV3, } from './types/response/v3/public.js'; @@ -12965,6 +13722,20 @@ getRiskReserve( params: GetRiskReserveRequestV3, ): Promise> ⋮---- +/** + * Get Risk Reserve (Hourly) + */ +getRiskReserveHour( + params: GetRiskReserveRequestV3, +): Promise> +⋮---- +/** + * Get Risk Reserve All — current insurance funds + */ +getRiskReserveAll( + params: GetRiskReserveAllRequestV3, +): Promise> +⋮---- /** * Get Discount Rate */ @@ -12998,6 +13769,32 @@ getIndexComponents( params: GetIndexComponentsRequestV3, ): Promise> ⋮---- +/** + * + * =====Copy Trading | Futures===== + * + */ +⋮---- +/** + * Get copy-trading trading pair information + * + * Rate limit: 5/sec/UID. Permission: Unified Account — Futures Copy-Trading Orders — Read-only. + */ +getCopyFuturesTradingPairs(): Promise< + APIResponse + > { + return this.getPrivate('/api/v3/copy/futures/trading-pairs'); +⋮---- +/** + * Get copy-trading position summary + * + * Rate limit: 5/sec/UID. Permission: Unified Account — Futures Copy-Trading Positions — Read-only. + */ +getCopyFuturesPositionSummary(): Promise< + APIResponse + > { + return this.getPrivate('/api/v3/copy/futures/position-summary'); +⋮---- /** * * =====Account======= endpoints @@ -13807,13 +14604,47 @@ deleteBrokerSubApiKey( getBrokerSubApiKey( params: GetBrokerSubApiKeyRequestV3, ): Promise> +⋮---- +/** + * + * =====Earn | On-Chain Elite (UTA)===== + * + */ +⋮---- +getEarnEliteProducts(): Promise> +⋮---- +getEarnEliteAssets(): Promise> +⋮---- +getEarnEliteRecords( + params: GetEarnEliteRecordsRequestV3, +): Promise> +⋮---- +getEarnEliteSubscribeInfo( + params: GetEarnEliteSubscribeInfoRequestV3, +): Promise> +⋮---- +subscribeEarnElite( + params: EarnEliteSubscribeRequestV3, +): Promise> +⋮---- +getEarnEliteSubscribeResult( + params: GetEarnEliteSubscribeResultRequestV3, +): Promise> +⋮---- +getEarnEliteRedeemInfo( + params: GetEarnEliteRedeemInfoRequestV3, +): Promise> +⋮---- +redeemEarnElite( + params: RedeemEarnEliteRequestV3, +): Promise> ================ File: package.json ================ { "name": "bitget-api", - "version": "3.1.5", + "version": "3.1.7", "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 4195820..dad8aed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bitget-api", - "version": "3.1.6", + "version": "3.1.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bitget-api", - "version": "3.1.6", + "version": "3.1.7", "license": "MIT", "dependencies": { "axios": "^1.13.2", diff --git a/package.json b/package.json index 9c1ca28..d44b500 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bitget-api", - "version": "3.1.6", + "version": "3.1.7", "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 fcd0830..8cde3ea 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/earn.js'; export * from './types/request/v3/loan.js'; export * from './types/request/v3/public.js'; export * from './types/request/v3/strategy.js'; @@ -22,6 +23,8 @@ 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/copytrading.js'; +export * from './types/response/v3/earn.js'; export * from './types/response/v3/loan.js'; export * from './types/response/v3/public.js'; export * from './types/response/v3/strategy.js'; diff --git a/src/rest-client-v2.ts b/src/rest-client-v2.ts index 2a696c2..8dbe458 100644 --- a/src/rest-client-v2.ts +++ b/src/rest-client-v2.ts @@ -1,6 +1,14 @@ import { FuturesProductTypeV2, MarginType } from './types/request/shared.js'; import { + AgentCustomerAssetRequestV2, + AgentCustomerDepositRequestV2, + AgentCustomerListRequestV2, + AgentCustomerTradeVolumeRequestV2, CreateSubAccountApiKeyRequestV2, + GetAgentCommissionDetailRequestV2, + GetAgentCustomerCommissionsRequestV2, + GetAgentCustomerKycResultRequestV2, + GetAgentSubCustomerListRequestV2, GetAllSubDepositWithdrawalRequestV2, GetBrokerCommissionsRequestV2, GetBrokerOrderCommissionRequestV2, @@ -58,6 +66,11 @@ import { } from './types/request/v2/copytrading.js'; import { BorrowLoanRequestV2, + EarnEliteSubscribeRequestV2, + GetEarnEliteRecordsRequestV2, + GetEarnEliteRedeemInfoRequestV2, + GetEarnEliteSubscribeInfoRequestV2, + GetEarnEliteSubscribeResultRequestV2, GetEarnSavingsAssetsRequestV2, GetEarnSavingsRecordsRequestV2, GetLiquidationRecordsRequestV2, @@ -68,6 +81,7 @@ import { GetSharkfinAssetsRequestV2, GetSharkfinRecordsRequestV2, ModifyLoanPledgeRateRequestV2, + RedeemEarnEliteRequestV2, RedeemSavingsRequestV2, RepayLoanRequestV2, } from './types/request/v2/earn.js'; @@ -153,6 +167,14 @@ import { SpotWithdrawalRequestV2, } from './types/request/v2/spot.js'; import { + AgentCommissionDetailV2, + AgentCustomerAssetItemV2, + AgentCustomerCommissionsV2, + AgentCustomerDepositItemV2, + AgentCustomerKycResultV2, + AgentCustomerListItemV2, + AgentCustomerTradeVolumeItemV2, + AgentSubCustomerListV2, AllSubDepositWithdrawalRecordV2, BrokerCommissionV2, BrokerOrderCommissionV2, @@ -233,6 +255,13 @@ import { CTSpotTraderUnrealizedProfitV2, } from './types/response/v2/copy-trading.js'; import { + EarnEliteAssetsV2, + EarnEliteProductV2, + EarnEliteRecordsV2, + EarnEliteRedeemInfoV2, + EarnEliteSubscribeInfoV2, + EarnEliteSubscribeResultV2, + EarnEliteSubscribeStatusV2, EarnLoanCurrenciesV2, EarnLoanDebtsV2, EarnLoanHistoryV2, @@ -251,6 +280,7 @@ import { EarnSharkfinProductsV2, EarnSharkfinRecordsV2, EarnSharkfinSubscriptionDetailV2, + RedeemEarnEliteResultV2, } from './types/response/v2/earn.js'; import { FuturesAccountBillV2, @@ -2045,6 +2075,60 @@ export class RestClientV2 extends BaseRestClient { return this.getPrivate('/api/v2/broker/rebate-info', params); } + /** + * + * * Broker | Agent (affiliate) customer APIs + * + */ + + getAgentCustomerCommissions( + params?: GetAgentCustomerCommissionsRequestV2, + ): Promise> { + return this.getPrivate('/api/v2/broker/customer-commissions', params); + } + + getAgentSubCustomerList( + params?: GetAgentSubCustomerListRequestV2, + ): Promise> { + return this.getPrivate('/api/v2/broker/sub-customer-list', params); + } + + getAgentCustomerTradeVolume( + params?: AgentCustomerTradeVolumeRequestV2, + ): Promise> { + return this.postPrivate('/api/v2/broker/customer-trade-volume', params); + } + + getAgentCustomerList( + params?: AgentCustomerListRequestV2, + ): Promise> { + return this.postPrivate('/api/v2/broker/customer-list', params); + } + + getAgentCustomerKycResult( + params?: GetAgentCustomerKycResultRequestV2, + ): Promise> { + return this.getPrivate('/api/v2/broker/customer-kyc-result', params); + } + + getAgentCustomerDeposits( + params?: AgentCustomerDepositRequestV2, + ): Promise> { + return this.postPrivate('/api/v2/broker/customer-deposit', params); + } + + getAgentCustomerAssets( + params?: AgentCustomerAssetRequestV2, + ): Promise> { + return this.postPrivate('/api/v2/broker/customer-asset', params); + } + + getAgentCommissionDetail( + params?: GetAgentCommissionDetailRequestV2, + ): Promise> { + return this.getPrivate('/api/v2/broker/agent-commission', params); + } + /** * * @@ -3023,6 +3107,58 @@ export class RestClientV2 extends BaseRestClient { return this.getPrivate('/api/v2/earn/account/assets', params); } + /** + * + * + * Earn | On-Chain Elite + * + * + */ + + getEarnEliteProducts(): Promise> { + return this.getPrivate('/api/v2/earn/elite/product'); + } + + getEarnEliteAssets(): Promise> { + return this.getPrivate('/api/v2/earn/elite/assets'); + } + + getEarnEliteRecords( + params: GetEarnEliteRecordsRequestV2, + ): Promise> { + return this.getPrivate('/api/v2/earn/elite/records', params); + } + + getEarnEliteSubscribeInfo( + params: GetEarnEliteSubscribeInfoRequestV2, + ): Promise> { + return this.getPrivate('/api/v2/earn/elite/subscribe-info', params); + } + + subscribeEarnElite( + params: EarnEliteSubscribeRequestV2, + ): Promise> { + return this.postPrivate('/api/v2/earn/elite/subscribe', params); + } + + getEarnEliteSubscribeResult( + params: GetEarnEliteSubscribeResultRequestV2, + ): Promise> { + return this.getPrivate('/api/v2/earn/elite/subscribe-result', params); + } + + getEarnEliteRedeemInfo( + params: GetEarnEliteRedeemInfoRequestV2, + ): Promise> { + return this.getPrivate('/api/v2/earn/elite/redeem-info', params); + } + + redeemEarnElite( + params: RedeemEarnEliteRequestV2, + ): Promise> { + return this.postPrivate('/api/v2/earn/elite/redeem', params); + } + /** * * diff --git a/src/rest-client-v3.ts b/src/rest-client-v3.ts index fcc6513..ab07da4 100644 --- a/src/rest-client-v3.ts +++ b/src/rest-client-v3.ts @@ -42,6 +42,14 @@ import { ModifyBrokerSubAccountRequestV3, ModifyBrokerSubApiKeyRequestV3, } from './types/request/v3/broker.js'; +import { + EarnEliteSubscribeRequestV3, + GetEarnEliteRecordsRequestV3, + GetEarnEliteRedeemInfoRequestV3, + GetEarnEliteSubscribeInfoRequestV3, + GetEarnEliteSubscribeResultRequestV3, + RedeemEarnEliteRequestV3, +} from './types/request/v3/earn.js'; import { BindUidRequestV3, GetEnsureCoinsRequestV3, @@ -77,6 +85,7 @@ import { GetOrderBookRequestV3, GetPositionTierRequestV3, GetPublicFillsRequestV3, + GetRiskReserveAllRequestV3, GetRiskReserveRequestV3, GetTickersRequestV3, } from './types/request/v3/public.js'; @@ -142,6 +151,20 @@ import { ModifyBrokerSubAccountResponseV3, ModifyBrokerSubApiKeyResponseV3, } from './types/response/v3/broker.js'; +import { + CopyFuturesPositionSummaryV3, + CopyFuturesTradingPairV3, +} from './types/response/v3/copytrading.js'; +import { + EarnEliteAssetsV3, + EarnEliteProductV3, + EarnEliteRecordsV3, + EarnEliteRedeemInfoV3, + EarnEliteSubscribeInfoV3, + EarnEliteSubscribeResultV3, + EarnEliteSubscribeStatusV3, + RedeemEarnEliteResultV3, +} from './types/response/v3/earn.js'; import { BindUidResponseV3, CoinInfoV3, @@ -179,6 +202,8 @@ import { PositionTierV3, ProofOfReservesV3, PublicFillV3, + RiskReserveAllV3, + RiskReserveHourV3, RiskReserveV3, TickerV3, } from './types/response/v3/public.js'; @@ -419,6 +444,24 @@ export class RestClientV3 extends BaseRestClient { return this.get('/api/v3/market/risk-reserve', params); } + /** + * Get Risk Reserve (Hourly) + */ + getRiskReserveHour( + params: GetRiskReserveRequestV3, + ): Promise> { + return this.get('/api/v3/market/risk-reserve-hour', params); + } + + /** + * Get Risk Reserve All — current insurance funds + */ + getRiskReserveAll( + params: GetRiskReserveAllRequestV3, + ): Promise> { + return this.get('/api/v3/market/risk-reserve-all', params); + } + /** * Get Discount Rate */ @@ -462,6 +505,34 @@ export class RestClientV3 extends BaseRestClient { return this.get('/api/v3/market/index-components', params); } + /** + * + * =====Copy Trading | Futures===== + * + */ + + /** + * Get copy-trading trading pair information + * + * Rate limit: 5/sec/UID. Permission: Unified Account — Futures Copy-Trading Orders — Read-only. + */ + getCopyFuturesTradingPairs(): Promise< + APIResponse + > { + return this.getPrivate('/api/v3/copy/futures/trading-pairs'); + } + + /** + * Get copy-trading position summary + * + * Rate limit: 5/sec/UID. Permission: Unified Account — Futures Copy-Trading Positions — Read-only. + */ + getCopyFuturesPositionSummary(): Promise< + APIResponse + > { + return this.getPrivate('/api/v3/copy/futures/position-summary'); + } + /** * * =====Account======= endpoints @@ -1432,4 +1503,54 @@ export class RestClientV3 extends BaseRestClient { ): Promise> { return this.getPrivate('/api/v3/broker/query-sub-apikey', params); } + + /** + * + * =====Earn | On-Chain Elite (UTA)===== + * + */ + + getEarnEliteProducts(): Promise> { + return this.getPrivate('/api/v3/earn/elite-product'); + } + + getEarnEliteAssets(): Promise> { + return this.getPrivate('/api/v3/earn/elite-assets'); + } + + getEarnEliteRecords( + params: GetEarnEliteRecordsRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/elite-records', params); + } + + getEarnEliteSubscribeInfo( + params: GetEarnEliteSubscribeInfoRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/elite-subscribe-info', params); + } + + subscribeEarnElite( + params: EarnEliteSubscribeRequestV3, + ): Promise> { + return this.postPrivate('/api/v3/earn/elite-subscribe', params); + } + + getEarnEliteSubscribeResult( + params: GetEarnEliteSubscribeResultRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/elite-subscribe-result', params); + } + + getEarnEliteRedeemInfo( + params: GetEarnEliteRedeemInfoRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/elite-redeem-info', params); + } + + redeemEarnElite( + params: RedeemEarnEliteRequestV3, + ): Promise> { + return this.postPrivate('/api/v3/earn/elite-redeem', params); + } } diff --git a/src/types/request/v2/broker.ts b/src/types/request/v2/broker.ts index 1e8e272..8828782 100644 --- a/src/types/request/v2/broker.ts +++ b/src/types/request/v2/broker.ts @@ -193,3 +193,80 @@ export interface GetBrokerOrderCommissionRequestV2 { export interface GetBrokerRebateInfoRequestV2 { uid: string; } + +/** + * + * * Broker | Agent (affiliate) customer APIs + * + */ + +export interface GetAgentCustomerCommissionsRequestV2 { + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + uid?: string; + coin?: string; + symbol?: string; + showSub?: 'yes' | 'no'; +} + +export interface GetAgentSubCustomerListRequestV2 { + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + uid?: string; + showSub?: 'yes' | 'no'; +} + +export interface AgentCustomerTradeVolumeRequestV2 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; +} + +export interface AgentCustomerListRequestV2 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + referralCode?: string; + showSub?: 'yes' | 'no'; +} + +export interface GetAgentCustomerKycResultRequestV2 { + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + uid?: string; + showSub?: 'yes' | 'no'; +} + +export interface AgentCustomerDepositRequestV2 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; +} + +export interface AgentCustomerAssetRequestV2 { + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; +} + +export interface GetAgentCommissionDetailRequestV2 { + startTime?: string; + endTime?: string; + limit?: string; + idLessThan?: string; +} diff --git a/src/types/request/v2/earn.ts b/src/types/request/v2/earn.ts index 30687b9..6e5cfbc 100644 --- a/src/types/request/v2/earn.ts +++ b/src/types/request/v2/earn.ts @@ -134,3 +134,48 @@ export interface GetLiquidationRecordsRequestV2 { pageNo?: string; pageSize?: string; } + +/** + * + * + * 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; +} diff --git a/src/types/request/v3/earn.ts b/src/types/request/v3/earn.ts new file mode 100644 index 0000000..31b14b4 --- /dev/null +++ b/src/types/request/v3/earn.ts @@ -0,0 +1,44 @@ +/** + * + * + * Earn | On-Chain Elite (UTA) + * + * + */ + +export interface GetEarnEliteRecordsRequestV3 { + type: 'subscribe' | 'redeem' | 'interest'; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; +} + +export interface GetEarnEliteSubscribeInfoRequestV3 { + productId: string; +} + +export interface EarnEliteSubscribeRequestV3 { + productSubId: string; + amount: string; + coin?: string; + paymentAccount?: 'spot' | 'unified'; +} + +export interface GetEarnEliteSubscribeResultRequestV3 { + orderId: string; +} + +export interface GetEarnEliteRedeemInfoRequestV3 { + productId: string; +} + +export interface RedeemEarnEliteRequestV3 { + productId: string; + productSubId: string; + redeemType: 'fast' | 'standard'; + amount: string; + receiveAccount: 'spot' | 'unified'; + advancedSettle?: 'yes' | 'no'; + coin?: string; +} diff --git a/src/types/request/v3/public.ts b/src/types/request/v3/public.ts index 3da021d..e10210e 100644 --- a/src/types/request/v3/public.ts +++ b/src/types/request/v3/public.ts @@ -83,6 +83,11 @@ export interface GetPositionTierRequestV3 { 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 { diff --git a/src/types/response/v2/broker.ts b/src/types/response/v2/broker.ts index 3c7587d..6bf93c7 100644 --- a/src/types/response/v2/broker.ts +++ b/src/types/response/v2/broker.ts @@ -276,3 +276,120 @@ export interface BrokerRebateInfoV2 { clientSpotRebateRatio: string; clientFuturesRebateRatio: 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; + 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 AgentCustomerCommissionsV2 { + endId: string; + commissionList: AgentCustomerCommissionItemV2[]; +} + +export interface AgentSubCustomerItemV2 { + uid: string; + registerTime: string; +} + +export interface AgentSubCustomerListV2 { + list: AgentSubCustomerItemV2[]; + minId: string; +} + +export interface AgentCustomerTradeVolumeItemV2 { + uid: string; + /** API field name (Bitget spelling). */ + volumn: string; + spotVolume: string; + futuresVolume: string; + time: string; +} + +export interface AgentCustomerListItemV2 { + uid: string; + registerTime: string; +} + +export interface AgentCustomerKycItemV2 { + uid: string; + kycResult: 'passed' | 'not_passed' | string; +} + +export interface AgentCustomerKycResultV2 { + userList: AgentCustomerKycItemV2[]; + endId: string; +} + +export interface AgentCustomerDepositItemV2 { + orderId: string; + uid: string; + depositTime: string; + depositCoin: string; + depositAmount: string; +} + +export interface AgentCustomerAssetItemV2 { + balance: string; + uid: string; + uTime: string; + remark: string; +} + +export interface AgentCommissionDetailItemV2 { + uid: string; + bizType: 'spot' | 'futures' | string; + subBizType: string; + symbol: string; + coin: string; + fee: string; + volume: string; + activityBonusDeduct: string; + spotCouponDeduct: string; + futuresCouponDeduct: string; + spotFeeDiscountDeduct: string; + negativeMakerFeeDeduct: string; + feePaid: string; + directCommission: string; + subCommission: string; + partnerCommission: string; + partnerActualCommission: string; + traderType: string; + apiType: string; + status: 'settled' | 'unsettled' | 'notIssued' | string; + startCalculationTime: string; + endCalculationTime: string; +} + +export interface AgentCommissionDetailV2 { + endId: string; + commissionList: AgentCommissionDetailItemV2[]; +} diff --git a/src/types/response/v2/earn.ts b/src/types/response/v2/earn.ts index a5dcdab..225103b 100644 --- a/src/types/response/v2/earn.ts +++ b/src/types/response/v2/earn.ts @@ -320,3 +320,133 @@ export interface EarnLoanLiquidationRecordsV2 { runlockAmount: string; repayLoanAmount: string; } + +/** + * + * + * Earn | On-Chain Elite + * + * + */ + +export interface EarnEliteSubscriptionCoinV2 { + subscriptionCoin: string; + precision: string; + feeRate: string; + exchangeRate: string; + remainQuota?: string; + minAmount?: string; +} + +export interface EarnEliteProductV2 { + productId: string; + coin: string; + minApr: string; + maxApr: string; + subscriptionCoinList: EarnEliteSubscriptionCoinV2[]; + sellOut: 'YES' | 'NO' | string; +} + +export interface EarnEliteAssetProjectV2 { + projectName: string; +} + +export interface EarnEliteAssetV2 { + productId: string; + productCoin: string; + holdingAmount: string; + usdtHoldingAmount: string; + exchangeRate: string; + apr: string; + minApy?: string; + maxApy?: string; + subscriptionCoin: string; + exchangeAmount: string; + projectList?: EarnEliteAssetProjectV2[]; + unsettledBGPoints: string; + interestCoin: string; + totalProfit: string; +} + +export interface EarnEliteAssetsV2 { + resultList: EarnEliteAssetV2[]; +} + +export interface EarnEliteRecordV2 { + recordId: string; + productId: string; + coin: string; + status: string; + exchangeRate: string; + receivedCoin: string; + receivedAmount: string; + investAmount: string; + feeRate: string; + redeemType?: string | string[]; + receivingAccount: string; + actualReceivingAccount: string; + paymentAccount?: string[]; + settlePoints: string; + fee: string; +} + +export interface EarnEliteRecordsV2 { + recordList: EarnEliteRecordV2[]; + endId: string; +} + +export interface EarnEliteSubscribeInfoV2 { + productSubId: string; + minAmount: string; + remainQuota: string; + exchangeRate: string; + productCoin: string; + interestTime: string; + settleTime: string; + precision: string; + feeRate: string; + /** Present for BGUSD per API docs. */ + subscriptionCoinList?: EarnEliteSubscriptionCoinV2[]; +} + +export interface EarnEliteSubscribeResultV2 { + orderId: string; +} + +export interface EarnEliteSubscribeStatusV2 { + result: 'settled' | 'pending' | 'rejected' | string; +} + +export interface EarnEliteRedeemInfoBgusdReceiveCoinV2 { + bgusdReceiveCoin: string; + bgusdExchangeRate: string; +} + +export interface EarnEliteRedeemModeV2 { + redeemFeeRate: string; + remainQuota: string; + redeemType: 'fast' | 'standard' | string; + redeemScale: string; + redeemDelayDate: string; + minRedeemAmount: string; + redeemTime: string; +} + +export interface EarnEliteRedeemInfoV2 { + productId: string; + productSubId: string; + productCoin: string; + subscriptionCoin: string; + profitCoin: string; + exchangeRate: string; + totalUnPayInterestAmount: string; + preSettleApr: string; + receivedCoin: string; + unsettledPoints: string; + bgusdReceiveCoinList: EarnEliteRedeemInfoBgusdReceiveCoinV2[]; + redeemModeList: EarnEliteRedeemModeV2[]; +} + +export interface RedeemEarnEliteResultV2 { + orderId: string; +} diff --git a/src/types/response/v2/spot.ts b/src/types/response/v2/spot.ts index f99bff7..d7778d0 100644 --- a/src/types/response/v2/spot.ts +++ b/src/types/response/v2/spot.ts @@ -46,6 +46,8 @@ export interface SpotSymbolInfoV2 { sellLimitPriceRatio: string; orderQuantity: string; areaSymbol: string; + maxLimitOrderValue?: string; + maxMarketOrderValue?: string; } export interface SpotVipFeeRateV2 { diff --git a/src/types/response/v3/copytrading.ts b/src/types/response/v3/copytrading.ts new file mode 100644 index 0000000..30d99ea --- /dev/null +++ b/src/types/response/v3/copytrading.ts @@ -0,0 +1,37 @@ +/** + * + * + * 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 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; +} diff --git a/src/types/response/v3/earn.ts b/src/types/response/v3/earn.ts new file mode 100644 index 0000000..e38a1dc --- /dev/null +++ b/src/types/response/v3/earn.ts @@ -0,0 +1,128 @@ +/** + * + * + * Earn | On-Chain Elite (UTA) + * + * + */ + +export interface EarnEliteSubscriptionCoinV3 { + subscriptionCoin: string; + precision: string; + feeRate: string; + exchangeRate: string; + remainQuota?: string; + minAmount?: string; +} + +export interface EarnEliteProductV3 { + productId: string; + coin: string; + minApr: string; + maxApr: string; + subscriptionCoinList: EarnEliteSubscriptionCoinV3[]; + sellOut: 'YES' | 'NO' | string; +} + +export interface EarnEliteAssetProjectV3 { + projectName: string; +} + +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 EarnEliteAssetsV3 { + resultList: EarnEliteAssetV3[]; +} + +export interface EarnEliteRecordV3 { + recordId: string; + productId: string; + coin: string; + status: string; + exchangeRate: string; + receivedCoin: string; + receivedAmount: string; + investAmount: string; + feeRate: string; + redeemType?: string | string[]; + receivingAccount: string; + actualReceivingAccount: string; + paymentAccount?: string[]; + settlePoints: string; + fee: string; +} + +export interface EarnEliteRecordsV3 { + recordList: EarnEliteRecordV3[]; + endId: 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 EarnEliteSubscribeResultV3 { + orderId: string; +} + +export interface EarnEliteSubscribeStatusV3 { + result: 'settled' | 'pending' | 'rejected' | string; +} + +export interface EarnEliteRedeemInfoBgusdReceiveCoinV3 { + bgusdReceiveCoin: string; + bgusdExchangeRate: string; +} + +export interface EarnEliteRedeemModeV3 { + redeemFeeRate: string; + remainQuota: string; + redeemType: 'fast' | 'standard' | string; + redeemScale: string; + redeemDelayDate: string; + minRedeemAmount: string; + redeemTime: 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 RedeemEarnEliteResultV3 { + orderId: string; +} diff --git a/src/types/response/v3/public.ts b/src/types/response/v3/public.ts index 897f2e4..d53f851 100644 --- a/src/types/response/v3/public.ts +++ b/src/types/response/v3/public.ts @@ -75,13 +75,36 @@ export interface RiskReserveRecordV3 { balance: string; amount: string; ts: string; + type?: string; } export interface RiskReserveV3 { + totalBalance?: string; coin: string; riskReserveRecords: RiskReserveRecordV3[]; } +export interface RiskReserveHourRecordV3 { + amount: string; + balance: string; + ts: string; +} + +export interface RiskReserveHourV3 { + coin: string; + riskReserveRecords: RiskReserveHourRecordV3[]; +} + +export interface RiskReserveAllItemV3 { + symbols: string[]; + coin: string; + balance: string; +} + +export interface RiskReserveAllV3 { + list: RiskReserveAllItemV3[]; +} + export interface InstrumentV3 { symbol: string; category: