From 70d492a489c1bc8e2383d90ca4c6e3d9c01b5c69 Mon Sep 17 00:00:00 2001 From: JJ-Cro Date: Tue, 11 Aug 2026 12:24:08 +0200 Subject: [PATCH 1/3] feat(1.6.2): add stock API support - Introduced stock-related request and response types in the API. - Added new examples for stock order management, including creating, canceling, and retrieving stock orders and transactions. - Updated the RestClient to support stock API endpoints. - Incremented version to 1.6.2 in package.json and package-lock.json. --- docs/endpointFunctionList.md | 861 +- .../apidoc/RestClient/cancelAllStockOrders.js | 22 + .../RestClient/cancelBatchCrossExOrders.js | 22 + .../apidoc/RestClient/cancelSpotPovOrder.js | 22 + .../apidoc/RestClient/cancelSpotPovOrders.js | 22 + .../apidoc/RestClient/cancelStockOrder.js | 22 + .../apidoc/RestClient/closeStockPosition.js | 22 + .../apidoc/RestClient/createSpotPovOrder.js | 22 + .../apidoc/RestClient/createStockOrder.js | 22 + .../RestClient/createStockTransaction.js | 22 + examples/apidoc/RestClient/getSpotPovOrder.js | 22 + .../apidoc/RestClient/getStockExchanges.js | 22 + examples/apidoc/RestClient/getStockFeeRate.js | 22 + .../apidoc/RestClient/getStockOrderBook.js | 22 + .../apidoc/RestClient/getStockOrderHistory.js | 22 + examples/apidoc/RestClient/getStockOrders.js | 22 + .../apidoc/RestClient/getStockPositions.js | 22 + .../apidoc/RestClient/getStockSymbolDetail.js | 22 + examples/apidoc/RestClient/getStockSymbols.js | 22 + .../apidoc/RestClient/getStockTransactions.js | 22 + .../apidoc/RestClient/getStockUserAssets.js | 22 + .../RestClient/getTradFiSymbolCommissions.js | 22 + examples/apidoc/RestClient/getTransfer.js | 22 + .../listCrossExMarketFundingInfo.js | 22 + .../RestClient/listCrossExMarketTickers.js | 22 + .../apidoc/RestClient/listSpotPovOrders.js | 22 + examples/apidoc/RestClient/setUserLeverage.js | 22 + .../apidoc/RestClient/updateStockOrder.js | 22 + llms.txt | 13434 ++++++++++------ package-lock.json | 4 +- package.json | 2 +- src/RestClient.ts | 381 + src/index.ts | 2 + src/types/request/crossex.ts | 16 +- src/types/request/otc.ts | 16 +- src/types/request/spot.ts | 26 + src/types/request/stock.ts | 81 + src/types/request/tradfi.ts | 6 + src/types/request/unified.ts | 5 + src/types/request/wallet.ts | 5 + src/types/response/crossex.ts | 34 + src/types/response/otc.ts | 8 +- src/types/response/spot.ts | 27 + src/types/response/stock.ts | 219 + src/types/response/tradfi.ts | 6 + src/types/response/unified.ts | 6 + src/types/response/wallet.ts | 24 + 47 files changed, 10043 insertions(+), 5714 deletions(-) create mode 100644 examples/apidoc/RestClient/cancelAllStockOrders.js create mode 100644 examples/apidoc/RestClient/cancelBatchCrossExOrders.js create mode 100644 examples/apidoc/RestClient/cancelSpotPovOrder.js create mode 100644 examples/apidoc/RestClient/cancelSpotPovOrders.js create mode 100644 examples/apidoc/RestClient/cancelStockOrder.js create mode 100644 examples/apidoc/RestClient/closeStockPosition.js create mode 100644 examples/apidoc/RestClient/createSpotPovOrder.js create mode 100644 examples/apidoc/RestClient/createStockOrder.js create mode 100644 examples/apidoc/RestClient/createStockTransaction.js create mode 100644 examples/apidoc/RestClient/getSpotPovOrder.js create mode 100644 examples/apidoc/RestClient/getStockExchanges.js create mode 100644 examples/apidoc/RestClient/getStockFeeRate.js create mode 100644 examples/apidoc/RestClient/getStockOrderBook.js create mode 100644 examples/apidoc/RestClient/getStockOrderHistory.js create mode 100644 examples/apidoc/RestClient/getStockOrders.js create mode 100644 examples/apidoc/RestClient/getStockPositions.js create mode 100644 examples/apidoc/RestClient/getStockSymbolDetail.js create mode 100644 examples/apidoc/RestClient/getStockSymbols.js create mode 100644 examples/apidoc/RestClient/getStockTransactions.js create mode 100644 examples/apidoc/RestClient/getStockUserAssets.js create mode 100644 examples/apidoc/RestClient/getTradFiSymbolCommissions.js create mode 100644 examples/apidoc/RestClient/getTransfer.js create mode 100644 examples/apidoc/RestClient/listCrossExMarketFundingInfo.js create mode 100644 examples/apidoc/RestClient/listCrossExMarketTickers.js create mode 100644 examples/apidoc/RestClient/listSpotPovOrders.js create mode 100644 examples/apidoc/RestClient/setUserLeverage.js create mode 100644 examples/apidoc/RestClient/updateStockOrder.js create mode 100644 src/types/request/stock.ts create mode 100644 src/types/response/stock.ts diff --git a/docs/endpointFunctionList.md b/docs/endpointFunctionList.md index 81f0e6d..c523b89 100644 --- a/docs/endpointFunctionList.md +++ b/docs/endpointFunctionList.md @@ -49,423 +49,450 @@ This table includes all endpoints from the official Exchange API docs and corres | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [getSystemMaintenanceStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L657) | | GET | `/v1/public/system_info` | -| [submitWithdrawal()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L674) | :closed_lock_with_key: | POST | `/withdrawals` | -| [submitSpotMainAccountTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L688) | :closed_lock_with_key: | POST | `/withdrawals/push` | -| [cancelWithdrawal()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L704) | :closed_lock_with_key: | DELETE | `/withdrawals/{withdrawal_id}` | -| [getCurrencyChains()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L721) | | GET | `/wallet/currency_chains` | -| [createDepositAddress()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L731) | :closed_lock_with_key: | GET | `/wallet/deposit_address` | -| [getWithdrawalRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L745) | :closed_lock_with_key: | GET | `/wallet/withdrawals` | -| [getDepositRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L759) | :closed_lock_with_key: | GET | `/wallet/deposits` | -| [submitTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L778) | :closed_lock_with_key: | POST | `/wallet/transfers` | -| [submitMainSubTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L790) | :closed_lock_with_key: | POST | `/wallet/sub_account_transfers` | -| [getMainSubTransfers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L804) | :closed_lock_with_key: | GET | `/wallet/sub_account_transfers` | -| [submitSubToSubTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L818) | :closed_lock_with_key: | POST | `/wallet/sub_account_to_sub_account` | -| [getTransferStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L833) | :closed_lock_with_key: | GET | `/wallet/order_status` | -| [getWithdrawalStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L849) | :closed_lock_with_key: | GET | `/wallet/withdraw_status` | -| [getSubBalance()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L861) | :closed_lock_with_key: | GET | `/wallet/sub_account_balances` | -| [getSubMarginBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L873) | :closed_lock_with_key: | GET | `/wallet/sub_account_margin_balances` | -| [getSubFuturesBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L885) | :closed_lock_with_key: | GET | `/wallet/sub_account_futures_balances` | -| [getSubCrossMarginBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L898) | :closed_lock_with_key: | GET | `/wallet/sub_account_cross_margin_balances` | -| [getSavedAddresses()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L910) | :closed_lock_with_key: | GET | `/wallet/saved_address` | -| [getTradingFees()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L920) | :closed_lock_with_key: | GET | `/wallet/fee` | -| [getBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L941) | :closed_lock_with_key: | GET | `/wallet/total_balance` | -| [getSmallBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L950) | :closed_lock_with_key: | GET | `/wallet/small_balance` | -| [convertSmallBalance()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L960) | :closed_lock_with_key: | POST | `/wallet/small_balance` | -| [getSmallBalanceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L973) | :closed_lock_with_key: | GET | `/wallet/small_balance_history` | -| [getPushOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L985) | :closed_lock_with_key: | GET | `/wallet/push` | -| [getLowCapExchangeList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L994) | :closed_lock_with_key: | GET | `/wallet/getLowCapExchangeList` | -| [createSubAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1009) | :closed_lock_with_key: | POST | `/sub_accounts` | -| [getSubAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1020) | :closed_lock_with_key: | GET | `/sub_accounts` | -| [getSubAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1030) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}` | -| [createSubAccountApiKey()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1040) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/keys` | -| [getSubAccountApiKeys()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1053) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}/keys` | -| [updateSubAccountApiKey()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1067) | :closed_lock_with_key: | PUT | `/sub_accounts/{user_id}/keys/{key}` | -| [deleteSubAccountApiKey()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1078) | :closed_lock_with_key: | DELETE | `/sub_accounts/{user_id}/keys/{key}` | -| [getSubAccountApiKey()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1093) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}/keys/{key}` | -| [lockSubAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1108) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/lock` | -| [unlockSubAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1118) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/unlock` | -| [getSubAccountMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1132) | :closed_lock_with_key: | GET | `/sub_accounts/unified_mode` | -| [getUnifiedAccountInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1151) | :closed_lock_with_key: | GET | `/unified/accounts` | -| [getUnifiedMaxBorrow()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1167) | :closed_lock_with_key: | GET | `/unified/borrowable` | -| [getUnifiedMaxTransferable()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1183) | :closed_lock_with_key: | GET | `/unified/transferable` | -| [getUnifiedMaxTransferables()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1198) | :closed_lock_with_key: | GET | `/unified/transferables` | -| [getUnifiedBatchMaxBorrowable()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1207) | :closed_lock_with_key: | GET | `/unified/batch_borrowable` | -| [submitUnifiedBorrowOrRepay()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1225) | :closed_lock_with_key: | POST | `/unified/loans` | -| [getUnifiedLoans()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1237) | :closed_lock_with_key: | GET | `/unified/loans` | -| [getUnifiedLoanRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1247) | :closed_lock_with_key: | GET | `/unified/loan_records` | -| [getUnifiedInterestRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1259) | :closed_lock_with_key: | GET | `/unified/interest_records` | -| [getUnifiedRiskUnitDetails()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1270) | :closed_lock_with_key: | GET | `/unified/risk_units` | -| [setUnifiedAccountMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1282) | :closed_lock_with_key: | PUT | `/unified/unified_mode` | -| [getUnifiedAccountMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1291) | :closed_lock_with_key: | GET | `/unified/unified_mode` | -| [getUnifiedEstimateRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1303) | :closed_lock_with_key: | GET | `/unified/estimate_rate` | -| [getUnifiedCurrencyDiscountTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1314) | | GET | `/unified/currency_discount_tiers` | -| [getLoanMarginTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1326) | | GET | `/unified/loan_margin_tiers` | -| [portfolioMarginCalculate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1343) | | POST | `/unified/portfolio_calculator` | -| [getUserCurrencyLeverageConfig()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1357) | :closed_lock_with_key: | GET | `/unified/leverage/user_currency_config` | -| [getUserCurrencyLeverageSettings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1371) | :closed_lock_with_key: | GET | `/unified/leverage/user_currency_setting` | -| [updateUserCurrencyLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1386) | :closed_lock_with_key: | POST | `/unified/leverage/user_currency_setting` | -| [getUnifiedLoanCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1401) | :closed_lock_with_key: | GET | `/unified/currencies` | -| [getHistoricalLendingRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1413) | :closed_lock_with_key: | GET | `/unified/history_loan_rate` | -| [submitUnifiedLoanRepay()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1419) | :closed_lock_with_key: | POST | `/unified/loans/repay` | -| [getEstimatedQuickRepayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1426) | :closed_lock_with_key: | GET | `/unified/estimated_quick_repayment` | -| [createQuickRepayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1433) | :closed_lock_with_key: | POST | `/unified/quick_repayment` | -| [setUnifiedDeltaNeutral()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1444) | :closed_lock_with_key: | POST | `/unified/delta_neutral` | -| [getUnifiedDeltaNeutral()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1453) | :closed_lock_with_key: | GET | `/unified/delta_neutral` | -| [getSpotCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1473) | | GET | `/spot/currencies` | -| [getSpotCurrency()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1483) | | GET | `/spot/currencies/{currency}` | -| [getSpotCurrencyPairs()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1492) | | GET | `/spot/currency_pairs` | -| [getSpotCurrencyPair()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1502) | | GET | `/spot/currency_pairs/{currency_pair}` | -| [getSpotTicker()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1516) | | GET | `/spot/tickers` | -| [getSpotOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1531) | | GET | `/spot/order_book` | -| [getSpotTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1544) | | GET | `/spot/trades` | -| [getSpotCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1556) | | GET | `/spot/candlesticks` | -| [getSpotFeeRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1568) | :closed_lock_with_key: | GET | `/spot/fee` | -| [getSpotBatchFeeRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1577) | :closed_lock_with_key: | GET | `/spot/batch_fee` | -| [getSpotAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1589) | :closed_lock_with_key: | GET | `/spot/accounts` | -| [getSpotAccountBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1601) | :closed_lock_with_key: | GET | `/spot/account_book` | -| [submitSpotBatchOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1620) | :closed_lock_with_key: | POST | `/spot/batch_orders` | -| [getSpotOpenOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1647) | :closed_lock_with_key: | GET | `/spot/open_orders` | -| [submitSpotClosePosCrossDisabled()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1663) | :closed_lock_with_key: | POST | `/spot/cross_liquidate_orders` | -| [submitSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1679) | :closed_lock_with_key: | POST | `/spot/orders` | -| [getSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1696) | :closed_lock_with_key: | GET | `/spot/orders` | -| [cancelSpotOpenOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1711) | :closed_lock_with_key: | DELETE | `/spot/orders` | -| [batchCancelSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1739) | :closed_lock_with_key: | POST | `/spot/cancel_batch_orders` | -| [getSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1764) | :closed_lock_with_key: | GET | `/spot/orders/{order_id}` | -| [updateSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1781) | :closed_lock_with_key: | PATCH | `/spot/orders/{order_id}` | -| [cancelSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1809) | :closed_lock_with_key: | DELETE | `/spot/orders/{order_id}` | -| [getSpotTradingHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1838) | :closed_lock_with_key: | GET | `/spot/my_trades` | -| [submitSpotCountdownOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1867) | :closed_lock_with_key: | POST | `/spot/countdown_cancel_all` | -| [batchUpdateSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1886) | :closed_lock_with_key: | POST | `/spot/amend_batch_orders` | -| [getSpotInsuranceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1913) | :closed_lock_with_key: | GET | `/spot/insurance_history` | -| [submitSpotPriceTriggerOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1927) | :closed_lock_with_key: | POST | `/spot/price_orders` | -| [getSpotAutoOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1939) | :closed_lock_with_key: | GET | `/spot/price_orders` | -| [cancelAllOpenSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1951) | :closed_lock_with_key: | DELETE | `/spot/price_orders` | -| [getPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1964) | :closed_lock_with_key: | GET | `/spot/price_orders/{order_id}` | -| [cancelSpotTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1976) | :closed_lock_with_key: | DELETE | `/spot/price_orders/{order_id}` | -| [setCollateralCurrency()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1990) | :closed_lock_with_key: | POST | `/unified/collateral_currencies` | -| [getMarginAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2011) | :closed_lock_with_key: | GET | `/margin/accounts` | -| [getMarginBalanceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2025) | :closed_lock_with_key: | GET | `/margin/account_book` | -| [getFundingAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2043) | :closed_lock_with_key: | GET | `/margin/funding_accounts` | -| [updateAutoRepaymentSetting()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2061) | :closed_lock_with_key: | POST | `/margin/auto_repay` | -| [getAutoRepaymentSetting()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2072) | :closed_lock_with_key: | GET | `/margin/auto_repay` | -| [getMarginTransferableAmount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2086) | :closed_lock_with_key: | GET | `/margin/transferable` | -| [getCrossMarginCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2103) | | GET | `/margin/cross/currencies` | -| [getCrossMarginCurrency()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2114) | | GET | `/margin/cross/currencies/{currency}` | -| [getCrossMarginAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2126) | :closed_lock_with_key: | GET | `/margin/cross/accounts` | -| [getCrossMarginAccountHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2139) | :closed_lock_with_key: | GET | `/margin/cross/account_book` | -| [submitCrossMarginBorrowLoan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2156) | :closed_lock_with_key: | POST | `/margin/cross/loans` | -| [getCrossMarginBorrowHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2171) | :closed_lock_with_key: | GET | `/margin/cross/loans` | -| [getCrossMarginBorrowLoan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2184) | :closed_lock_with_key: | GET | `/margin/cross/loans/{loan_id}` | -| [submitCrossMarginRepayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2199) | :closed_lock_with_key: | POST | `/margin/cross/repayments` | -| [getCrossMarginRepayments()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2215) | :closed_lock_with_key: | GET | `/margin/cross/repayments` | -| [getCrossMarginInterestRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2228) | :closed_lock_with_key: | GET | `/margin/cross/interest_records` | -| [getCrossMarginTransferableAmount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2244) | :closed_lock_with_key: | GET | `/margin/cross/transferable` | -| [getEstimatedInterestRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2260) | :closed_lock_with_key: | GET | `/margin/cross/estimate_rate` | -| [getCrossMarginBorrowableAmount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2274) | :closed_lock_with_key: | GET | `/margin/cross/borrowable` | -| [getMarginUserLoanTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2287) | :closed_lock_with_key: | GET | `/margin/user/loan_margin_tiers` | -| [getMarginPublicLoanTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2303) | | GET | `/margin/loan_margin_tiers` | -| [setMarginUserLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2319) | :closed_lock_with_key: | POST | `/margin/leverage/user_market_setting` | -| [getMarginUserAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2336) | :closed_lock_with_key: | GET | `/margin/user/account` | -| [getLendingMarkets()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2351) | | GET | `/margin/uni/currency_pairs` | -| [getLendingMarket()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2366) | | GET | `/margin/uni/currency_pairs/{currency_pair}` | -| [getEstimatedInterestRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2378) | :closed_lock_with_key: | GET | `/margin/uni/estimate_rate` | -| [submitMarginUNIBorrowOrRepay()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2388) | :closed_lock_with_key: | POST | `/margin/uni/loans` | -| [getMarginUNILoans()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2404) | :closed_lock_with_key: | GET | `/margin/uni/loans` | -| [getMarginUNILoanRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2414) | :closed_lock_with_key: | GET | `/margin/uni/loan_records` | -| [getMarginUNIInterestRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2426) | :closed_lock_with_key: | GET | `/margin/uni/interest_records` | -| [getMarginUNIMaxBorrow()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2438) | :closed_lock_with_key: | GET | `/margin/uni/borrowable` | -| [getFlashSwapCurrencyPairs()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2454) | | GET | `/flash_swap/currency_pairs` | -| [submitFlashSwapOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2470) | :closed_lock_with_key: | POST | `/flash_swap/orders` | -| [getFlashSwapOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2482) | :closed_lock_with_key: | GET | `/flash_swap/orders` | -| [getFlashSwapOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2494) | :closed_lock_with_key: | GET | `/flash_swap/orders/{order_id}` | -| [submitFlashSwapOrderPreview()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2504) | :closed_lock_with_key: | POST | `/flash_swap/orders/preview` | -| [getFuturesContracts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2521) | | GET | `/futures/{settle}/contracts` | -| [getFuturesContract()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2536) | | GET | `/futures/{settle}/contracts/{contract}` | -| [getFuturesOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2551) | | GET | `/futures/{settle}/order_book` | -| [getFuturesTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2564) | | GET | `/futures/{settle}/trades` | -| [getFuturesCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2579) | | GET | `/futures/{settle}/candlesticks` | -| [getPremiumIndexKLines()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2592) | | GET | `/futures/{settle}/premium_index` | -| [getFuturesTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2605) | | GET | `/futures/{settle}/tickers` | -| [getFundingRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2622) | | GET | `/futures/{settle}/funding_rate` | -| [getBatchFundingRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2638) | | POST | `/futures/{settle}/funding_rates` | -| [getFuturesInsuranceBalanceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2656) | | GET | `/futures/{settle}/insurance` | -| [getFuturesStats()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2675) | | GET | `/futures/{settle}/contract_stats` | -| [getIndexConstituents()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2686) | | GET | `/futures/{settle}/index_constituents/{index}` | -| [getLiquidationHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2703) | | GET | `/futures/{settle}/liq_orders` | -| [getRiskLimitTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2720) | | GET | `/futures/{settle}/risk_limit_tiers` | -| [getFuturesAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2733) | :closed_lock_with_key: | GET | `/futures/{settle}/accounts` | -| [getFuturesAccountBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2747) | :closed_lock_with_key: | GET | `/futures/{settle}/account_book` | -| [getFuturesPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2760) | :closed_lock_with_key: | GET | `/futures/{settle}/positions` | -| [getFuturesPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2775) | :closed_lock_with_key: | GET | `/futures/{settle}/positions/{contract}` | -| [updateFuturesMargin()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2792) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/margin` | -| [updateFuturesLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2820) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/leverage` | -| [getFuturesContractLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2840) | :closed_lock_with_key: | GET | `/futures/{settle}/get_leverage/{contract}` | -| [updateFuturesPositionMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2856) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/cross_mode` | -| [updatePositionRiskLimit()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2873) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/risk_limit` | -| [updateFuturesDualMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2893) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_mode` | -| [getDualModePosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2909) | :closed_lock_with_key: | GET | `/futures/{settle}/dual_comp/positions/{contract}` | -| [updateDualModePositionMargin()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2924) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/margin` | -| [updateDualModePositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2940) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/leverage` | -| [updateDualModePositionRiskLimit()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2964) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/risk_limit` | -| [submitFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2991) | :closed_lock_with_key: | POST | `/futures/{settle}/orders` | -| [getFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3012) | :closed_lock_with_key: | GET | `/futures/{settle}/orders` | -| [cancelAllFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3027) | :closed_lock_with_key: | DELETE | `/futures/{settle}/orders` | -| [getFuturesOrdersByTimeRange()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3047) | :closed_lock_with_key: | GET | `/futures/{settle}/orders_timerange` | -| [submitFuturesBatchOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3070) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_orders` | -| [getFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3095) | :closed_lock_with_key: | GET | `/futures/{settle}/orders/{order_id}` | -| [cancelFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3112) | :closed_lock_with_key: | DELETE | `/futures/{settle}/orders/{order_id}` | -| [updateFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3137) | :closed_lock_with_key: | PUT | `/futures/{settle}/orders/{order_id}` | -| [getFuturesTradingHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3158) | :closed_lock_with_key: | GET | `/futures/{settle}/my_trades` | -| [getFuturesTradingHistoryByTimeRange()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3173) | :closed_lock_with_key: | GET | `/futures/{settle}/my_trades_timerange` | -| [getFuturesPositionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3186) | :closed_lock_with_key: | GET | `/futures/{settle}/position_close` | -| [getFuturesLiquidationHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3199) | :closed_lock_with_key: | GET | `/futures/{settle}/liquidates` | -| [getFuturesAutoDeleveragingHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3212) | :closed_lock_with_key: | GET | `/futures/{settle}/auto_deleverages` | -| [setFuturesOrderCancelCountdown()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3229) | :closed_lock_with_key: | POST | `/futures/{settle}/countdown_cancel_all` | -| [getFuturesUserTradingFees()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3246) | :closed_lock_with_key: | GET | `/futures/{settle}/fee` | -| [batchCancelFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3264) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_cancel_orders` | -| [batchUpdateFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3291) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_amend_orders` | -| [getRiskLimitTable()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3313) | | GET | `/futures/{settle}/risk_limit_table` | -| [submitFuturesPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3326) | :closed_lock_with_key: | POST | `/futures/{settle}/price_orders` | -| [getFuturesAutoOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3339) | :closed_lock_with_key: | GET | `/futures/{settle}/price_orders` | -| [cancelAllOpenFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3352) | :closed_lock_with_key: | DELETE | `/futures/{settle}/price_orders` | -| [getFuturesPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3368) | :closed_lock_with_key: | GET | `/futures/{settle}/price_orders/{order_id}` | -| [cancelFuturesPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3383) | :closed_lock_with_key: | DELETE | `/futures/{settle}/price_orders/{order_id}` | -| [updateFuturesPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3398) | :closed_lock_with_key: | PUT | `/futures/{settle}/price_orders/amend` | -| [createTrailOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3413) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/create` | -| [terminateTrailOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3431) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/stop` | -| [batchTerminateTrailOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3444) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/stop_all` | -| [getTrailOrderList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3459) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/list` | -| [getTrailOrderDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3472) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/detail` | -| [updateTrailOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3490) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/update` | -| [getTrailOrderChangeLog()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3503) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/change_log` | -| [createChaseOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3516) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/create` | -| [stopChaseOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3526) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/stop` | -| [stopAllChaseOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3536) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/stop_all` | -| [getChaseOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3548) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/chase/list` | -| [getChaseOrderDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3556) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/chase/detail` | -| [getFuturesPositionCloseHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3565) | :closed_lock_with_key: | GET | `/futures/{settle}/position_close_history` | -| [getFuturesInsuranceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3574) | :closed_lock_with_key: | GET | `/futures/{settle}/insurance` | -| [getAllDeliveryContracts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3591) | | GET | `/delivery/{settle}/contracts` | -| [getDeliveryContract()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3603) | | GET | `/delivery/{settle}/contracts/{contract}` | -| [getDeliveryOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3618) | | GET | `/delivery/{settle}/order_book` | -| [getDeliveryTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3631) | | GET | `/delivery/{settle}/trades` | -| [getDeliveryCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3645) | | GET | `/delivery/{settle}/candlesticks` | -| [getDeliveryTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3656) | | GET | `/delivery/{settle}/tickers` | -| [getDeliveryInsuranceBalanceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3673) | | GET | `/delivery/{settle}/insurance` | -| [getDeliveryAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3692) | :closed_lock_with_key: | GET | `/delivery/{settle}/accounts` | -| [getDeliveryBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3703) | :closed_lock_with_key: | GET | `/delivery/{settle}/account_book` | -| [getDeliveryPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3714) | :closed_lock_with_key: | GET | `/delivery/{settle}/positions` | -| [getDeliveryPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3724) | :closed_lock_with_key: | GET | `/delivery/{settle}/positions/{contract}` | -| [updateDeliveryMargin()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3739) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/margin` | -| [updateDeliveryLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3757) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/leverage` | -| [updateDeliveryRiskLimit()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3775) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/risk_limit` | -| [submitDeliveryOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3795) | :closed_lock_with_key: | POST | `/delivery/{settle}/orders` | -| [getDeliveryOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3810) | :closed_lock_with_key: | GET | `/delivery/{settle}/orders` | -| [cancelAllDeliveryOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3823) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/orders` | -| [getDeliveryOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3842) | :closed_lock_with_key: | GET | `/delivery/{settle}/orders/{order_id}` | -| [cancelDeliveryOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3857) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/orders/{order_id}` | -| [getDeliveryTradingHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3872) | :closed_lock_with_key: | GET | `/delivery/{settle}/my_trades` | -| [getDeliveryClosedPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3885) | :closed_lock_with_key: | GET | `/delivery/{settle}/position_close` | -| [getDeliveryLiquidationHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3898) | :closed_lock_with_key: | GET | `/delivery/{settle}/liquidates` | -| [getDeliverySettlementHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3911) | :closed_lock_with_key: | GET | `/delivery/{settle}/settlements` | -| [submitDeliveryTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3924) | :closed_lock_with_key: | POST | `/delivery/{settle}/price_orders` | -| [getDeliveryAutoOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3939) | :closed_lock_with_key: | GET | `/delivery/{settle}/price_orders` | -| [cancelAllOpenDeliveryOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3952) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/price_orders` | -| [getDeliveryTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3968) | :closed_lock_with_key: | GET | `/delivery/{settle}/price_orders/{order_id}` | -| [cancelTriggeredDeliveryOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3983) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/price_orders/{order_id}` | -| [getOptionsUnderlyings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4002) | | GET | `/options/underlyings` | -| [getOptionsExpirationTimes()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4012) | | GET | `/options/expirations` | -| [getOptionsContracts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4022) | | GET | `/options/contracts` | -| [getOptionsContract()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4035) | | GET | `/options/contracts/{contract}` | -| [getOptionsSettlementHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4045) | | GET | `/options/settlements` | -| [getOptionsContractSettlement()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4057) | | GET | `/options/settlements/{contract}` | -| [getOptionsMySettlements()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4072) | :closed_lock_with_key: | GET | `/options/my_settlements` | -| [getOptionsOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4086) | | GET | `/options/order_book` | -| [getOptionsTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4098) | | GET | `/options/tickers` | -| [getOptionsUnderlyingTicker()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4112) | | GET | `/options/underlying/tickers/{underlying}` | -| [getOptionsCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4126) | | GET | `/options/candlesticks` | -| [getOptionsUnderlyingCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4136) | | GET | `/options/underlying/candlesticks` | -| [getOptionsTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4148) | | GET | `/options/trades` | -| [getOptionsAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4159) | :closed_lock_with_key: | GET | `/options/accounts` | -| [getOptionsAccountChange()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4169) | :closed_lock_with_key: | GET | `/options/account_book` | -| [getOptionsPositionsUnderlying()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4181) | :closed_lock_with_key: | GET | `/options/positions` | -| [getOptionsPositionContract()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4193) | :closed_lock_with_key: | GET | `/options/positions/{contract}` | -| [getOptionsLiquidation()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4205) | :closed_lock_with_key: | GET | `/options/position_close` | -| [submitOptionsOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4218) | :closed_lock_with_key: | POST | `/options/orders` | -| [getOptionsOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4230) | :closed_lock_with_key: | GET | `/options/orders` | -| [cancelAllOpenOptionsOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4242) | :closed_lock_with_key: | DELETE | `/options/orders` | -| [getOptionsOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4256) | :closed_lock_with_key: | GET | `/options/orders/{order_id}` | -| [amendOptionsOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4268) | :closed_lock_with_key: | PUT | `/options/orders/{order_id}` | -| [cancelOptionsOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4283) | :closed_lock_with_key: | DELETE | `/options/orders/{order_id}` | -| [submitOptionsCountdownCancel()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4302) | :closed_lock_with_key: | POST | `/options/countdown_cancel_all` | -| [getOptionsPersonalHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4318) | :closed_lock_with_key: | GET | `/options/my_trades` | -| [setOptionsMMPSettings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4330) | :closed_lock_with_key: | POST | `/options/mmp` | -| [getOptionsMMPSettings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4342) | :closed_lock_with_key: | GET | `/options/mmp` | -| [resetOptionsMMPSettings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4354) | :closed_lock_with_key: | POST | `/options/mmp/reset` | -| [getLendingCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4370) | | GET | `/earn/uni/currencies` | -| [getLendingCurrency()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4380) | | GET | `/earn/uni/currencies/{currency}` | -| [submitLendOrRedeemOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4390) | :closed_lock_with_key: | POST | `/earn/uni/lends` | -| [getLendingOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4400) | :closed_lock_with_key: | GET | `/earn/uni/lends` | -| [updateLendingOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4412) | :closed_lock_with_key: | PATCH | `/earn/uni/lends` | -| [getLendingRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4425) | :closed_lock_with_key: | GET | `/earn/uni/lend_records` | -| [getLendingTotalInterest()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4438) | :closed_lock_with_key: | GET | `/earn/uni/interests/{currency}` | -| [getLendingInterestRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4451) | :closed_lock_with_key: | GET | `/earn/uni/interest_records` | -| [updateInterestReinvestment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4464) | :closed_lock_with_key: | PUT | `/earn/uni/interest_reinvest` | -| [getLendingInterestStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4480) | :closed_lock_with_key: | GET | `/earn/uni/interest_status/{currency}` | -| [getLendingAnnualizedTrendChart()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4495) | :closed_lock_with_key: | GET | `/earn/uni/chart` | -| [getLendingEstimatedRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4503) | :closed_lock_with_key: | GET | `/earn/uni/rate` | -| [submitMultiLoanOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4520) | :closed_lock_with_key: | POST | `/loan/multi_collateral/orders` | -| [getMultiLoanOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4532) | :closed_lock_with_key: | GET | `/loan/multi_collateral/orders` | -| [getMultiLoanOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4544) | :closed_lock_with_key: | GET | `/loan/multi_collateral/orders/{order_id}` | -| [repayMultiLoan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4554) | :closed_lock_with_key: | POST | `/loan/multi_collateral/repay` | -| [getMultiLoanRepayRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4564) | :closed_lock_with_key: | GET | `/loan/multi_collateral/repay` | -| [updateMultiLoan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4576) | :closed_lock_with_key: | POST | `/loan/multi_collateral/mortgage` | -| [getMultiLoanAdjustmentRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4588) | :closed_lock_with_key: | GET | `/loan/multi_collateral/mortgage` | -| [getMultiLoanCurrencyQuota()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4600) | :closed_lock_with_key: | GET | `/loan/multi_collateral/currency_quota` | -| [getMultiLoanSupportedCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4612) | | GET | `/loan/multi_collateral/currencies` | -| [getMultiLoanRatio()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4621) | | GET | `/loan/multi_collateral/ltv` | -| [getMultiLoanFixedRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4630) | | GET | `/loan/multi_collateral/fixed_rate` | -| [getMultiLoanCurrentRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4643) | | GET | `/loan/multi_collateral/current_rate` | -| [getDualInvestmentProducts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4665) | | GET | `/earn/dual/investment_plan` | -| [getDualInvestmentOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4676) | :closed_lock_with_key: | GET | `/earn/dual/orders` | -| [submitDualInvestmentOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4688) | :closed_lock_with_key: | POST | `/earn/dual/orders` | -| [getDualOrderRefundPreview()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4697) | :closed_lock_with_key: | GET | `/earn/dual/order-refund-preview` | -| [submitDualOrderRefund()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4706) | :closed_lock_with_key: | POST | `/earn/dual/order-refund` | -| [updateDualOrderReinvest()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4715) | :closed_lock_with_key: | POST | `/earn/dual/modify-order-reinvest` | -| [getDualProjectRecommend()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4726) | :closed_lock_with_key: | GET | `/earn/dual/project-recommend` | -| [getEarnFixedTermProducts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4735) | | GET | `/earn/fixed-term/product` | -| [getEarnFixedTermProductsByAsset()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4744) | | GET | `/earn/fixed-term/product/{asset}/list` | -| [createEarnFixedTermLend()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4754) | :closed_lock_with_key: | POST | `/earn/fixed-term/user/lend` | -| [getEarnFixedTermLends()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4763) | :closed_lock_with_key: | GET | `/earn/fixed-term/user/lend` | -| [createEarnFixedTermPreRedeem()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4772) | :closed_lock_with_key: | POST | `/earn/fixed-term/user/pre-redeem` | -| [getEarnFixedTermHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4783) | :closed_lock_with_key: | GET | `/earn/fixed-term/user/history` | -| [createAutoInvestPlan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4792) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/create` | -| [updateAutoInvestPlan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4801) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/update` | -| [stopAutoInvestPlan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4808) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/stop` | -| [addAutoInvestPlanPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4815) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/add_position` | -| [getAutoInvestCoins()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4826) | :closed_lock_with_key: | GET | `/earn/autoinvest/coins` | -| [getAutoInvestMinAmount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4835) | :closed_lock_with_key: | POST | `/earn/autoinvest/min_invest_amount` | -| [getAutoInvestPlanRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4846) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/records` | -| [getAutoInvestOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4855) | :closed_lock_with_key: | GET | `/earn/autoinvest/orders` | -| [getAutoInvestConfig()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4864) | :closed_lock_with_key: | GET | `/earn/autoinvest/config` | -| [getAutoInvestPlanDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4871) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/detail` | -| [getAutoInvestPlans()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4880) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/list_info` | -| [getStakingCoins()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4892) | :closed_lock_with_key: | GET | `/earn/staking/coins` | -| [submitStakingSwap()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4905) | :closed_lock_with_key: | POST | `/earn/staking/swap` | -| [getAccountDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4924) | :closed_lock_with_key: | GET | `/account/detail` | -| [getAccountRateLimit()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4933) | :closed_lock_with_key: | GET | `/account/rate_limit` | -| [createStpGroup()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4943) | :closed_lock_with_key: | POST | `/account/stp_groups` | -| [getStpGroups()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4953) | :closed_lock_with_key: | GET | `/account/stp_groups` | -| [getStpGroupUsers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4963) | :closed_lock_with_key: | GET | `/account/stp_groups/{stp_id}/users` | -| [addUsersToStpGroup()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4973) | :closed_lock_with_key: | POST | `/account/stp_groups/{stp_id}/users` | -| [deleteUserFromStpGroup()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4989) | :closed_lock_with_key: | DELETE | `/account/stp_groups/{stp_id}/users` | -| [setGTDeduction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5007) | :closed_lock_with_key: | POST | `/account/debit_fee` | -| [getGTDeduction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5018) | :closed_lock_with_key: | GET | `/account/debit_fee` | -| [getAccountMainKeys()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5027) | :closed_lock_with_key: | GET | `/account/main_keys` | -| [getAgencyTransactionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5043) | :closed_lock_with_key: | GET | `/rebate/agency/transaction_history` | -| [getAgencyCommissionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5056) | :closed_lock_with_key: | GET | `/rebate/agency/commission_history` | -| [getPartnerTransactionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5070) | :closed_lock_with_key: | GET | `/rebate/partner/transaction_history` | -| [getPartnerCommissionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5085) | :closed_lock_with_key: | GET | `/rebate/partner/commission_history` | -| [getPartnerSubordinateList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5108) | :closed_lock_with_key: | GET | `/rebate/partner/sub_list` | -| [getPartnerAgentDataAggregated()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5118) | :closed_lock_with_key: | GET | `/rebate/partner/data/aggregated` | -| [getBrokerCommissionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5131) | :closed_lock_with_key: | GET | `/rebate/broker/commission_history` | -| [getBrokerTransactionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5144) | :closed_lock_with_key: | GET | `/rebate/broker/transaction_history` | -| [getUserRebateInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5153) | :closed_lock_with_key: | GET | `/rebate/user/info` | -| [createOTCQuote()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5188) | :closed_lock_with_key: | POST | `/otc/quote` | -| [createOTCFiatOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5200) | :closed_lock_with_key: | POST | `/otc/order/create` | -| [createOTCStablecoinOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5214) | :closed_lock_with_key: | POST | `/otc/stable_coin/order/create` | -| [getOTCBankList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5223) | :closed_lock_with_key: | GET | `/otc/bank/list` | -| [getOTCBankListLegacy()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5230) | :closed_lock_with_key: | GET | `/otc/bank_list` | -| [createOTCBank()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5237) | :closed_lock_with_key: | POST | `/otc/bank/delete` | -| [deleteOTCBank()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5248) | :closed_lock_with_key: | POST | `/otc/bank/delete` | -| [setDefaultOTCBank()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5255) | :closed_lock_with_key: | POST | `/otc/bank/set_default` | -| [getOTCBankSupplementChecklist()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5262) | :closed_lock_with_key: | GET | `/otc/bank/bank_supplement_checklist` | -| [submitOTCBankPersonalSupplement()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5271) | :closed_lock_with_key: | POST | `/otc/order/paid` | -| [submitOTCBankEnterpriseSupplement()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5290) | :closed_lock_with_key: | POST | `/otc/order/paid` | -| [markOTCOrderAsPaid()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5326) | :closed_lock_with_key: | POST | `/otc/order/paid` | -| [cancelOTCOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5340) | :closed_lock_with_key: | POST | `/otc/order/cancel` | -| [getOTCFiatOrderList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5352) | :closed_lock_with_key: | GET | `/otc/order/list` | -| [getOTCStablecoinOrderList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5366) | :closed_lock_with_key: | GET | `/otc/stable_coin/order/list` | -| [getOTCFiatOrderDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5380) | :closed_lock_with_key: | GET | `/otc/order/detail` | -| [getP2PMerchantUserInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5394) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_user_info` | -| [getP2PMerchantCounterpartyUserInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5403) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_counterparty_user_info` | -| [getP2PMerchantMyselfPayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5415) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_myself_payment` | -| [getP2PMerchantSpotBalance()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5428) | :closed_lock_with_key: | POST | `/p2p/merchant/account/set_merchant_work_hours` | -| [setP2PMerchantWorkHours()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5437) | :closed_lock_with_key: | POST | `/p2p/merchant/account/set_merchant_work_hours` | -| [getP2PMerchantPendingTransactionList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5448) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_pending_transaction_list` | -| [getP2PMerchantCompletedTransactionList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5460) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_completed_transaction_list` | -| [getP2PMerchantTransactionDetails()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5472) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_transaction_details` | -| [confirmP2PMerchantPayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5484) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/confirm-payment` | -| [confirmP2PMerchantReceipt()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5495) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/confirm-receipt` | -| [cancelP2PMerchantTransaction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5506) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/cancel` | -| [placeP2PMerchantBizPushOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5517) | :closed_lock_with_key: | POST | `/p2p/merchant/books/place_biz_push_order` | -| [updateP2PMerchantAdsStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5528) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_update_status` | -| [getP2PMerchantAdsDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5541) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_detail` | -| [getP2PMerchantMyAdsList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5550) | :closed_lock_with_key: | POST | `/p2p/merchant/books/my_ads_list` | -| [getP2PMerchantAdsList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5561) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_list` | -| [getP2PMerchantChatsList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5570) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/get_chats_list` | -| [sendP2PMerchantChatMessage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5581) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/send_chat_message` | -| [uploadP2PMerchantChatFile()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5592) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/upload_chat_file` | -| [getCrossExSymbols()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5613) | | GET | `/crossex/rule/symbols` | -| [getCrossExRiskLimits()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5625) | | GET | `/crossex/rule/risk_limits` | -| [getCrossExTransferCoins()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5639) | | GET | `/crossex/transfers/coin` | -| [createCrossExTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5653) | :closed_lock_with_key: | POST | `/crossex/transfers` | -| [getCrossExTransferHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5667) | :closed_lock_with_key: | GET | `/crossex/transfers` | -| [createCrossExOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5681) | :closed_lock_with_key: | POST | `/crossex/orders` | -| [cancelCrossExOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5695) | :closed_lock_with_key: | DELETE | `/crossex/orders/{order_id}` | -| [modifyCrossExOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5708) | :closed_lock_with_key: | PUT | `/crossex/orders/{order_id}` | -| [getCrossExOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5723) | :closed_lock_with_key: | GET | `/crossex/orders/{order_id}` | -| [createCrossExConvertQuote()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5735) | :closed_lock_with_key: | POST | `/crossex/convert/quote` | -| [createCrossExConvertOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5749) | :closed_lock_with_key: | POST | `/crossex/convert/orders` | -| [updateCrossExAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5763) | :closed_lock_with_key: | PUT | `/crossex/accounts` | -| [getCrossExAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5777) | :closed_lock_with_key: | GET | `/crossex/accounts` | -| [setCrossExPositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5789) | :closed_lock_with_key: | POST | `/crossex/positions/leverage` | -| [getCrossExPositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5803) | :closed_lock_with_key: | GET | `/crossex/positions/leverage` | -| [setCrossExMarginPositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5817) | :closed_lock_with_key: | POST | `/crossex/margin_positions/leverage` | -| [getCrossExMarginPositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5833) | :closed_lock_with_key: | GET | `/crossex/margin_positions/leverage` | -| [closeCrossExPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5847) | :closed_lock_with_key: | POST | `/crossex/position` | -| [getCrossExInterestRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5861) | :closed_lock_with_key: | GET | `/crossex/interest_rate` | -| [getCrossExFeeRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5874) | :closed_lock_with_key: | GET | `/crossex/fee` | -| [getCrossExPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5886) | :closed_lock_with_key: | GET | `/crossex/positions` | -| [getCrossExMarginPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5900) | :closed_lock_with_key: | GET | `/crossex/margin_positions` | -| [getCrossExAdlRank()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5914) | :closed_lock_with_key: | GET | `/crossex/adl_rank` | -| [getCrossExOpenOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5926) | :closed_lock_with_key: | GET | `/crossex/open_orders` | -| [getCrossExHistoryOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5940) | :closed_lock_with_key: | GET | `/crossex/history_orders` | -| [getCrossExHistoryPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5954) | :closed_lock_with_key: | GET | `/crossex/history_positions` | -| [getCrossExHistoryMarginPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5968) | :closed_lock_with_key: | GET | `/crossex/history_margin_positions` | -| [getCrossExHistoryMarginInterests()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5982) | :closed_lock_with_key: | GET | `/crossex/history_margin_interests` | -| [getCrossExHistoryTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5996) | :closed_lock_with_key: | GET | `/crossex/history_trades` | -| [getCrossExAccountBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6010) | :closed_lock_with_key: | GET | `/crossex/account_book` | -| [getCrossExCoinDiscountRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6024) | :closed_lock_with_key: | GET | `/crossex/coin_discount_rate` | -| [getAlphaAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6042) | :closed_lock_with_key: | GET | `/alpha/accounts` | -| [getAlphaAccountBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6054) | :closed_lock_with_key: | GET | `/alpha/account_book` | -| [createAlphaQuote()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6068) | :closed_lock_with_key: | POST | `/alpha/quote` | -| [createAlphaOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6080) | :closed_lock_with_key: | POST | `/alpha/orders` | -| [getAlphaOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6092) | :closed_lock_with_key: | GET | `/alpha/orders` | -| [getAlphaOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6104) | :closed_lock_with_key: | GET | `/alpha/order` | -| [getAlphaCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6116) | | GET | `/alpha/currencies` | -| [getAlphaTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6128) | | GET | `/alpha/tickers` | -| [getTradFiMT5Account()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6134) | :closed_lock_with_key: | GET | `/tradfi/users/mt5-account` | -| [getTradFiSymbolCategories()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6138) | | GET | `/tradfi/symbols/categories` | -| [getTradFiSymbols()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6144) | | GET | `/tradfi/symbols` | -| [getTradFiSymbolDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6148) | :closed_lock_with_key: | GET | `/tradfi/symbols/detail` | -| [getTradFiKlines()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6154) | | GET | `/tradfi/symbols/{symbol}/klines` | -| [getTradFiTicker()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6161) | | GET | `/tradfi/symbols/{symbol}/tickers` | -| [createTradFiUser()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6165) | :closed_lock_with_key: | POST | `/tradfi/users` | -| [getTradFiAssets()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6169) | :closed_lock_with_key: | GET | `/tradfi/users/assets` | -| [createTradFiTransaction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6173) | :closed_lock_with_key: | POST | `/tradfi/transactions` | -| [getTradFiTransactions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6179) | :closed_lock_with_key: | GET | `/tradfi/transactions` | -| [createTradFiOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6185) | :closed_lock_with_key: | POST | `/tradfi/orders` | -| [getTradFiOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6191) | :closed_lock_with_key: | GET | `/tradfi/orders` | -| [modifyTradFiOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6195) | :closed_lock_with_key: | PUT | `/tradfi/orders/{orderId}` | -| [cancelTradFiOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6202) | :closed_lock_with_key: | DELETE | `/tradfi/orders/{orderId}` | -| [getTradFiOrderHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6206) | :closed_lock_with_key: | GET | `/tradfi/orders/history` | -| [getTradFiPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6212) | :closed_lock_with_key: | GET | `/tradfi/positions` | -| [modifyTradFiPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6218) | :closed_lock_with_key: | PUT | `/tradfi/positions/{positionId}` | -| [closeTradFiPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6227) | :closed_lock_with_key: | POST | `/tradfi/positions/{positionId}/close` | -| [getTradFiPositionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6236) | :closed_lock_with_key: | GET | `/tradfi/positions/history` | -| [getTradFiOrderLog()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6245) | :closed_lock_with_key: | GET | `/tradfi/orders/log/{log_id}` | +| [getSystemMaintenanceStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L703) | | GET | `/v1/public/system_info` | +| [submitWithdrawal()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L720) | :closed_lock_with_key: | POST | `/withdrawals` | +| [submitSpotMainAccountTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L734) | :closed_lock_with_key: | POST | `/withdrawals/push` | +| [cancelWithdrawal()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L750) | :closed_lock_with_key: | DELETE | `/withdrawals/{withdrawal_id}` | +| [getCurrencyChains()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L767) | | GET | `/wallet/currency_chains` | +| [createDepositAddress()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L777) | :closed_lock_with_key: | GET | `/wallet/deposit_address` | +| [getWithdrawalRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L791) | :closed_lock_with_key: | GET | `/wallet/withdrawals` | +| [getDepositRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L805) | :closed_lock_with_key: | GET | `/wallet/deposits` | +| [submitTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L824) | :closed_lock_with_key: | POST | `/wallet/transfers` | +| [getTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L828) | :closed_lock_with_key: | GET | `/wallet/transfers` | +| [submitMainSubTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L840) | :closed_lock_with_key: | POST | `/wallet/sub_account_transfers` | +| [getMainSubTransfers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L854) | :closed_lock_with_key: | GET | `/wallet/sub_account_transfers` | +| [submitSubToSubTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L868) | :closed_lock_with_key: | POST | `/wallet/sub_account_to_sub_account` | +| [getTransferStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L883) | :closed_lock_with_key: | GET | `/wallet/order_status` | +| [getWithdrawalStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L899) | :closed_lock_with_key: | GET | `/wallet/withdraw_status` | +| [getSubBalance()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L911) | :closed_lock_with_key: | GET | `/wallet/sub_account_balances` | +| [getSubMarginBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L923) | :closed_lock_with_key: | GET | `/wallet/sub_account_margin_balances` | +| [getSubFuturesBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L935) | :closed_lock_with_key: | GET | `/wallet/sub_account_futures_balances` | +| [getSubCrossMarginBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L948) | :closed_lock_with_key: | GET | `/wallet/sub_account_cross_margin_balances` | +| [getSavedAddresses()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L960) | :closed_lock_with_key: | GET | `/wallet/saved_address` | +| [getTradingFees()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L970) | :closed_lock_with_key: | GET | `/wallet/fee` | +| [getBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L991) | :closed_lock_with_key: | GET | `/wallet/total_balance` | +| [getSmallBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1000) | :closed_lock_with_key: | GET | `/wallet/small_balance` | +| [convertSmallBalance()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1010) | :closed_lock_with_key: | POST | `/wallet/small_balance` | +| [getSmallBalanceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1023) | :closed_lock_with_key: | GET | `/wallet/small_balance_history` | +| [getPushOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1035) | :closed_lock_with_key: | GET | `/wallet/push` | +| [getLowCapExchangeList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1044) | :closed_lock_with_key: | GET | `/wallet/getLowCapExchangeList` | +| [createSubAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1059) | :closed_lock_with_key: | POST | `/sub_accounts` | +| [getSubAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1070) | :closed_lock_with_key: | GET | `/sub_accounts` | +| [getSubAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1080) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}` | +| [createSubAccountApiKey()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1090) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/keys` | +| [getSubAccountApiKeys()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1103) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}/keys` | +| [updateSubAccountApiKey()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1117) | :closed_lock_with_key: | PUT | `/sub_accounts/{user_id}/keys/{key}` | +| [deleteSubAccountApiKey()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1128) | :closed_lock_with_key: | DELETE | `/sub_accounts/{user_id}/keys/{key}` | +| [getSubAccountApiKey()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1143) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}/keys/{key}` | +| [lockSubAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1158) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/lock` | +| [unlockSubAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1168) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/unlock` | +| [getSubAccountMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1182) | :closed_lock_with_key: | GET | `/sub_accounts/unified_mode` | +| [getUnifiedAccountInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1201) | :closed_lock_with_key: | GET | `/unified/accounts` | +| [getUnifiedMaxBorrow()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1217) | :closed_lock_with_key: | GET | `/unified/borrowable` | +| [getUnifiedMaxTransferable()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1233) | :closed_lock_with_key: | GET | `/unified/transferable` | +| [getUnifiedMaxTransferables()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1248) | :closed_lock_with_key: | GET | `/unified/transferables` | +| [getUnifiedBatchMaxBorrowable()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1257) | :closed_lock_with_key: | GET | `/unified/batch_borrowable` | +| [submitUnifiedBorrowOrRepay()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1275) | :closed_lock_with_key: | POST | `/unified/loans` | +| [getUnifiedLoans()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1287) | :closed_lock_with_key: | GET | `/unified/loans` | +| [getUnifiedLoanRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1297) | :closed_lock_with_key: | GET | `/unified/loan_records` | +| [getUnifiedInterestRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1309) | :closed_lock_with_key: | GET | `/unified/interest_records` | +| [getUnifiedRiskUnitDetails()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1320) | :closed_lock_with_key: | GET | `/unified/risk_units` | +| [setUnifiedAccountMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1332) | :closed_lock_with_key: | PUT | `/unified/unified_mode` | +| [getUnifiedAccountMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1341) | :closed_lock_with_key: | GET | `/unified/unified_mode` | +| [getUnifiedEstimateRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1353) | :closed_lock_with_key: | GET | `/unified/estimate_rate` | +| [getUnifiedCurrencyDiscountTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1364) | | GET | `/unified/currency_discount_tiers` | +| [getLoanMarginTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1376) | | GET | `/unified/loan_margin_tiers` | +| [portfolioMarginCalculate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1393) | | POST | `/unified/portfolio_calculator` | +| [setUserLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1399) | :closed_lock_with_key: | POST | `/unified/leverage/user_setting` | +| [getUserCurrencyLeverageConfig()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1413) | :closed_lock_with_key: | GET | `/unified/leverage/user_currency_config` | +| [getUserCurrencyLeverageSettings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1427) | :closed_lock_with_key: | GET | `/unified/leverage/user_currency_setting` | +| [updateUserCurrencyLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1442) | :closed_lock_with_key: | POST | `/unified/leverage/user_currency_setting` | +| [getUnifiedLoanCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1457) | :closed_lock_with_key: | GET | `/unified/currencies` | +| [getHistoricalLendingRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1469) | :closed_lock_with_key: | GET | `/unified/history_loan_rate` | +| [submitUnifiedLoanRepay()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1475) | :closed_lock_with_key: | POST | `/unified/loans/repay` | +| [getEstimatedQuickRepayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1482) | :closed_lock_with_key: | GET | `/unified/estimated_quick_repayment` | +| [createQuickRepayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1489) | :closed_lock_with_key: | POST | `/unified/quick_repayment` | +| [setUnifiedDeltaNeutral()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1500) | :closed_lock_with_key: | POST | `/unified/delta_neutral` | +| [getUnifiedDeltaNeutral()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1509) | :closed_lock_with_key: | GET | `/unified/delta_neutral` | +| [getSpotCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1529) | | GET | `/spot/currencies` | +| [getSpotCurrency()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1539) | | GET | `/spot/currencies/{currency}` | +| [getSpotCurrencyPairs()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1548) | | GET | `/spot/currency_pairs` | +| [getSpotCurrencyPair()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1558) | | GET | `/spot/currency_pairs/{currency_pair}` | +| [getSpotTicker()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1572) | | GET | `/spot/tickers` | +| [getSpotOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1587) | | GET | `/spot/order_book` | +| [getSpotTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1600) | | GET | `/spot/trades` | +| [getSpotCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1612) | | GET | `/spot/candlesticks` | +| [getSpotFeeRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1624) | :closed_lock_with_key: | GET | `/spot/fee` | +| [getSpotBatchFeeRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1633) | :closed_lock_with_key: | GET | `/spot/batch_fee` | +| [getSpotAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1645) | :closed_lock_with_key: | GET | `/spot/accounts` | +| [getSpotAccountBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1657) | :closed_lock_with_key: | GET | `/spot/account_book` | +| [submitSpotBatchOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1676) | :closed_lock_with_key: | POST | `/spot/batch_orders` | +| [getSpotOpenOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1703) | :closed_lock_with_key: | GET | `/spot/open_orders` | +| [submitSpotClosePosCrossDisabled()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1719) | :closed_lock_with_key: | POST | `/spot/cross_liquidate_orders` | +| [submitSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1735) | :closed_lock_with_key: | POST | `/spot/orders` | +| [getSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1752) | :closed_lock_with_key: | GET | `/spot/orders` | +| [cancelSpotOpenOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1767) | :closed_lock_with_key: | DELETE | `/spot/orders` | +| [batchCancelSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1795) | :closed_lock_with_key: | POST | `/spot/cancel_batch_orders` | +| [getSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1820) | :closed_lock_with_key: | GET | `/spot/orders/{order_id}` | +| [updateSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1837) | :closed_lock_with_key: | PATCH | `/spot/orders/{order_id}` | +| [cancelSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1865) | :closed_lock_with_key: | DELETE | `/spot/orders/{order_id}` | +| [getSpotTradingHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1894) | :closed_lock_with_key: | GET | `/spot/my_trades` | +| [submitSpotCountdownOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1923) | :closed_lock_with_key: | POST | `/spot/countdown_cancel_all` | +| [batchUpdateSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1942) | :closed_lock_with_key: | POST | `/spot/amend_batch_orders` | +| [getSpotInsuranceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1969) | :closed_lock_with_key: | GET | `/spot/insurance_history` | +| [submitSpotPriceTriggerOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1983) | :closed_lock_with_key: | POST | `/spot/price_orders` | +| [getSpotAutoOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1995) | :closed_lock_with_key: | GET | `/spot/price_orders` | +| [cancelAllOpenSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2007) | :closed_lock_with_key: | DELETE | `/spot/price_orders` | +| [getPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2020) | :closed_lock_with_key: | GET | `/spot/price_orders/{order_id}` | +| [cancelSpotTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2032) | :closed_lock_with_key: | DELETE | `/spot/price_orders/{order_id}` | +| [listSpotPovOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2038) | :closed_lock_with_key: | GET | `/spot/pov_orders` | +| [createSpotPovOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2042) | :closed_lock_with_key: | POST | `/spot/pov_orders` | +| [cancelSpotPovOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2046) | :closed_lock_with_key: | POST | `/spot/pov_orders/cancel` | +| [getSpotPovOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2052) | :closed_lock_with_key: | GET | `/spot/pov_orders/{order_id}` | +| [cancelSpotPovOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2056) | :closed_lock_with_key: | POST | `/spot/pov_orders/{order_id}/cancel` | +| [setCollateralCurrency()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2068) | :closed_lock_with_key: | POST | `/unified/collateral_currencies` | +| [getMarginAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2089) | :closed_lock_with_key: | GET | `/margin/accounts` | +| [getMarginBalanceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2103) | :closed_lock_with_key: | GET | `/margin/account_book` | +| [getFundingAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2121) | :closed_lock_with_key: | GET | `/margin/funding_accounts` | +| [updateAutoRepaymentSetting()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2139) | :closed_lock_with_key: | POST | `/margin/auto_repay` | +| [getAutoRepaymentSetting()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2150) | :closed_lock_with_key: | GET | `/margin/auto_repay` | +| [getMarginTransferableAmount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2164) | :closed_lock_with_key: | GET | `/margin/transferable` | +| [getCrossMarginCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2181) | | GET | `/margin/cross/currencies` | +| [getCrossMarginCurrency()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2192) | | GET | `/margin/cross/currencies/{currency}` | +| [getCrossMarginAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2204) | :closed_lock_with_key: | GET | `/margin/cross/accounts` | +| [getCrossMarginAccountHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2217) | :closed_lock_with_key: | GET | `/margin/cross/account_book` | +| [submitCrossMarginBorrowLoan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2234) | :closed_lock_with_key: | POST | `/margin/cross/loans` | +| [getCrossMarginBorrowHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2249) | :closed_lock_with_key: | GET | `/margin/cross/loans` | +| [getCrossMarginBorrowLoan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2262) | :closed_lock_with_key: | GET | `/margin/cross/loans/{loan_id}` | +| [submitCrossMarginRepayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2277) | :closed_lock_with_key: | POST | `/margin/cross/repayments` | +| [getCrossMarginRepayments()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2293) | :closed_lock_with_key: | GET | `/margin/cross/repayments` | +| [getCrossMarginInterestRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2306) | :closed_lock_with_key: | GET | `/margin/cross/interest_records` | +| [getCrossMarginTransferableAmount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2322) | :closed_lock_with_key: | GET | `/margin/cross/transferable` | +| [getEstimatedInterestRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2338) | :closed_lock_with_key: | GET | `/margin/cross/estimate_rate` | +| [getCrossMarginBorrowableAmount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2352) | :closed_lock_with_key: | GET | `/margin/cross/borrowable` | +| [getMarginUserLoanTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2365) | :closed_lock_with_key: | GET | `/margin/user/loan_margin_tiers` | +| [getMarginPublicLoanTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2381) | | GET | `/margin/loan_margin_tiers` | +| [setMarginUserLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2397) | :closed_lock_with_key: | POST | `/margin/leverage/user_market_setting` | +| [getMarginUserAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2414) | :closed_lock_with_key: | GET | `/margin/user/account` | +| [getLendingMarkets()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2429) | | GET | `/margin/uni/currency_pairs` | +| [getLendingMarket()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2444) | | GET | `/margin/uni/currency_pairs/{currency_pair}` | +| [getEstimatedInterestRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2456) | :closed_lock_with_key: | GET | `/margin/uni/estimate_rate` | +| [submitMarginUNIBorrowOrRepay()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2466) | :closed_lock_with_key: | POST | `/margin/uni/loans` | +| [getMarginUNILoans()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2482) | :closed_lock_with_key: | GET | `/margin/uni/loans` | +| [getMarginUNILoanRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2492) | :closed_lock_with_key: | GET | `/margin/uni/loan_records` | +| [getMarginUNIInterestRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2504) | :closed_lock_with_key: | GET | `/margin/uni/interest_records` | +| [getMarginUNIMaxBorrow()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2516) | :closed_lock_with_key: | GET | `/margin/uni/borrowable` | +| [getFlashSwapCurrencyPairs()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2532) | | GET | `/flash_swap/currency_pairs` | +| [submitFlashSwapOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2548) | :closed_lock_with_key: | POST | `/flash_swap/orders` | +| [getFlashSwapOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2560) | :closed_lock_with_key: | GET | `/flash_swap/orders` | +| [getFlashSwapOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2572) | :closed_lock_with_key: | GET | `/flash_swap/orders/{order_id}` | +| [submitFlashSwapOrderPreview()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2582) | :closed_lock_with_key: | POST | `/flash_swap/orders/preview` | +| [getFuturesContracts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2599) | | GET | `/futures/{settle}/contracts` | +| [getFuturesContract()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2614) | | GET | `/futures/{settle}/contracts/{contract}` | +| [getFuturesOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2629) | | GET | `/futures/{settle}/order_book` | +| [getFuturesTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2642) | | GET | `/futures/{settle}/trades` | +| [getFuturesCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2657) | | GET | `/futures/{settle}/candlesticks` | +| [getPremiumIndexKLines()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2670) | | GET | `/futures/{settle}/premium_index` | +| [getFuturesTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2683) | | GET | `/futures/{settle}/tickers` | +| [getFundingRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2700) | | GET | `/futures/{settle}/funding_rate` | +| [getBatchFundingRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2716) | | POST | `/futures/{settle}/funding_rates` | +| [getFuturesInsuranceBalanceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2734) | | GET | `/futures/{settle}/insurance` | +| [getFuturesStats()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2753) | | GET | `/futures/{settle}/contract_stats` | +| [getIndexConstituents()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2764) | | GET | `/futures/{settle}/index_constituents/{index}` | +| [getLiquidationHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2781) | | GET | `/futures/{settle}/liq_orders` | +| [getRiskLimitTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2798) | | GET | `/futures/{settle}/risk_limit_tiers` | +| [getFuturesAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2811) | :closed_lock_with_key: | GET | `/futures/{settle}/accounts` | +| [getFuturesAccountBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2825) | :closed_lock_with_key: | GET | `/futures/{settle}/account_book` | +| [getFuturesPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2838) | :closed_lock_with_key: | GET | `/futures/{settle}/positions` | +| [getFuturesPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2853) | :closed_lock_with_key: | GET | `/futures/{settle}/positions/{contract}` | +| [updateFuturesMargin()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2870) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/margin` | +| [updateFuturesLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2898) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/leverage` | +| [getFuturesContractLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2918) | :closed_lock_with_key: | GET | `/futures/{settle}/get_leverage/{contract}` | +| [updateFuturesPositionMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2934) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/cross_mode` | +| [updatePositionRiskLimit()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2951) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/risk_limit` | +| [updateFuturesDualMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2971) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_mode` | +| [getDualModePosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2987) | :closed_lock_with_key: | GET | `/futures/{settle}/dual_comp/positions/{contract}` | +| [updateDualModePositionMargin()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3002) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/margin` | +| [updateDualModePositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3018) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/leverage` | +| [updateDualModePositionRiskLimit()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3042) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/risk_limit` | +| [submitFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3069) | :closed_lock_with_key: | POST | `/futures/{settle}/orders` | +| [getFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3090) | :closed_lock_with_key: | GET | `/futures/{settle}/orders` | +| [cancelAllFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3105) | :closed_lock_with_key: | DELETE | `/futures/{settle}/orders` | +| [getFuturesOrdersByTimeRange()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3125) | :closed_lock_with_key: | GET | `/futures/{settle}/orders_timerange` | +| [submitFuturesBatchOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3148) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_orders` | +| [getFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3173) | :closed_lock_with_key: | GET | `/futures/{settle}/orders/{order_id}` | +| [cancelFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3190) | :closed_lock_with_key: | DELETE | `/futures/{settle}/orders/{order_id}` | +| [updateFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3215) | :closed_lock_with_key: | PUT | `/futures/{settle}/orders/{order_id}` | +| [getFuturesTradingHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3236) | :closed_lock_with_key: | GET | `/futures/{settle}/my_trades` | +| [getFuturesTradingHistoryByTimeRange()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3251) | :closed_lock_with_key: | GET | `/futures/{settle}/my_trades_timerange` | +| [getFuturesPositionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3264) | :closed_lock_with_key: | GET | `/futures/{settle}/position_close` | +| [getFuturesLiquidationHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3277) | :closed_lock_with_key: | GET | `/futures/{settle}/liquidates` | +| [getFuturesAutoDeleveragingHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3290) | :closed_lock_with_key: | GET | `/futures/{settle}/auto_deleverages` | +| [setFuturesOrderCancelCountdown()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3307) | :closed_lock_with_key: | POST | `/futures/{settle}/countdown_cancel_all` | +| [getFuturesUserTradingFees()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3324) | :closed_lock_with_key: | GET | `/futures/{settle}/fee` | +| [batchCancelFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3342) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_cancel_orders` | +| [batchUpdateFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3369) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_amend_orders` | +| [getRiskLimitTable()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3391) | | GET | `/futures/{settle}/risk_limit_table` | +| [submitFuturesPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3404) | :closed_lock_with_key: | POST | `/futures/{settle}/price_orders` | +| [getFuturesAutoOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3417) | :closed_lock_with_key: | GET | `/futures/{settle}/price_orders` | +| [cancelAllOpenFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3430) | :closed_lock_with_key: | DELETE | `/futures/{settle}/price_orders` | +| [getFuturesPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3446) | :closed_lock_with_key: | GET | `/futures/{settle}/price_orders/{order_id}` | +| [cancelFuturesPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3461) | :closed_lock_with_key: | DELETE | `/futures/{settle}/price_orders/{order_id}` | +| [updateFuturesPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3476) | :closed_lock_with_key: | PUT | `/futures/{settle}/price_orders/amend` | +| [createTrailOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3491) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/create` | +| [terminateTrailOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3509) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/stop` | +| [batchTerminateTrailOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3522) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/stop_all` | +| [getTrailOrderList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3537) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/list` | +| [getTrailOrderDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3550) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/detail` | +| [updateTrailOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3568) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/update` | +| [getTrailOrderChangeLog()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3581) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/change_log` | +| [createChaseOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3594) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/create` | +| [stopChaseOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3604) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/stop` | +| [stopAllChaseOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3614) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/stop_all` | +| [getChaseOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3626) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/chase/list` | +| [getChaseOrderDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3634) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/chase/detail` | +| [getFuturesPositionCloseHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3643) | :closed_lock_with_key: | GET | `/futures/{settle}/position_close_history` | +| [getFuturesInsuranceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3652) | :closed_lock_with_key: | GET | `/futures/{settle}/insurance` | +| [getAllDeliveryContracts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3669) | | GET | `/delivery/{settle}/contracts` | +| [getDeliveryContract()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3681) | | GET | `/delivery/{settle}/contracts/{contract}` | +| [getDeliveryOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3696) | | GET | `/delivery/{settle}/order_book` | +| [getDeliveryTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3709) | | GET | `/delivery/{settle}/trades` | +| [getDeliveryCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3723) | | GET | `/delivery/{settle}/candlesticks` | +| [getDeliveryTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3734) | | GET | `/delivery/{settle}/tickers` | +| [getDeliveryInsuranceBalanceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3751) | | GET | `/delivery/{settle}/insurance` | +| [getDeliveryAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3770) | :closed_lock_with_key: | GET | `/delivery/{settle}/accounts` | +| [getDeliveryBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3781) | :closed_lock_with_key: | GET | `/delivery/{settle}/account_book` | +| [getDeliveryPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3792) | :closed_lock_with_key: | GET | `/delivery/{settle}/positions` | +| [getDeliveryPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3802) | :closed_lock_with_key: | GET | `/delivery/{settle}/positions/{contract}` | +| [updateDeliveryMargin()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3817) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/margin` | +| [updateDeliveryLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3835) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/leverage` | +| [updateDeliveryRiskLimit()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3853) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/risk_limit` | +| [submitDeliveryOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3873) | :closed_lock_with_key: | POST | `/delivery/{settle}/orders` | +| [getDeliveryOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3888) | :closed_lock_with_key: | GET | `/delivery/{settle}/orders` | +| [cancelAllDeliveryOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3901) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/orders` | +| [getDeliveryOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3920) | :closed_lock_with_key: | GET | `/delivery/{settle}/orders/{order_id}` | +| [cancelDeliveryOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3935) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/orders/{order_id}` | +| [getDeliveryTradingHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3950) | :closed_lock_with_key: | GET | `/delivery/{settle}/my_trades` | +| [getDeliveryClosedPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3963) | :closed_lock_with_key: | GET | `/delivery/{settle}/position_close` | +| [getDeliveryLiquidationHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3976) | :closed_lock_with_key: | GET | `/delivery/{settle}/liquidates` | +| [getDeliverySettlementHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3989) | :closed_lock_with_key: | GET | `/delivery/{settle}/settlements` | +| [submitDeliveryTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4002) | :closed_lock_with_key: | POST | `/delivery/{settle}/price_orders` | +| [getDeliveryAutoOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4017) | :closed_lock_with_key: | GET | `/delivery/{settle}/price_orders` | +| [cancelAllOpenDeliveryOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4030) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/price_orders` | +| [getDeliveryTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4046) | :closed_lock_with_key: | GET | `/delivery/{settle}/price_orders/{order_id}` | +| [cancelTriggeredDeliveryOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4061) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/price_orders/{order_id}` | +| [getOptionsUnderlyings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4080) | | GET | `/options/underlyings` | +| [getOptionsExpirationTimes()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4090) | | GET | `/options/expirations` | +| [getOptionsContracts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4100) | | GET | `/options/contracts` | +| [getOptionsContract()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4113) | | GET | `/options/contracts/{contract}` | +| [getOptionsSettlementHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4123) | | GET | `/options/settlements` | +| [getOptionsContractSettlement()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4135) | | GET | `/options/settlements/{contract}` | +| [getOptionsMySettlements()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4150) | :closed_lock_with_key: | GET | `/options/my_settlements` | +| [getOptionsOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4164) | | GET | `/options/order_book` | +| [getOptionsTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4176) | | GET | `/options/tickers` | +| [getOptionsUnderlyingTicker()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4190) | | GET | `/options/underlying/tickers/{underlying}` | +| [getOptionsCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4204) | | GET | `/options/candlesticks` | +| [getOptionsUnderlyingCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4214) | | GET | `/options/underlying/candlesticks` | +| [getOptionsTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4226) | | GET | `/options/trades` | +| [getOptionsAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4237) | :closed_lock_with_key: | GET | `/options/accounts` | +| [getOptionsAccountChange()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4247) | :closed_lock_with_key: | GET | `/options/account_book` | +| [getOptionsPositionsUnderlying()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4259) | :closed_lock_with_key: | GET | `/options/positions` | +| [getOptionsPositionContract()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4271) | :closed_lock_with_key: | GET | `/options/positions/{contract}` | +| [getOptionsLiquidation()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4283) | :closed_lock_with_key: | GET | `/options/position_close` | +| [submitOptionsOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4296) | :closed_lock_with_key: | POST | `/options/orders` | +| [getOptionsOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4308) | :closed_lock_with_key: | GET | `/options/orders` | +| [cancelAllOpenOptionsOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4320) | :closed_lock_with_key: | DELETE | `/options/orders` | +| [getOptionsOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4334) | :closed_lock_with_key: | GET | `/options/orders/{order_id}` | +| [amendOptionsOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4346) | :closed_lock_with_key: | PUT | `/options/orders/{order_id}` | +| [cancelOptionsOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4361) | :closed_lock_with_key: | DELETE | `/options/orders/{order_id}` | +| [submitOptionsCountdownCancel()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4380) | :closed_lock_with_key: | POST | `/options/countdown_cancel_all` | +| [getOptionsPersonalHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4396) | :closed_lock_with_key: | GET | `/options/my_trades` | +| [setOptionsMMPSettings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4408) | :closed_lock_with_key: | POST | `/options/mmp` | +| [getOptionsMMPSettings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4420) | :closed_lock_with_key: | GET | `/options/mmp` | +| [resetOptionsMMPSettings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4432) | :closed_lock_with_key: | POST | `/options/mmp/reset` | +| [getLendingCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4448) | | GET | `/earn/uni/currencies` | +| [getLendingCurrency()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4458) | | GET | `/earn/uni/currencies/{currency}` | +| [submitLendOrRedeemOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4468) | :closed_lock_with_key: | POST | `/earn/uni/lends` | +| [getLendingOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4478) | :closed_lock_with_key: | GET | `/earn/uni/lends` | +| [updateLendingOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4490) | :closed_lock_with_key: | PATCH | `/earn/uni/lends` | +| [getLendingRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4503) | :closed_lock_with_key: | GET | `/earn/uni/lend_records` | +| [getLendingTotalInterest()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4516) | :closed_lock_with_key: | GET | `/earn/uni/interests/{currency}` | +| [getLendingInterestRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4529) | :closed_lock_with_key: | GET | `/earn/uni/interest_records` | +| [updateInterestReinvestment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4542) | :closed_lock_with_key: | PUT | `/earn/uni/interest_reinvest` | +| [getLendingInterestStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4558) | :closed_lock_with_key: | GET | `/earn/uni/interest_status/{currency}` | +| [getLendingAnnualizedTrendChart()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4573) | :closed_lock_with_key: | GET | `/earn/uni/chart` | +| [getLendingEstimatedRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4581) | :closed_lock_with_key: | GET | `/earn/uni/rate` | +| [submitMultiLoanOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4598) | :closed_lock_with_key: | POST | `/loan/multi_collateral/orders` | +| [getMultiLoanOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4610) | :closed_lock_with_key: | GET | `/loan/multi_collateral/orders` | +| [getMultiLoanOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4622) | :closed_lock_with_key: | GET | `/loan/multi_collateral/orders/{order_id}` | +| [repayMultiLoan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4632) | :closed_lock_with_key: | POST | `/loan/multi_collateral/repay` | +| [getMultiLoanRepayRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4642) | :closed_lock_with_key: | GET | `/loan/multi_collateral/repay` | +| [updateMultiLoan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4654) | :closed_lock_with_key: | POST | `/loan/multi_collateral/mortgage` | +| [getMultiLoanAdjustmentRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4666) | :closed_lock_with_key: | GET | `/loan/multi_collateral/mortgage` | +| [getMultiLoanCurrencyQuota()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4678) | :closed_lock_with_key: | GET | `/loan/multi_collateral/currency_quota` | +| [getMultiLoanSupportedCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4690) | | GET | `/loan/multi_collateral/currencies` | +| [getMultiLoanRatio()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4699) | | GET | `/loan/multi_collateral/ltv` | +| [getMultiLoanFixedRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4708) | | GET | `/loan/multi_collateral/fixed_rate` | +| [getMultiLoanCurrentRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4721) | | GET | `/loan/multi_collateral/current_rate` | +| [getDualInvestmentProducts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4743) | | GET | `/earn/dual/investment_plan` | +| [getDualInvestmentOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4754) | :closed_lock_with_key: | GET | `/earn/dual/orders` | +| [submitDualInvestmentOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4766) | :closed_lock_with_key: | POST | `/earn/dual/orders` | +| [getDualOrderRefundPreview()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4775) | :closed_lock_with_key: | GET | `/earn/dual/order-refund-preview` | +| [submitDualOrderRefund()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4784) | :closed_lock_with_key: | POST | `/earn/dual/order-refund` | +| [updateDualOrderReinvest()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4793) | :closed_lock_with_key: | POST | `/earn/dual/modify-order-reinvest` | +| [getDualProjectRecommend()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4804) | :closed_lock_with_key: | GET | `/earn/dual/project-recommend` | +| [getEarnFixedTermProducts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4813) | | GET | `/earn/fixed-term/product` | +| [getEarnFixedTermProductsByAsset()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4822) | | GET | `/earn/fixed-term/product/{asset}/list` | +| [createEarnFixedTermLend()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4832) | :closed_lock_with_key: | POST | `/earn/fixed-term/user/lend` | +| [getEarnFixedTermLends()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4841) | :closed_lock_with_key: | GET | `/earn/fixed-term/user/lend` | +| [createEarnFixedTermPreRedeem()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4850) | :closed_lock_with_key: | POST | `/earn/fixed-term/user/pre-redeem` | +| [getEarnFixedTermHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4861) | :closed_lock_with_key: | GET | `/earn/fixed-term/user/history` | +| [createAutoInvestPlan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4870) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/create` | +| [updateAutoInvestPlan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4879) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/update` | +| [stopAutoInvestPlan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4886) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/stop` | +| [addAutoInvestPlanPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4893) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/add_position` | +| [getAutoInvestCoins()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4904) | :closed_lock_with_key: | GET | `/earn/autoinvest/coins` | +| [getAutoInvestMinAmount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4913) | :closed_lock_with_key: | POST | `/earn/autoinvest/min_invest_amount` | +| [getAutoInvestPlanRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4924) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/records` | +| [getAutoInvestOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4933) | :closed_lock_with_key: | GET | `/earn/autoinvest/orders` | +| [getAutoInvestConfig()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4942) | :closed_lock_with_key: | GET | `/earn/autoinvest/config` | +| [getAutoInvestPlanDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4949) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/detail` | +| [getAutoInvestPlans()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4958) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/list_info` | +| [getStakingCoins()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4970) | :closed_lock_with_key: | GET | `/earn/staking/coins` | +| [submitStakingSwap()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4983) | :closed_lock_with_key: | POST | `/earn/staking/swap` | +| [getAccountDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5002) | :closed_lock_with_key: | GET | `/account/detail` | +| [getAccountRateLimit()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5011) | :closed_lock_with_key: | GET | `/account/rate_limit` | +| [createStpGroup()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5021) | :closed_lock_with_key: | POST | `/account/stp_groups` | +| [getStpGroups()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5031) | :closed_lock_with_key: | GET | `/account/stp_groups` | +| [getStpGroupUsers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5041) | :closed_lock_with_key: | GET | `/account/stp_groups/{stp_id}/users` | +| [addUsersToStpGroup()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5051) | :closed_lock_with_key: | POST | `/account/stp_groups/{stp_id}/users` | +| [deleteUserFromStpGroup()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5067) | :closed_lock_with_key: | DELETE | `/account/stp_groups/{stp_id}/users` | +| [setGTDeduction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5085) | :closed_lock_with_key: | POST | `/account/debit_fee` | +| [getGTDeduction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5096) | :closed_lock_with_key: | GET | `/account/debit_fee` | +| [getAccountMainKeys()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5105) | :closed_lock_with_key: | GET | `/account/main_keys` | +| [getAgencyTransactionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5121) | :closed_lock_with_key: | GET | `/rebate/agency/transaction_history` | +| [getAgencyCommissionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5134) | :closed_lock_with_key: | GET | `/rebate/agency/commission_history` | +| [getPartnerTransactionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5148) | :closed_lock_with_key: | GET | `/rebate/partner/transaction_history` | +| [getPartnerCommissionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5163) | :closed_lock_with_key: | GET | `/rebate/partner/commission_history` | +| [getPartnerSubordinateList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5186) | :closed_lock_with_key: | GET | `/rebate/partner/sub_list` | +| [getPartnerAgentDataAggregated()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5196) | :closed_lock_with_key: | GET | `/rebate/partner/data/aggregated` | +| [getBrokerCommissionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5209) | :closed_lock_with_key: | GET | `/rebate/broker/commission_history` | +| [getBrokerTransactionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5222) | :closed_lock_with_key: | GET | `/rebate/broker/transaction_history` | +| [getUserRebateInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5231) | :closed_lock_with_key: | GET | `/rebate/user/info` | +| [createOTCQuote()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5266) | :closed_lock_with_key: | POST | `/otc/quote` | +| [createOTCFiatOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5278) | :closed_lock_with_key: | POST | `/otc/order/create` | +| [createOTCStablecoinOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5292) | :closed_lock_with_key: | POST | `/otc/stable_coin/order/create` | +| [getOTCBankList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5301) | :closed_lock_with_key: | GET | `/otc/bank/list` | +| [getOTCBankListLegacy()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5308) | :closed_lock_with_key: | GET | `/otc/bank_list` | +| [createOTCBank()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5315) | :closed_lock_with_key: | POST | `/otc/bank/delete` | +| [deleteOTCBank()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5326) | :closed_lock_with_key: | POST | `/otc/bank/delete` | +| [setDefaultOTCBank()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5333) | :closed_lock_with_key: | POST | `/otc/bank/set_default` | +| [getOTCBankSupplementChecklist()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5340) | :closed_lock_with_key: | GET | `/otc/bank/bank_supplement_checklist` | +| [submitOTCBankPersonalSupplement()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5349) | :closed_lock_with_key: | POST | `/otc/order/paid` | +| [submitOTCBankEnterpriseSupplement()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5368) | :closed_lock_with_key: | POST | `/otc/order/paid` | +| [markOTCOrderAsPaid()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5404) | :closed_lock_with_key: | POST | `/otc/order/paid` | +| [cancelOTCOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5418) | :closed_lock_with_key: | POST | `/otc/order/cancel` | +| [getOTCFiatOrderList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5430) | :closed_lock_with_key: | GET | `/otc/order/list` | +| [getOTCStablecoinOrderList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5444) | :closed_lock_with_key: | GET | `/otc/stable_coin/order/list` | +| [getOTCFiatOrderDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5458) | :closed_lock_with_key: | GET | `/otc/order/detail` | +| [getP2PMerchantUserInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5472) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_user_info` | +| [getP2PMerchantCounterpartyUserInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5481) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_counterparty_user_info` | +| [getP2PMerchantMyselfPayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5493) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_myself_payment` | +| [getP2PMerchantSpotBalance()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5506) | :closed_lock_with_key: | POST | `/p2p/merchant/account/set_merchant_work_hours` | +| [setP2PMerchantWorkHours()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5515) | :closed_lock_with_key: | POST | `/p2p/merchant/account/set_merchant_work_hours` | +| [getP2PMerchantPendingTransactionList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5526) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_pending_transaction_list` | +| [getP2PMerchantCompletedTransactionList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5538) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_completed_transaction_list` | +| [getP2PMerchantTransactionDetails()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5550) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_transaction_details` | +| [confirmP2PMerchantPayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5562) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/confirm-payment` | +| [confirmP2PMerchantReceipt()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5573) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/confirm-receipt` | +| [cancelP2PMerchantTransaction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5584) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/cancel` | +| [placeP2PMerchantBizPushOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5595) | :closed_lock_with_key: | POST | `/p2p/merchant/books/place_biz_push_order` | +| [updateP2PMerchantAdsStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5606) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_update_status` | +| [getP2PMerchantAdsDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5619) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_detail` | +| [getP2PMerchantMyAdsList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5628) | :closed_lock_with_key: | POST | `/p2p/merchant/books/my_ads_list` | +| [getP2PMerchantAdsList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5639) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_list` | +| [getP2PMerchantChatsList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5648) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/get_chats_list` | +| [sendP2PMerchantChatMessage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5659) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/send_chat_message` | +| [uploadP2PMerchantChatFile()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5670) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/upload_chat_file` | +| [getCrossExSymbols()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5691) | | GET | `/crossex/rule/symbols` | +| [getCrossExRiskLimits()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5703) | | GET | `/crossex/rule/risk_limits` | +| [getCrossExTransferCoins()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5717) | | GET | `/crossex/transfers/coin` | +| [createCrossExTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5731) | :closed_lock_with_key: | POST | `/crossex/transfers` | +| [getCrossExTransferHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5745) | :closed_lock_with_key: | GET | `/crossex/transfers` | +| [createCrossExOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5759) | :closed_lock_with_key: | POST | `/crossex/orders` | +| [cancelBatchCrossExOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5765) | :closed_lock_with_key: | POST | `/crossex/batch_cancel_orders` | +| [cancelCrossExOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5779) | :closed_lock_with_key: | DELETE | `/crossex/orders/{order_id}` | +| [modifyCrossExOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5792) | :closed_lock_with_key: | PUT | `/crossex/orders/{order_id}` | +| [getCrossExOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5807) | :closed_lock_with_key: | GET | `/crossex/orders/{order_id}` | +| [createCrossExConvertQuote()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5819) | :closed_lock_with_key: | POST | `/crossex/convert/quote` | +| [createCrossExConvertOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5833) | :closed_lock_with_key: | POST | `/crossex/convert/orders` | +| [updateCrossExAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5847) | :closed_lock_with_key: | PUT | `/crossex/accounts` | +| [getCrossExAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5861) | :closed_lock_with_key: | GET | `/crossex/accounts` | +| [setCrossExPositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5873) | :closed_lock_with_key: | POST | `/crossex/positions/leverage` | +| [getCrossExPositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5887) | :closed_lock_with_key: | GET | `/crossex/positions/leverage` | +| [setCrossExMarginPositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5901) | :closed_lock_with_key: | POST | `/crossex/margin_positions/leverage` | +| [getCrossExMarginPositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5917) | :closed_lock_with_key: | GET | `/crossex/margin_positions/leverage` | +| [closeCrossExPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5931) | :closed_lock_with_key: | POST | `/crossex/position` | +| [getCrossExInterestRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5945) | :closed_lock_with_key: | GET | `/crossex/interest_rate` | +| [getCrossExFeeRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5958) | :closed_lock_with_key: | GET | `/crossex/fee` | +| [getCrossExPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5970) | :closed_lock_with_key: | GET | `/crossex/positions` | +| [getCrossExMarginPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5984) | :closed_lock_with_key: | GET | `/crossex/margin_positions` | +| [getCrossExAdlRank()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5998) | :closed_lock_with_key: | GET | `/crossex/adl_rank` | +| [getCrossExOpenOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6010) | :closed_lock_with_key: | GET | `/crossex/open_orders` | +| [getCrossExHistoryOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6024) | :closed_lock_with_key: | GET | `/crossex/history_orders` | +| [getCrossExHistoryPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6038) | :closed_lock_with_key: | GET | `/crossex/history_positions` | +| [getCrossExHistoryMarginPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6052) | :closed_lock_with_key: | GET | `/crossex/history_margin_positions` | +| [getCrossExHistoryMarginInterests()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6066) | :closed_lock_with_key: | GET | `/crossex/history_margin_interests` | +| [getCrossExHistoryTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6080) | :closed_lock_with_key: | GET | `/crossex/history_trades` | +| [getCrossExAccountBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6094) | :closed_lock_with_key: | GET | `/crossex/account_book` | +| [getCrossExCoinDiscountRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6108) | :closed_lock_with_key: | GET | `/crossex/coin_discount_rate` | +| [listCrossExMarketTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6114) | | GET | `/crossex/market/tickers` | +| [listCrossExMarketFundingInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6120) | | GET | `/crossex/market/funding_info` | +| [getAlphaAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6138) | :closed_lock_with_key: | GET | `/alpha/accounts` | +| [getAlphaAccountBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6150) | :closed_lock_with_key: | GET | `/alpha/account_book` | +| [createAlphaQuote()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6164) | :closed_lock_with_key: | POST | `/alpha/quote` | +| [createAlphaOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6176) | :closed_lock_with_key: | POST | `/alpha/orders` | +| [getAlphaOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6188) | :closed_lock_with_key: | GET | `/alpha/orders` | +| [getAlphaOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6200) | :closed_lock_with_key: | GET | `/alpha/order` | +| [getAlphaCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6212) | | GET | `/alpha/currencies` | +| [getAlphaTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6224) | | GET | `/alpha/tickers` | +| [getTradFiMT5Account()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6230) | :closed_lock_with_key: | GET | `/tradfi/users/mt5-account` | +| [getTradFiSymbolCategories()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6234) | | GET | `/tradfi/symbols/categories` | +| [getTradFiSymbols()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6240) | | GET | `/tradfi/symbols` | +| [getTradFiSymbolCommissions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6244) | | GET | `/tradfi/symbols/commissions` | +| [getTradFiSymbolDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6250) | :closed_lock_with_key: | GET | `/tradfi/symbols/detail` | +| [getTradFiKlines()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6256) | | GET | `/tradfi/symbols/{symbol}/klines` | +| [getTradFiTicker()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6263) | | GET | `/tradfi/symbols/{symbol}/tickers` | +| [createTradFiUser()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6267) | :closed_lock_with_key: | POST | `/tradfi/users` | +| [getTradFiAssets()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6271) | :closed_lock_with_key: | GET | `/tradfi/users/assets` | +| [createTradFiTransaction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6275) | :closed_lock_with_key: | POST | `/tradfi/transactions` | +| [getTradFiTransactions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6281) | :closed_lock_with_key: | GET | `/tradfi/transactions` | +| [createTradFiOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6287) | :closed_lock_with_key: | POST | `/tradfi/orders` | +| [getTradFiOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6293) | :closed_lock_with_key: | GET | `/tradfi/orders` | +| [modifyTradFiOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6297) | :closed_lock_with_key: | PUT | `/tradfi/orders/{orderId}` | +| [cancelTradFiOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6304) | :closed_lock_with_key: | DELETE | `/tradfi/orders/{orderId}` | +| [getTradFiOrderHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6308) | :closed_lock_with_key: | GET | `/tradfi/orders/history` | +| [getTradFiPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6314) | :closed_lock_with_key: | GET | `/tradfi/positions` | +| [modifyTradFiPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6320) | :closed_lock_with_key: | PUT | `/tradfi/positions/{positionId}` | +| [closeTradFiPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6329) | :closed_lock_with_key: | POST | `/tradfi/positions/{positionId}/close` | +| [getTradFiPositionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6338) | :closed_lock_with_key: | GET | `/tradfi/positions/history` | +| [getTradFiOrderLog()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6347) | :closed_lock_with_key: | GET | `/tradfi/orders/log/{log_id}` | +| [getStockUserAssets()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6355) | :closed_lock_with_key: | GET | `/stock/users/assets` | +| [getStockSymbols()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6361) | | GET | `/stock/symbols` | +| [getStockSymbolDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6367) | :closed_lock_with_key: | GET | `/stock/symbols/detail` | +| [getStockOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6373) | | GET | `/stock/market/{symbol}/orderbook` | +| [getStockOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6377) | :closed_lock_with_key: | GET | `/stock/orders` | +| [createStockOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6383) | :closed_lock_with_key: | POST | `/stock/orders` | +| [cancelAllStockOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6389) | :closed_lock_with_key: | DELETE | `/stock/orders` | +| [getStockOrderHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6393) | :closed_lock_with_key: | GET | `/stock/orders/history` | +| [updateStockOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6399) | :closed_lock_with_key: | PUT | `/stock/orders/{orderId}` | +| [cancelStockOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6406) | :closed_lock_with_key: | DELETE | `/stock/orders/{orderId}` | +| [getStockPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6412) | :closed_lock_with_key: | GET | `/stock/positions` | +| [closeStockPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6418) | :closed_lock_with_key: | POST | `/stock/positions/close` | +| [getStockTransactions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6424) | :closed_lock_with_key: | GET | `/stock/transactions` | +| [createStockTransaction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6430) | :closed_lock_with_key: | POST | `/stock/transactions` | +| [getStockExchanges()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6436) | | GET | `/stock/exchanges` | +| [getStockFeeRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6440) | | GET | `/stock/fee-rate` | # WebsocketAPIClient.ts diff --git a/examples/apidoc/RestClient/cancelAllStockOrders.js b/examples/apidoc/RestClient/cancelAllStockOrders.js new file mode 100644 index 0000000..273c17f --- /dev/null +++ b/examples/apidoc/RestClient/cancelAllStockOrders.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/orders +// METHOD: DELETE +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.cancelAllStockOrders(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/cancelBatchCrossExOrders.js b/examples/apidoc/RestClient/cancelBatchCrossExOrders.js new file mode 100644 index 0000000..c06d85d --- /dev/null +++ b/examples/apidoc/RestClient/cancelBatchCrossExOrders.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /crossex/batch_cancel_orders +// METHOD: POST +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.cancelBatchCrossExOrders(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/cancelSpotPovOrder.js b/examples/apidoc/RestClient/cancelSpotPovOrder.js new file mode 100644 index 0000000..95034bf --- /dev/null +++ b/examples/apidoc/RestClient/cancelSpotPovOrder.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /spot/pov_orders/{order_id}/cancel +// METHOD: POST +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.cancelSpotPovOrder(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/cancelSpotPovOrders.js b/examples/apidoc/RestClient/cancelSpotPovOrders.js new file mode 100644 index 0000000..887f5c3 --- /dev/null +++ b/examples/apidoc/RestClient/cancelSpotPovOrders.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /spot/pov_orders/cancel +// METHOD: POST +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.cancelSpotPovOrders(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/cancelStockOrder.js b/examples/apidoc/RestClient/cancelStockOrder.js new file mode 100644 index 0000000..f4a9ccb --- /dev/null +++ b/examples/apidoc/RestClient/cancelStockOrder.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/orders/{orderId} +// METHOD: DELETE +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.cancelStockOrder(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/closeStockPosition.js b/examples/apidoc/RestClient/closeStockPosition.js new file mode 100644 index 0000000..5806fa8 --- /dev/null +++ b/examples/apidoc/RestClient/closeStockPosition.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/positions/close +// METHOD: POST +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.closeStockPosition(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/createSpotPovOrder.js b/examples/apidoc/RestClient/createSpotPovOrder.js new file mode 100644 index 0000000..2215de6 --- /dev/null +++ b/examples/apidoc/RestClient/createSpotPovOrder.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /spot/pov_orders +// METHOD: POST +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.createSpotPovOrder(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/createStockOrder.js b/examples/apidoc/RestClient/createStockOrder.js new file mode 100644 index 0000000..0ff3fe1 --- /dev/null +++ b/examples/apidoc/RestClient/createStockOrder.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/orders +// METHOD: POST +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.createStockOrder(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/createStockTransaction.js b/examples/apidoc/RestClient/createStockTransaction.js new file mode 100644 index 0000000..01b6597 --- /dev/null +++ b/examples/apidoc/RestClient/createStockTransaction.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/transactions +// METHOD: POST +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.createStockTransaction(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getSpotPovOrder.js b/examples/apidoc/RestClient/getSpotPovOrder.js new file mode 100644 index 0000000..737bb89 --- /dev/null +++ b/examples/apidoc/RestClient/getSpotPovOrder.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /spot/pov_orders/{order_id} +// METHOD: GET +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getSpotPovOrder(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getStockExchanges.js b/examples/apidoc/RestClient/getStockExchanges.js new file mode 100644 index 0000000..750dab7 --- /dev/null +++ b/examples/apidoc/RestClient/getStockExchanges.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/exchanges +// METHOD: GET +// PUBLIC: YES + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getStockExchanges(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getStockFeeRate.js b/examples/apidoc/RestClient/getStockFeeRate.js new file mode 100644 index 0000000..fb30716 --- /dev/null +++ b/examples/apidoc/RestClient/getStockFeeRate.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/fee-rate +// METHOD: GET +// PUBLIC: YES + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getStockFeeRate(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getStockOrderBook.js b/examples/apidoc/RestClient/getStockOrderBook.js new file mode 100644 index 0000000..615a061 --- /dev/null +++ b/examples/apidoc/RestClient/getStockOrderBook.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/market/{symbol}/orderbook +// METHOD: GET +// PUBLIC: YES + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getStockOrderBook(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getStockOrderHistory.js b/examples/apidoc/RestClient/getStockOrderHistory.js new file mode 100644 index 0000000..ce647a0 --- /dev/null +++ b/examples/apidoc/RestClient/getStockOrderHistory.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/orders/history +// METHOD: GET +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getStockOrderHistory(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getStockOrders.js b/examples/apidoc/RestClient/getStockOrders.js new file mode 100644 index 0000000..53fb600 --- /dev/null +++ b/examples/apidoc/RestClient/getStockOrders.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/orders +// METHOD: GET +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getStockOrders(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getStockPositions.js b/examples/apidoc/RestClient/getStockPositions.js new file mode 100644 index 0000000..8fc945a --- /dev/null +++ b/examples/apidoc/RestClient/getStockPositions.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/positions +// METHOD: GET +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getStockPositions(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getStockSymbolDetail.js b/examples/apidoc/RestClient/getStockSymbolDetail.js new file mode 100644 index 0000000..f9e4ea5 --- /dev/null +++ b/examples/apidoc/RestClient/getStockSymbolDetail.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/symbols/detail +// METHOD: GET +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getStockSymbolDetail(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getStockSymbols.js b/examples/apidoc/RestClient/getStockSymbols.js new file mode 100644 index 0000000..74d07c8 --- /dev/null +++ b/examples/apidoc/RestClient/getStockSymbols.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/symbols +// METHOD: GET +// PUBLIC: YES + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getStockSymbols(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getStockTransactions.js b/examples/apidoc/RestClient/getStockTransactions.js new file mode 100644 index 0000000..a662e99 --- /dev/null +++ b/examples/apidoc/RestClient/getStockTransactions.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/transactions +// METHOD: GET +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getStockTransactions(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getStockUserAssets.js b/examples/apidoc/RestClient/getStockUserAssets.js new file mode 100644 index 0000000..8dc7df6 --- /dev/null +++ b/examples/apidoc/RestClient/getStockUserAssets.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/users/assets +// METHOD: GET +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getStockUserAssets(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getTradFiSymbolCommissions.js b/examples/apidoc/RestClient/getTradFiSymbolCommissions.js new file mode 100644 index 0000000..852576b --- /dev/null +++ b/examples/apidoc/RestClient/getTradFiSymbolCommissions.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /tradfi/symbols/commissions +// METHOD: GET +// PUBLIC: YES + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getTradFiSymbolCommissions(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/getTransfer.js b/examples/apidoc/RestClient/getTransfer.js new file mode 100644 index 0000000..5ba4658 --- /dev/null +++ b/examples/apidoc/RestClient/getTransfer.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /wallet/transfers +// METHOD: GET +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.getTransfer(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/listCrossExMarketFundingInfo.js b/examples/apidoc/RestClient/listCrossExMarketFundingInfo.js new file mode 100644 index 0000000..6ecff44 --- /dev/null +++ b/examples/apidoc/RestClient/listCrossExMarketFundingInfo.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /crossex/market/funding_info +// METHOD: GET +// PUBLIC: YES + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.listCrossExMarketFundingInfo(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/listCrossExMarketTickers.js b/examples/apidoc/RestClient/listCrossExMarketTickers.js new file mode 100644 index 0000000..a49d943 --- /dev/null +++ b/examples/apidoc/RestClient/listCrossExMarketTickers.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /crossex/market/tickers +// METHOD: GET +// PUBLIC: YES + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.listCrossExMarketTickers(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/listSpotPovOrders.js b/examples/apidoc/RestClient/listSpotPovOrders.js new file mode 100644 index 0000000..0b04379 --- /dev/null +++ b/examples/apidoc/RestClient/listSpotPovOrders.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /spot/pov_orders +// METHOD: GET +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.listSpotPovOrders(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/setUserLeverage.js b/examples/apidoc/RestClient/setUserLeverage.js new file mode 100644 index 0000000..0626f0d --- /dev/null +++ b/examples/apidoc/RestClient/setUserLeverage.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /unified/leverage/user_setting +// METHOD: POST +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.setUserLeverage(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClient/updateStockOrder.js b/examples/apidoc/RestClient/updateStockOrder.js new file mode 100644 index 0000000..50cfe5a --- /dev/null +++ b/examples/apidoc/RestClient/updateStockOrder.js @@ -0,0 +1,22 @@ +import { RestClient } from 'gateio-api'; +// or, if require is preferred: +// const { RestClient } = require('gateio-api'); + +// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange +// This Gate.io API SDK is available on npm via "npm install gateio-api" +// ENDPOINT: /stock/orders/{orderId} +// METHOD: PUT +// PUBLIC: NO + +const client = new RestClient({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', +}); + +client.updateStockOrder(params) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/llms.txt b/llms.txt index 5062963..52bb67f 100644 --- a/llms.txt +++ b/llms.txt @@ -48,6 +48,8 @@ Notes: ================================================================ Directory Structure ================================================================ +docs/ + GATE_SDK_QUICKSTART_GUIDE.md examples/ Rest/ futures/ @@ -113,6 +115,7 @@ src/ p2pMerchant.ts rebate.ts spot.ts + stock.ts subaccount.ts tradfi.ts unified.ts @@ -137,6 +140,7 @@ src/ p2pMerchant.ts rebate.ts spot.ts + stock.ts subaccount.ts tradfi.ts unified.ts @@ -158,6 +162,7 @@ webpack/ .gitignore .nvmrc .prettierrc +check-july2026-gaps.ts jest.config.ts LICENSE.md package.json @@ -189,6 +194,136 @@ Most examples also have minimal typescript, so if you rename them to "js" they s node ./examples/spot/getTickers.js ``` +================ +File: src/lib/websocket/websocket-util.ts +================ +import WebSocket from 'isomorphic-ws'; +⋮---- +import { WSAPIRequest } from '../../types/websockets/requests.js'; +import { + FuturesWSAPITopic, + SpotWSAPITopic, +} from '../../types/websockets/wsAPI.js'; +⋮---- +/** + * Should be one WS key per unique URL. Some URLs may need a suffix. + */ +⋮---- +/** + * Spot & Margin + * https://www.gate.io/docs/developers/apiv4/ws/en/ + */ +⋮---- +/** + * Perpetual futures (USDT) + * https://www.gate.io/docs/developers/futures/ws/en/#gate-io-futures-websocket-v4 + */ +⋮---- +/** + * Perpetual futures (BTC) + * https://www.gate.io/docs/developers/futures/ws/en/#gate-io-futures-websocket-v4 + */ +⋮---- +/** + * Delivery Futures (USDT) + * https://www.gate.io/docs/developers/delivery/ws/en/ + */ +⋮---- +/** + * Delivery Futures (BTC) + * https://www.gate.io/docs/developers/delivery/ws/en/ + */ +⋮---- +/** + * Options + * https://www.gate.io/docs/developers/options/ws/en/ + */ +⋮---- +/** + * Announcements V4 + * https://www.gate.io/docs/developers/options/ws/en/ + */ +⋮---- +/** 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 type FuturesWsKey = + | typeof WS_KEY_MAP.perpFuturesUSDTV4 + | typeof WS_KEY_MAP.perpFuturesBTCV4 + | typeof WS_KEY_MAP.deliveryFuturesUSDTV4 + | typeof WS_KEY_MAP.deliveryFuturesBTCV4; +⋮---- +export type WsMarket = 'all'; +⋮---- +/** + * Normalised internal format for a request (subscribe/unsubscribe/etc) on a topic, with optional parameters. + * + * - Topic: the topic this event is for + * - Payload: the parameters to include, optional. E.g. auth requires key + sign. Some topics allow configurable parameters. + */ +export interface WsTopicRequest< + TWSTopic extends string = string, + TWSPayload = any, +> { + topic: TWSTopic; + payload?: TWSPayload; +} +⋮---- +/** + * Conveniently allow users to request a topic either as string topics or objects (containing string topic + params) + */ +export type WsTopicRequestOrStringTopic< + TWSTopic extends string, + TWSPayload = any, +> = WsTopicRequest | string; +⋮---- +/** + * Some exchanges have two livenet environments, some have test environments, some dont. This allows easy flexibility for different exchanges. + * Examples: + * - One livenet and one testnet: NetworkMap<'livenet' | 'testnet'> + * - One livenet, sometimes two, one testnet: NetworkMap<'livenet' | 'testnet', 'livenet2'> + * - Only one livenet, no other networks: NetworkMap<'livenet'> + */ +type NetworkMap< + TRequiredKeys extends string, + TOptionalKeys extends string | undefined = undefined, +> = Record & + (TOptionalKeys extends string + ? Record + : Record); +⋮---- +export function neverGuard(x: never, msg: string): Error +⋮---- +/** + * WS API promises are stored using a primary key. This key is constructed using + * properties found in every request & reply. + */ +export function getPromiseRefForWSAPIRequest( + requestEvent: WSAPIRequest, +): string +⋮---- +export function getPrivateSpotTopics(): string[] +⋮---- +// Consumeable channels for spot +⋮---- +// WebSocket API for spot +⋮---- +export function getPrivateFuturesTopics(): string[] +⋮---- +// These are the same for perps vs delivery futures +⋮---- +export function getPrivateOptionsTopics(): string[] +⋮---- +/** + * ws.terminate() is undefined in browsers. + * This only works in node.js, not in browsers. + * Does nothing if `ws` is undefined. Does nothing in browsers. + */ +export function safeTerminateWs( + ws?: WebSocket | any, + fallbackToClose?: boolean, +): boolean + ================ File: src/lib/websocket/WsStore.types.ts ================ @@ -416,6 +551,37 @@ export interface MessageEventLike { ⋮---- export function isMessageEvent(msg: unknown): msg is MessageEventLike +================ +File: src/lib/webCryptoAPI.ts +================ +import { neverGuard } from './misc-util.js'; +⋮---- +function bufferToB64(buffer: ArrayBuffer): string +⋮---- +export type SignEncodeMethod = 'hex' | 'base64'; +export type SignAlgorithm = 'SHA-256' | 'SHA-512'; +⋮---- +/** + * Similar to node crypto's `createHash()` function + */ +export async function hashMessage( + message: string, + method: SignEncodeMethod, + algorithm: SignAlgorithm, +): Promise +⋮---- +/** + * Sign a message, with a secret, using the Web Crypto API + */ +export async function signMessage( + message: string, + secret: string, + method: SignEncodeMethod, + algorithm: SignAlgorithm, +): Promise +⋮---- +export function checkWebCryptoAPISupported() + ================ File: src/types/request/account.ts ================ @@ -839,6 +1005,93 @@ export interface GetMultiLoanAdjustmentRecordsReq { collateral_currency?: string; } +================ +File: src/types/request/stock.ts +================ +/** Stock / TradFi Spot API request types */ +⋮---- +export interface GetStockUserAssetsReq { + pnl_calc_type?: number; + pnl_calc_price?: number; +} +⋮---- +export interface GetStockSymbolsReq { + symbols?: string; + exchange?: string; + with_desc_i18n?: boolean; + page?: number; + page_size?: number; +} +⋮---- +export interface GetStockSymbolDetailReq { + symbols?: string; + exchange?: string; + page?: number; + page_size?: number; +} +⋮---- +export interface GetStockOrdersReq { + symbol?: string; +} +⋮---- +export interface CreateStockOrderReq { + volume: string; + symbol: string; + side: 1 | 2; + price_type: 'market' | 'limit'; + /** Limit: all only; market: regular only */ + trading_session: 'all' | 'regular'; + time_in_force: 'day'; + price?: string; + client_order_id?: string; +} +⋮---- +/** Limit: all only; market: regular only */ +⋮---- +export interface GetStockOrderHistoryReq { + symbol?: string; + order_ids?: string; + begin_time?: number; + end_time?: number; + side?: 1 | 2; + page?: number; + page_size?: number; +} +⋮---- +export interface UpdateStockOrderReq { + volume: string; + price: string; +} +⋮---- +export interface GetStockPositionsReq { + pnl_calc_type?: number; + pnl_calc_price?: number; + symbol?: string; + exchange?: string; +} +⋮---- +export interface CloseStockPositionReq { + symbol: string; + close_type: 1 | 2; + close_volume?: string; +} +⋮---- +export interface GetStockTransactionsReq { + begin_time?: number; + end_time?: number; + ref_id?: string; + type?: string; + page?: number; + page_size?: number; +} +⋮---- +export interface CreateStockTransactionReq { + asset: string; + change: string; + type: 'deposit' | 'withdraw'; + ref_id: string; +} + ================ File: src/types/request/subaccount.ts ================ @@ -1052,45 +1305,268 @@ export interface SubmitFlashSwapOrderPreviewResp { } ================ -File: src/types/response/subaccount.ts +File: src/types/response/stock.ts ================ -export interface SubAccount { - remark?: string; - login_name: string; - password?: string; - email?: string; - state: number; - type: number; - user_id: number; - create_time: number; -} +/** Stock / TradFi Spot API response types */ ⋮---- -export interface CreatedSubAccountAPIKey { - user_id: string; - mode?: number; - name?: string; - perms?: { - name?: - | 'wallet' - | 'spot' - | 'futures' - | 'delivery' - | 'earn' - | 'options' - | 'account' - | 'unified' - | 'loan'; - read_only?: boolean; - }[]; - ip_whitelist?: string[]; - key: string; - state: number; - created_at: number; - updated_at: number; - last_access: number; +export interface StockApiResp { + timestamp?: number; + data?: T; + code?: number; + message?: string; + label?: string; } ⋮---- -export interface SubAccountAPIKey { +export interface StockListData { + list?: T[]; + total?: number; + total_page?: number; +} +⋮---- +export interface StockUserAssets { + equity?: string; + balance?: string; + available?: string; + position_market_value?: string; + position_pnl?: string; + today_pnl?: string; + user_exists?: boolean; +} +⋮---- +export interface StockSymbolDescI18n { + lang?: string; + value?: string; +} +⋮---- +export interface StockSymbolItem { + symbol?: string; + exchange?: string; + exchange_desc?: string; + quote_currency?: string; + quote_currency_precision?: number; + fx_rate?: string; + symbol_desc?: string; + category?: string; + trade_status?: string; + trade_mode?: number; + order_fill_timing?: number; + icon_link?: string; + quote_currency_symbol?: string; + price_precision?: number; + volume_precision?: number; + is_ipo?: boolean; + ipo_price?: string; + sell_price_protection?: string; + buy_price_protection?: string; + symbol_descs?: StockSymbolDescI18n[]; + timestamp?: number; +} +⋮---- +export interface StockSymbolDetailItem { + symbol?: string; + exchange?: string; + exchange_desc?: string; + quote_currency?: string; + quote_currency_precision?: number; + fx_rate?: string; + symbol_desc?: string; + category?: string; + settlement_currency?: string; + max_order_volume?: string; + step_order_volume?: string; + min_order_volume?: string; + price_precision?: number; + volume_precision?: number; + is_ipo?: boolean; + ipo_price?: string; + price_protection?: string; + sell_price_protection?: string; + buy_price_protection?: string; + slippage_rate?: string; + commission_rate?: string; + trade_status?: string; + trade_mode?: number; + order_fill_timing?: number; + symbol_descs?: StockSymbolDescI18n[]; + [key: string]: unknown; +} +⋮---- +export interface StockOrderBookLevel { + p?: string; + user_order?: boolean; + [key: string]: unknown; +} +⋮---- +export interface StockOrderBook { + symbol?: string; + bids?: StockOrderBookLevel[]; + asks?: StockOrderBookLevel[]; + timestamp?: number; +} +⋮---- +export interface StockOrderItem { + order_id?: string; + symbol?: string; + exchange?: string; + quote_currency?: string; + fx_rate?: string; + symbol_desc?: string; + trade_status?: string; + trade_mode?: number; + price_type?: string; + side?: number; + status?: number; + volume?: string; + fill_volume?: string; + price?: string; + time_setup?: number; + time_update?: number; + max_order_volume?: string; + step_order_volume?: string; + min_order_volume?: string; + price_precision?: number; + price_protection?: string; + sell_price_protection?: string; + buy_price_protection?: string; + commission_rate?: string; + slippage_rate?: string; + [key: string]: unknown; +} +⋮---- +export interface StockCreateOrderResult { + id?: string; +} +⋮---- +export interface StockOrderHistoryItem { + order_id?: string; + symbol?: string; + exchange?: string; + quote_currency?: string; + fx_rate?: string; + symbol_desc?: string; + price_type?: string; + status?: number; + status_desc?: string; + status_detail?: { title?: string; message?: string } | null; + finish_as?: number; + side?: number; + time_in_force?: string; + volume?: string; + fill_volume?: string; + price?: string; + avg_fill_price?: string | null; + commission?: string; + time_setup?: number; + time_done?: number; + [key: string]: unknown; +} +⋮---- +export interface StockUpdateOrderResult { + order_id?: number; +} +⋮---- +export interface StockPositionItem { + symbol?: string; + exchange?: string; + quote_currency?: string; + quote_currency_precision?: number; + fx_rate?: string; + trade_status?: string; + symbol_desc?: string; + position_pnl?: string; + today_pnl?: string; + pnl_rate?: string; + today_sell_amount?: string; + today_buy_amount?: string; + today_sell_volume?: string; + today_buy_volume?: string; + yesterday_volume?: string; + volume?: string; + available?: string; + transfer_out_pending_qty?: string; + avg_cost_price?: string; + diluted_cost_price?: string; + last_price?: string; + extended_last_price?: string | null; + max_order_volume?: string; + step_order_volume?: string; + min_order_volume?: string; + price_precision?: number; + price_protection?: string; + [key: string]: unknown; +} +⋮---- +export interface StockClosePositionResult { + order_id?: number; +} +⋮---- +export interface StockTransactionItem { + asset?: string; + symbol?: string; + symbol_display?: string; + type?: string; + type_desc?: string; + change?: string; + balance?: string; + ref_id?: string; + time?: number; + unit_text?: string; + detail?: object; +} +⋮---- +export interface StockExchangeItem { + exchange?: string; + exchange_desc?: string; + icon_link?: string; + support_transfer?: boolean; +} +⋮---- +export interface StockFeeRateItem { + vip_level?: number; + maker_fee?: string; + taker_fee?: string; +} + +================ +File: src/types/response/subaccount.ts +================ +export interface SubAccount { + remark?: string; + login_name: string; + password?: string; + email?: string; + state: number; + type: number; + user_id: number; + create_time: number; +} +⋮---- +export interface CreatedSubAccountAPIKey { + user_id: string; + mode?: number; + name?: string; + perms?: { + name?: + | 'wallet' + | 'spot' + | 'futures' + | 'delivery' + | 'earn' + | 'options' + | 'account' + | 'unified' + | 'loan'; + read_only?: boolean; + }[]; + ip_whitelist?: string[]; + key: string; + state: number; + created_at: number; + updated_at: number; + last_access: number; +} +⋮---- +export interface SubAccountAPIKey { user_id?: string; mode?: number; name?: string; @@ -1873,11 +2349,6 @@ File: .eslintrc.cjs ================ // 'no-unused-vars': ['warn'], -================ -File: .nvmrc -================ -v22.17.0 - ================ File: .prettierrc ================ @@ -1887,6 +2358,15 @@ File: .prettierrc "trailingComma": "all" } +================ +File: check-july2026-gaps.ts +================ +/** + * ponytail: assert new July/Aug 2026 endpoints exist on RestClient. + * Run after build: node --input-type=module check-july2026-gaps.ts + */ +import { RestClient } from './dist/mjs/RestClient.js'; + ================ File: jest.config.ts ================ @@ -3174,192 +3654,62 @@ async function start() // ); ================ -File: src/lib/websocket/websocket-util.ts +File: src/lib/websocket/WsStore.ts ================ import WebSocket from 'isomorphic-ws'; ⋮---- -import { WSAPIRequest } from '../../types/websockets/requests.js'; +import { DefaultLogger } from '../logger.js'; import { - FuturesWSAPITopic, - SpotWSAPITopic, -} from '../../types/websockets/wsAPI.js'; + DeferredPromise, + WSConnectedResult, + WsConnectionStateEnum, + WsStoredState, +} from './WsStore.types.js'; ⋮---- /** - * Should be one WS key per unique URL. Some URLs may need a suffix. + * Simple comparison of two objects, recursive for nested objects */ +export function isDeepObjectMatch(object1: unknown, object2: unknown): boolean ⋮---- -/** - * Spot & Margin - * https://www.gate.io/docs/developers/apiv4/ws/en/ - */ +type DeferredPromiseRef = + (typeof DEFERRED_PROMISE_REF)[keyof typeof DEFERRED_PROMISE_REF]; ⋮---- -/** - * Perpetual futures (USDT) - * https://www.gate.io/docs/developers/futures/ws/en/#gate-io-futures-websocket-v4 - */ +export class WsStore< +WsKey extends string, ⋮---- -/** - * Perpetual futures (BTC) - * https://www.gate.io/docs/developers/futures/ws/en/#gate-io-futures-websocket-v4 - */ +constructor(logger: DefaultLogger) ⋮---- -/** - * Delivery Futures (USDT) - * https://www.gate.io/docs/developers/delivery/ws/en/ - */ +/** Get WS stored state for key, optionally create if missing */ +get( + key: WsKey, + createIfMissing?: true, + ): WsStoredState; ⋮---- -/** - * Delivery Futures (BTC) - * https://www.gate.io/docs/developers/delivery/ws/en/ - */ +get( + key: WsKey, + createIfMissing?: false, + ): WsStoredState | undefined; ⋮---- -/** - * Options - * https://www.gate.io/docs/developers/options/ws/en/ - */ +get( + key: WsKey, + createIfMissing?: boolean, +): WsStoredState | undefined ⋮---- -/** - * Announcements V4 - * https://www.gate.io/docs/developers/options/ws/en/ - */ +getKeys(): WsKey[] ⋮---- -/** This is used to differentiate between each of the available websocket streams */ -export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP]; +create(key: WsKey): WsStoredState | undefined ⋮---- -export type FuturesWsKey = - | typeof WS_KEY_MAP.perpFuturesUSDTV4 - | typeof WS_KEY_MAP.perpFuturesBTCV4 - | typeof WS_KEY_MAP.deliveryFuturesUSDTV4 - | typeof WS_KEY_MAP.deliveryFuturesBTCV4; +delete(key: WsKey): void ⋮---- -export type WsMarket = 'all'; +// TODO: should we allow this at all? Perhaps block this from happening... ⋮---- -/** - * Normalised internal format for a request (subscribe/unsubscribe/etc) on a topic, with optional parameters. - * - * - Topic: the topic this event is for - * - Payload: the parameters to include, optional. E.g. auth requires key + sign. Some topics allow configurable parameters. - */ -export interface WsTopicRequest< - TWSTopic extends string = string, - TWSPayload = any, -> { - topic: TWSTopic; - payload?: TWSPayload; -} +/* connection websocket */ ⋮---- -/** - * Conveniently allow users to request a topic either as string topics or objects (containing string topic + params) - */ -export type WsTopicRequestOrStringTopic< - TWSTopic extends string, - TWSPayload = any, -> = WsTopicRequest | string; -⋮---- -/** - * Some exchanges have two livenet environments, some have test environments, some dont. This allows easy flexibility for different exchanges. - * Examples: - * - One livenet and one testnet: NetworkMap<'livenet' | 'testnet'> - * - One livenet, sometimes two, one testnet: NetworkMap<'livenet' | 'testnet', 'livenet2'> - * - Only one livenet, no other networks: NetworkMap<'livenet'> - */ -type NetworkMap< - TRequiredKeys extends string, - TOptionalKeys extends string | undefined = undefined, -> = Record & - (TOptionalKeys extends string - ? Record - : Record); -⋮---- -export function neverGuard(x: never, msg: string): Error -⋮---- -/** - * WS API promises are stored using a primary key. This key is constructed using - * properties found in every request & reply. - */ -export function getPromiseRefForWSAPIRequest( - requestEvent: WSAPIRequest, -): string -⋮---- -export function getPrivateSpotTopics(): string[] -⋮---- -// Consumeable channels for spot -⋮---- -// WebSocket API for spot -⋮---- -export function getPrivateFuturesTopics(): string[] -⋮---- -// These are the same for perps vs delivery futures -⋮---- -export function getPrivateOptionsTopics(): string[] -⋮---- -/** - * ws.terminate() is undefined in browsers. - * This only works in node.js, not in browsers. - * Does nothing if `ws` is undefined. Does nothing in browsers. - */ -export function safeTerminateWs( - ws?: WebSocket | any, - fallbackToClose?: boolean, -): boolean - -================ -File: src/lib/websocket/WsStore.ts -================ -import WebSocket from 'isomorphic-ws'; -⋮---- -import { DefaultLogger } from '../logger.js'; -import { - DeferredPromise, - WSConnectedResult, - WsConnectionStateEnum, - WsStoredState, -} from './WsStore.types.js'; -⋮---- -/** - * Simple comparison of two objects, recursive for nested objects - */ -export function isDeepObjectMatch(object1: unknown, object2: unknown): boolean -⋮---- -type DeferredPromiseRef = - (typeof DEFERRED_PROMISE_REF)[keyof typeof DEFERRED_PROMISE_REF]; -⋮---- -export class WsStore< -WsKey extends string, -⋮---- -constructor(logger: DefaultLogger) -⋮---- -/** Get WS stored state for key, optionally create if missing */ -get( - key: WsKey, - createIfMissing?: true, - ): WsStoredState; -⋮---- -get( - key: WsKey, - createIfMissing?: false, - ): WsStoredState | undefined; -⋮---- -get( - key: WsKey, - createIfMissing?: boolean, -): WsStoredState | undefined -⋮---- -getKeys(): WsKey[] -⋮---- -create(key: WsKey): WsStoredState | undefined -⋮---- -delete(key: WsKey): void -⋮---- -// TODO: should we allow this at all? Perhaps block this from happening... -⋮---- -/* connection websocket */ -⋮---- -hasExistingActiveConnection(key: WsKey): boolean -⋮---- -getWs(key: WsKey): WebSocket | undefined -⋮---- -setWs(key: WsKey, wsConnection: WebSocket): WebSocket +hasExistingActiveConnection(key: WsKey): boolean +⋮---- +getWs(key: WsKey): WebSocket | undefined +⋮---- +setWs(key: WsKey, wsConnection: WebSocket): WebSocket ⋮---- /** * deferred promises @@ -3478,2836 +3828,4596 @@ deleteTopic(key: WsKey, topic: TWSTopicSubscribeEventArgs) // Check if we're subscribed to a topic like this ================ -File: src/lib/multipartUtil.ts +File: src/lib/BaseWSClient.ts ================ -/** File payload for Gate multipart/form-data OTC endpoints */ -export type GateMultipartFile = - | Blob - | Buffer - | { filename?: string; content: Blob | Buffer }; +import EventEmitter from 'events'; +import WebSocket from 'isomorphic-ws'; ⋮---- -export function appendGateMultipartFile( - form: FormData, - fieldName: string, - file: GateMultipartFile, -): void +import { + WebsocketClientOptions, + WSClientConfigurableOptions, +} from '../types/websockets/client.js'; +import { WsOperation } from '../types/websockets/requests.js'; +import { WS_LOGGER_CATEGORY } from '../WebsocketClient.js'; +import { DefaultLogger } from './logger.js'; +import { isMessageEvent, MessageEventLike } from './requestUtils.js'; +import { checkWebCryptoAPISupported } from './webCryptoAPI.js'; +import { + safeTerminateWs, + WsTopicRequest, + WsTopicRequestOrStringTopic, +} from './websocket/websocket-util.js'; +import { WsStore } from './websocket/WsStore.js'; +import { + WSConnectedResult, + WsConnectionStateEnum, +} from './websocket/WsStore.types.js'; ⋮---- -export function appendGateMultipartFields( - form: FormData, - fields: Record, -): void - -================ -File: src/lib/webCryptoAPI.ts -================ -import { neverGuard } from './misc-util.js'; +interface WSClientEventMap { + /** Connection opened. If this connection was previously opened and reconnected, expect the reconnected event instead */ + open: (evt: { + wsKey: WsKey; + event: any; + wsUrl: string; + ws: WebSocket; + }) => void /** Reconnecting a dropped connection */; + reconnect: (evt: { wsKey: WsKey; event: any }) => void; + /** Successfully reconnected a connection that dropped */ + reconnected: (evt: { + wsKey: WsKey; + event: any; + wsUrl: string; + ws: WebSocket; + }) => void; + /** Connection closed */ + close: (evt: { wsKey: WsKey; event: any }) => void; + /** Received reply to websocket command (e.g. after subscribing to topics) */ + response: (response: any & { wsKey: WsKey }) => void; + /** Received data for topic */ + update: (response: any & { wsKey: WsKey }) => void; + /** Exception from ws client OR custom listeners (e.g. if you throw inside your event handler) */ + exception: (response: any & { wsKey: WsKey }) => void; + error: (response: any & { wsKey: WsKey }) => void; + /** Confirmation that a connection successfully authenticated */ + authenticated: (event: { wsKey: WsKey; event: any }) => void; +} ⋮---- -function bufferToB64(buffer: ArrayBuffer): string +/** Connection opened. If this connection was previously opened and reconnected, expect the reconnected event instead */ ⋮---- -export type SignEncodeMethod = 'hex' | 'base64'; -export type SignAlgorithm = 'SHA-256' | 'SHA-512'; +}) => void /** Reconnecting a dropped connection */; ⋮---- -/** - * Similar to node crypto's `createHash()` function - */ -export async function hashMessage( - message: string, - method: SignEncodeMethod, - algorithm: SignAlgorithm, -): Promise +/** Successfully reconnected a connection that dropped */ ⋮---- -/** - * Sign a message, with a secret, using the Web Crypto API - */ -export async function signMessage( - message: string, - secret: string, - method: SignEncodeMethod, - algorithm: SignAlgorithm, -): Promise +/** Connection closed */ ⋮---- -export function checkWebCryptoAPISupported() - -================ -File: src/types/request/options.ts -================ -/**========================================================================================================================== - * OPTIONS - * ========================================================================================================================== - */ -export interface GetOptionsSettlementHistoryReq { - underlying: string; - limit?: number; - offset?: number; - from?: number; - to?: number; -} -export interface GetOptionsMySettlementsReq { - underlying: string; - contract?: string; - limit?: number; - offset?: number; - from?: number; - to?: number; -} +/** Received reply to websocket command (e.g. after subscribing to topics) */ ⋮---- -export interface GetOptionsOrderBookReq { - contract: string; - interval?: '0' | '0.1' | '0.01'; - limit?: number; - with_id?: boolean; -} +/** Received data for topic */ ⋮---- -export interface GetOptionsCandlesReq { - contract: string; - limit?: number; - from?: number; - to?: number; - interval?: '1m' | '5m' | '15m' | '30m' | '1h'; -} +/** Exception from ws client OR custom listeners (e.g. if you throw inside your event handler) */ ⋮---- -export interface GetOptionsUnderlyingCandlesReq { - underlying: string; - limit?: number; - from?: number; - to?: number; - interval?: '1m' | '5m' | '15m' | '30m' | '1h'; -} +/** Confirmation that a connection successfully authenticated */ ⋮---- -export interface GetOptionsTradesReq { - contract?: string; - type?: 'C' | 'P'; - limit?: number; - offset?: number; - from?: number; - to?: number; +export interface EmittableEvent { + eventType: 'response' | 'update' | 'exception' | 'authenticated'; + event: TEvent; } ⋮---- -export interface GetOptionsAccountChangeReq { - limit?: number; - offset?: number; - from?: number; - to?: number; - type?: 'dnw' | 'prem' | 'fee' | 'refr' | 'set'; -} -⋮---- -export interface SubmitOptionsOrderReq { - contract: string; - size: number; - iceberg?: number; - price?: string; - close?: boolean; - reduce_only?: boolean; - tif?: 'gtc' | 'ioc' | 'poc'; - text?: string; +// Type safety for on and emit handlers: https://stackoverflow.com/a/61609010/880837 +export interface BaseWebsocketClient { + on>( + event: U, + listener: WSClientEventMap[U], + ): this; + + emit>( + event: U, + ...args: Parameters[U]> + ): boolean; } ⋮---- -export interface AmendOptionsOrderReq { - contract: string; // Options contract name - price: string; // Order price - size: number; // Order size -} +on>( + event: U, + listener: WSClientEventMap[U], + ): this; ⋮---- -contract: string; // Options contract name -price: string; // Order price -size: number; // Order size +emit>( + event: U, + ...args: Parameters[U]> + ): boolean; ⋮---- -export interface GetOptionsOrdersReq { - contract?: string; - underlying?: string; - status: 'open' | 'finished'; - limit?: number; - offset?: number; - from?: number; - to?: number; -} +/** + * Users can conveniently pass topics as strings or objects (object has topic name + optional params). + * + * This method normalises topics into objects (object has topic name + optional params). + */ +function getNormalisedTopicRequests( + wsTopicRequests: WsTopicRequestOrStringTopic[], +): WsTopicRequest[] ⋮---- -export interface GetOptionsPersonalHistoryReq { - underlying: string; - contract?: string; - limit?: number; - offset?: number; - from?: number; - to?: number; -} +// passed as string, convert to object ⋮---- -export interface OptionsMMPSettingsReq { - underlying: string; - window: number; // Time window in milliseconds, between 1-5000, 0 to disable MMP - frozen_period: number; // Frozen period in milliseconds, 0 to freeze indefinitely until reset API is called - qty_limit: string; // Maximum transaction volume (positive number, up to 2 decimal places) - delta_limit: string; // Maximum net delta value (positive number, up to 2 decimal places) -} +// already a normalised object, thanks to user ⋮---- -window: number; // Time window in milliseconds, between 1-5000, 0 to disable MMP -frozen_period: number; // Frozen period in milliseconds, 0 to freeze indefinitely until reset API is called -qty_limit: string; // Maximum transaction volume (positive number, up to 2 decimal places) -delta_limit: string; // Maximum net delta value (positive number, up to 2 decimal places) - -================ -File: src/types/request/p2pMerchant.ts -================ -/** P2P Merchant API request types */ +/** + * Base WebSocket abstraction layer. Handles connections, tracking each connection as a unique "WS Key" + */ +// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging +export abstract class BaseWebsocketClient< ⋮---- -export interface P2PMerchantGetCounterpartyUserInfoReq { - biz_uid: string; -} +/** + * The WS connections supported by the client, each identified by a unique primary key + */ ⋮---- -export interface P2PMerchantGetMyselfPaymentReq { - fiat?: string; -} +/** + * State store to track a list of topics (topic requests) we are expected to be subscribed to if reconnected + */ ⋮---- -export interface P2PMerchantGetPendingTransactionListReq { - crypto_currency: string; - fiat_currency: string; - order_tab?: string; - select_type?: string; - status?: string; - txid?: number; - start_time?: number; - end_time?: number; -} +constructor( + options?: WSClientConfigurableOptions, + logger?: typeof DefaultLogger, +) ⋮---- -export interface P2PMerchantGetCompletedTransactionListReq { - crypto_currency: string; - fiat_currency: string; - select_type?: string; - status?: string; - txid?: number; - start_time?: number; - end_time?: number; - query_dispute?: number; - page?: number; - per_page?: number; -} +// Some defaults: ⋮---- -export interface P2PMerchantGetTransactionDetailsReq { - txid: number; - channel?: string; -} +// Gate.io only has one connection (for both public & private). Auth works with every sub, not on connect, so this is turned off. ⋮---- -export interface P2PMerchantConfirmPaymentReq { - trade_id: string; - payment_method: string; -} +// Gate.io requires auth to be added to every request, when subscribing to private topics. This is handled automatically. ⋮---- -export interface P2PMerchantConfirmReceiptReq { - trade_id: string; -} +// Automatically re-auth WS API, if we were auth'd before and get reconnected ⋮---- -export interface P2PMerchantCancelTransactionReq { - trade_id: string; - reason_id?: string; - reason_memo?: string; -} +// Check Web Crypto API support when credentials are provided and no custom sign function is used ⋮---- -export interface P2PMerchantPlaceBizPushOrderReq { - currencyType: string; - exchangeType: string; - type: string; - unitPrice: string; - number: string; - payType: string; - minAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType - maxAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType - pay_type_json?: string; - rateFixed?: string; - oid?: string; - tierLimit?: string; - verifiedLimit?: string; - regTimeLimit?: string; - advertisersLimit?: string; - hide_payment?: string; - expire_min?: string; - trade_tips?: string; - auto_reply?: string; - min_completed_limit?: string; - max_completed_limit?: string; - completed_rate_limit?: string; - user_country_limit?: string; - user_order_limit?: string; - rateReferenceId?: string; - rateOffset?: string; - float_trend?: string; - limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount; defaults to 0 - fiatMinAmount?: string; // v4.106.102: Required when limitBasis is 1 - fiatMaxAmount?: string; // v4.106.102: Required when limitBasis is 1 - polymarket_limit?: string; // v4.106.102: Restrict trading with Polymarket users -} +protected abstract isAuthOnConnectWsKey(wsKey: TWSKey): boolean; ⋮---- -minAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType -maxAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType +protected abstract sendPingEvent(wsKey: TWSKey, ws: WebSocket): void; ⋮---- -limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount; defaults to 0 -fiatMinAmount?: string; // v4.106.102: Required when limitBasis is 1 -fiatMaxAmount?: string; // v4.106.102: Required when limitBasis is 1 -polymarket_limit?: string; // v4.106.102: Restrict trading with Polymarket users +protected abstract sendPongEvent(wsKey: TWSKey, ws: WebSocket): void; ⋮---- -/** POST /p2p/merchant/account/set_merchant_work_hours — v4.106.96 */ -export interface P2PMerchantSetMerchantWorkHoursReq { - work_status: 0 | 1 | 2; // 0 resting, 1 working, 2 custom working hours - cycle_type?: string; - day_of_week?: string; - time_zone?: string; // UTC offset -12 to +14 - start_time?: string; - end_time?: string; -} +protected abstract isWsPing(data: any): boolean; ⋮---- -work_status: 0 | 1 | 2; // 0 resting, 1 working, 2 custom working hours +protected abstract isWsPong(data: any): boolean; ⋮---- -time_zone?: string; // UTC offset -12 to +14 +protected abstract getWsAuthRequestEvent(wsKey: TWSKey): Promise; ⋮---- -export interface P2PMerchantAdsUpdateStatusReq { - adv_no: number; - adv_status: 1 | 3 | 4; - /** Optional query param */ - trade_type?: string; -} +protected abstract isPrivateTopicRequest( + request: WsTopicRequest, + wsKey: TWSKey, + ): boolean; ⋮---- -/** Optional query param */ +protected abstract getPrivateWSKeys(): TWSKey[]; ⋮---- -export interface P2PMerchantAdsDetailReq { - adv_no: string; -} +protected abstract getWsUrl(wsKey: TWSKey): string; ⋮---- -export interface P2PMerchantMyAdsListReq { - asset?: string; - fiat_unit?: string; - trade_type?: string; -} +protected abstract getMaxTopicsPerSubscribeEvent( + wsKey: TWSKey, + ): number | null; ⋮---- -export interface P2PMerchantGetAdsListReq { - asset: string; - fiat_unit: string; - trade_type: string; -} +/** + * Returns a list of string events that can be individually sent upstream to complete subscribing/unsubscribing/etc to these topics + */ +protected abstract getWsOperationEventsForTopics( + topics: WsTopicRequest[], + wsKey: TWSKey, + operation: WsOperation, + ): Promise; ⋮---- -export interface P2PMerchantGetChatsListReq { - txid: number; - lastreceived?: number; - firstreceived?: number; -} +/** + * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) + */ +protected abstract resolveEmittableEvents( + wsKey: TWSKey, + event: MessageEventLike, + ): EmittableEvent[]; ⋮---- -export interface P2PMerchantSendChatMessageReq { - txid: number; - message: string; - /** 0=Text, 1=File (video or image). Default 0 */ - type?: 0 | 1; -} -⋮---- -/** 0=Text, 1=File (video or image). Default 0 */ +/** + * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library + */ +protected abstract connectAll(): Promise[]; ⋮---- -export interface P2PMerchantUploadChatFileReq { - image_content_type: string; - base64_img: string; -} - -================ -File: src/types/request/rebate.ts -================ -export interface GetAgencyTransactionHistoryReq { - currency_pair?: string; - user_id?: number; - from?: number; - to?: number; - limit?: number; - offset?: number; -} +protected isPrivateWsKey(wsKey: TWSKey): boolean ⋮---- -export interface GetAgencyCommissionHistoryReq { - currency?: string; - user_id?: number; - from?: number; - to?: number; - limit?: number; - offset?: number; -} +/** Returns auto-incrementing request ID, used to track promise references for async requests */ +protected getNewRequestId(): string ⋮---- -export interface GetPartnerSubordinateListReq { - user_id?: number; - limit?: number; - offset?: number; -} +protected abstract sendWSAPIRequest( + wsKey: TWSKey, + channel: string, + params?: any, + ): Promise; ⋮---- -export interface GetBrokerCommissionHistoryReq { - limit?: number; - offset?: number; - user_id?: number; - from?: number; - to?: number; -} +protected abstract sendWSAPIRequest( + wsKey: TWSKey, + channel: string, + params: any, + ): Promise; ⋮---- -export interface GetBrokerTransactionHistoryReq { - limit?: number; - offset?: number; - user_id?: number; - from?: number; - to?: number; -} +public getTimeOffsetMs() ⋮---- -// Interfaces for request and response -export interface PartnerTransactionReq { - currency_pair?: string; - user_id?: number; - from?: number; - to?: number; - limit?: number; - offset?: number; -} +// TODO: not implemented +public setTimeOffsetMs(newOffset: number) ⋮---- -/** GET /rebate/partner/data/aggregated */ -export interface GetPartnerAgentDataAggregatedReq { - /** `yyyy-mm-dd hh:ii:ss` (UTC+8); default start of last 7 days */ - start_date?: string; - /** `yyyy-mm-dd hh:ii:ss` (UTC+8); default end of last 7 days */ - end_date?: string; - /** - * 0 All (default), 1 Spot, 2 Futures, 3 Alpha, 4 Web3, 5 Perps (DEX), - * 6 Exchange All, 7 Web3 All, 8 TradFi. `trading_user_count` only when 0. +/** + * Don't call directly! Use subscribe() instead! + * + * Subscribe to one or more topics on a WS connection (identified by WS Key). + * + * - Topics are automatically cached + * - Connections are automatically opened, if not yet connected + * - Authentication is automatically handled + * - Topics are automatically resubscribed to, if something happens to the connection, unless you call unsubsribeTopicsForWsKey(topics, key). + * + * @param wsRequests array of topics to subscribe to + * @param wsKey ws key referring to the ws connection these topics should be subscribed on */ - business_type?: number; -} +protected subscribeTopicsForWsKey( + wsTopicRequests: WsTopicRequestOrStringTopic[], + wsKey: TWSKey, +) ⋮---- -/** `yyyy-mm-dd hh:ii:ss` (UTC+8); default start of last 7 days */ +// Store topics, so future automation (post-auth, post-reconnect) has everything needed to resubscribe automatically ⋮---- -/** `yyyy-mm-dd hh:ii:ss` (UTC+8); default end of last 7 days */ +// start connection process if it hasn't yet begun. Topics are automatically subscribed to on-connect +⋮---- +// Subscribe should happen automatically once connected, nothing to do here after topics are added to wsStore. ⋮---- /** - * 0 All (default), 1 Spot, 2 Futures, 3 Alpha, 4 Web3, 5 Perps (DEX), - * 6 Exchange All, 7 Web3 All, 8 TradFi. `trading_user_count` only when 0. - */ - -================ -File: src/types/response/account.ts -================ -/**========================================================================================================================== - * ACCOUNT - * ========================================================================================================================== - */ + * Are we in the process of connection? Nothing to send yet. + */ ⋮---- -export interface AccountDetail { - user_id: number; - ip_whitelist: string[]; - currency_pairs: string[]; - key: { - mode: number; - }; - tier: number; - copy_trading_role: number; -} +// We're connected. Check if auth is needed and if already authenticated ⋮---- -export interface AccountRateLimit { - type: string; - tier: string; - ratio: string; - main_ratio: string; - updated_at: string; -} +/** + * If not authenticated yet and auth is required, don't request topics yet. + * + * Auth should already automatically be in progress, so no action needed from here. Topics will automatically subscribe post-auth success. + */ ⋮---- -export interface StpGroup { - id: number; - name: string; - creator_id: number; - create_time: number; -} +// Finally, request subscription to topics if the connection is healthy and ready ⋮---- -export interface StpGroupUser { - user_id: number; - stp_id: number; - create_time: number; -} +protected unsubscribeTopicsForWsKey( + wsTopicRequests: WsTopicRequestOrStringTopic[], + wsKey: TWSKey, +) ⋮---- -export interface AccountMainKey { - state: number; // 1 - Normal, 2 - Locked, 3 - Frozen - mode: number; // 1 - Classic, 2 - Legacy Unified - name: string; - currency_pairs: string[]; - user_id: number; - ip_whitelist: string[]; - perms: { - name: string; - read_only: boolean; - }[]; - key: string; - created_at: string; - updated_at: string; - last_access: string; -} +// Store topics, so future automation (post-auth, post-reconnect) has everything needed to resubscribe automatically ⋮---- -state: number; // 1 - Normal, 2 - Locked, 3 - Frozen -mode: number; // 1 - Classic, 2 - Legacy Unified - -================ -File: src/types/response/alpha.ts -================ -/**========================================================================================================================== - * ALPHA - * ========================================================================================================================== - */ +// If not connected, don't need to do anything. +// Removing the topic from the store is enough to stop it from being resubscribed to on reconnect. ⋮---- -export interface AlphaAccount { - currency: string; // Currency name - available: string; // Available Balance - locked: string; // Locked balance - token_address: string; // Token address - chain: string; // Blockchain name -} +// We're connected. Check if auth is needed and if already authenticated ⋮---- -currency: string; // Currency name -available: string; // Available Balance -locked: string; // Locked balance -token_address: string; // Token address -chain: string; // Blockchain name +/** + * If not authenticated yet and auth is required, don't need to do anything. + * We don't subscribe to topics until auth is complete anyway. + */ ⋮---- -export interface AlphaAccountBook { - id: number; // Order ID - time: number; // Operation timestamp - currency: string; // Currency name - change: string; // Change amount - balance: string; // Balance after change -} +// Finally, request subscription to topics if the connection is healthy and ready ⋮---- -id: number; // Order ID -time: number; // Operation timestamp -currency: string; // Currency name -change: string; // Change amount -balance: string; // Balance after change +/** + * Splits topic requests into two groups, public & private topic requests + */ +private sortTopicRequestsIntoPublicPrivate( + wsTopicRequests: WsTopicRequest[], + wsKey: TWSKey, +): ⋮---- -export interface CreateAlphaQuoteResp { - quote_id: string; // Quote ID for order placement, valid for 1 minute - min_amount: string; // Minimum order size - max_amount: string; // Maximum order size - price: string; // Token Price (USDT-based) - slippage: string; // Slippage - estimate_gas_fee_amount_usdt: string; // Estimated Gas Fee (USDT-based) - order_fee: string; // Slippage tolerance (10 means 10% tolerance) - target_token_min_amount: string; // Minimum received amount - target_token_max_amount: string; // Maximum received amount - error_type: number; // Failure Type (0: Success, 1: Exceeds maximum value, 2: Below minimum value) -} +/** Get the WsStore that tracks websockets & topics */ +public getWsStore(): WsStore> ⋮---- -quote_id: string; // Quote ID for order placement, valid for 1 minute -min_amount: string; // Minimum order size -max_amount: string; // Maximum order size -price: string; // Token Price (USDT-based) -slippage: string; // Slippage -estimate_gas_fee_amount_usdt: string; // Estimated Gas Fee (USDT-based) -order_fee: string; // Slippage tolerance (10 means 10% tolerance) -target_token_min_amount: string; // Minimum received amount -target_token_max_amount: string; // Maximum received amount -error_type: number; // Failure Type (0: Success, 1: Exceeds maximum value, 2: Below minimum value) +public close(wsKey: TWSKey, force?: boolean) ⋮---- -export interface CreateAlphaOrderResp { - order_id: string; // Order ID - status: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) - side: string; // Buy or sell orders (buy/sell) - gas_mode: string; // Trading mode (speed: Smart mode, custom: Custom mode) - create_time: number; // Creation timestamp - amount: string; // Trade Quantity - token_address: string; // Token contract address - chain: string; // Blockchain name -} -⋮---- -order_id: string; // Order ID -status: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) -side: string; // Buy or sell orders (buy/sell) -gas_mode: string; // Trading mode (speed: Smart mode, custom: Custom mode) -create_time: number; // Creation timestamp -amount: string; // Trade Quantity -token_address: string; // Token contract address -chain: string; // Blockchain name -⋮---- -export interface AlphaOrder { - order_id: string; // Order ID - tx_hash: string; // Transaction Hash - side: string; // Buy or sell orders (buy/sell) - usdt_amount: string; // Amount (USDT) - currency: string; // Token - currency_amount: string; // Token amount - status: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) - gas_mode: string; // Trading mode (speed: Smart mode, custom: Custom mode) - chain: string; // Blockchain - gas_fee: string; // Gas Fee (USDT-based) - transaction_fee: string; // Trading Fee (USDT-based) - failed_reason: string; // Failure reason (if applicable) - create_time: number; // Creation timestamp -} +public closeAll(force?: boolean) ⋮---- -order_id: string; // Order ID -tx_hash: string; // Transaction Hash -side: string; // Buy or sell orders (buy/sell) -usdt_amount: string; // Amount (USDT) -currency: string; // Token -currency_amount: string; // Token amount -status: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) -gas_mode: string; // Trading mode (speed: Smart mode, custom: Custom mode) -chain: string; // Blockchain -gas_fee: string; // Gas Fee (USDT-based) -transaction_fee: string; // Trading Fee (USDT-based) -failed_reason: string; // Failure reason (if applicable) -create_time: number; // Creation timestamp +public isConnected(wsKey: TWSKey): boolean ⋮---- -export interface AlphaCurrency { - currency: string; // Currency symbol - name: string; // Currency name - chain: string; // The main chain corresponding to the coin - address: string; // Contract Address - amount_precision: number; // Amount scale - precision: number; // Price scale - status: number; // Currency Trading Status (1: Normal trading, 2: Suspended trading, 3: Delisted) -} +/** + * Request connection to a specific websocket, instead of waiting for automatic connection. + */ +protected async connect( + wsKey: TWSKey, +): Promise ⋮---- -currency: string; // Currency symbol -name: string; // Currency name -chain: string; // The main chain corresponding to the coin -address: string; // Contract Address -amount_precision: number; // Amount scale -precision: number; // Price scale -status: number; // Currency Trading Status (1: Normal trading, 2: Suspended trading, 3: Delisted) +private connectToWsUrl(url: string, wsKey: TWSKey): WebSocket ⋮---- -export interface AlphaTicker { - currency: string; // Currency symbol - last: string; // Last trading price - change: string; // 24h price change percentage (negative for decrease, e.g., -7.45) - volume: string; // 24h Trading Volume (USDT) - market_cap: string; // Current Token Market Cap -} +private parseWsError(context: string, error: any, wsKey: TWSKey) ⋮---- -currency: string; // Currency symbol -last: string; // Last trading price -change: string; // 24h price change percentage (negative for decrease, e.g., -7.45) -volume: string; // 24h Trading Volume (USDT) -market_cap: string; // Current Token Market Cap - -================ -File: src/types/response/autoinvest.ts -================ -/**========================================================================================================================== - * EARN AUTO INVEST - * ========================================================================================================================== - */ +/** Get a signature, build the auth request and send it */ +private async sendAuthRequest(wsKey: TWSKey): Promise ⋮---- -/** POST /earn/autoinvest/plans/create — example response shape */ -export interface CreateAutoInvestPlanResp { - id: number; - amount: string; - money: string; - next_time: number; - period_type: string; - period_day: number; - period_hour: number; - fund_flow: string; - fund_source: string; -} +// console.log('ws auth req', request); ⋮---- -export interface AutoInvestCoinItem { - key: string; - value: string; - asset_icon_url: string; - sort: number; -} +private reconnectWithDelay(wsKey: TWSKey, connectionDelayMs: number) ⋮---- -export interface AutoInvestMinAmountResp { - min_amount: string; -} +private ping(wsKey: TWSKey) ⋮---- -export interface AutoInvestPlanExecutionRecord { - id: number; - type: string; - money: string; - user_id: number; - plan_id: number; - plan_version: number; - amount: string; - create_time: number; - update_time: number; - status: string; - status_type: number; - /** 2 = buy, other = sell */ - side: number; - status_message: string; - detail: string; - asset: string; -} +private clearTimers(wsKey: TWSKey) ⋮---- -/** 2 = buy, other = sell */ +// Send a ping at intervals +private clearPingTimer(wsKey: TWSKey) ⋮---- -export interface AutoInvestPlanExecutionRecordsPaginated { - page: number; - page_size: number; - total_page: number; - total: number; - list: AutoInvestPlanExecutionRecord[]; -} +// Expect a pong within a time limit +private clearPongTimer(wsKey: TWSKey) ⋮---- -export interface AutoInvestOrderItem { - id: number; - type: string; - amount: string; - plan_id: number; - side: number; - asset: string; - record_id: number; - total_money: string; - market: string; - price: string; - create_time: number; - total: string; - fund_flow: string; - error_code: number; - error_msg: string; - status: number; -} +// this.logger.trace(`Cleared pong timeout for "${wsKey}"`); ⋮---- -export interface AutoInvestConfigItem { - coin: string; - max_limit: string; -} +// this.logger.trace(`No active pong timer for "${wsKey}"`); ⋮---- -export interface AutoInvestPlanPortfolioItem { - asset: string; - ratio: string; - cum_invest?: string; - cum_hold?: string; - cum_redeem?: string; - avg_price?: string; - redeem_status?: number; - lend_amount?: string; -} +/** + * Simply builds and sends subscribe events for a list of topics for a ws key + * + * @private Use the `subscribe(topics)` or `subscribeTopicsForWsKey(topics, wsKey)` method to subscribe to topics. Send WS message to subscribe to topics. + */ +private async requestSubscribeTopics( + wsKey: TWSKey, + topics: WsTopicRequest[], +) ⋮---- -export interface AutoInvestPlanDetail { - id: number; - version: number; - name: string; - create_time: number; - update_time: number; - user_id: number; - money: string; - amount: string; - period_type: string; - period_day: number; - period_hour: number; - portfolio: AutoInvestPlanPortfolioItem[]; - next_time?: number; - period?: number; - fund_source?: string; - fund_flow?: string; -} +// Automatically splits requests into smaller batches, if needed ⋮---- -export interface AutoInvestPlansListResp { - page: number; - page_size: number; - page_count: number; - total_count: number; - list: AutoInvestPlanDetail[]; -} - -================ -File: src/types/response/delivery.ts -================ -/**========================================================================================================================== - * DELIVERY - * ========================================================================================================================== - */ +`Subscribing to ${topics.length} "${wsKey}" topics in ${subscribeWsMessages.length} batches.`, // Events: "${JSON.stringify(topics)}" ⋮---- -export interface DeliveryOrderBook { - id?: number; - current: number; - update: number; - asks: { p: string; s: number }[]; - bids: { p: string; s: number }[]; -} +// console.log(`batches: `, JSON.stringify(subscribeWsMessages, null, 2)); ⋮---- -export interface DeliveryTrade { - id: number; - create_time: number; - create_time_ms: number; - contract: string; - size: number; - price: string; - is_internal?: boolean; // Deprecated -} +// this.logger.trace(`Sending batch via message: "${wsMessage}"`); ⋮---- -is_internal?: boolean; // Deprecated +/** + * Simply builds and sends unsubscribe events for a list of topics for a ws key + * + * @private Use the `unsubscribe(topics)` method to unsubscribe from topics. Send WS message to unsubscribe from topics. + */ +private async requestUnsubscribeTopics( + wsKey: TWSKey, + wsTopicRequests: WsTopicRequest[], +) ⋮---- -export interface DeliveryCandle { - t: number; - v?: number; - c: string; - h: string; - l: string; - o: string; -} +/** + * Try sending a string event on a WS connection (identified by the WS Key) + */ +public tryWsSend( + wsKey: TWSKey, + wsMessage: string, + throwExceptions?: boolean, +) ⋮---- -export interface DeliveryTicker { - contract: string; - last: string; - change_percentage: string; - total_size: string; - low_24h: string; - high_24h: string; - volume_24h: string; - volume_24h_btc?: string; - volume_24h_usd?: string; - volume_24h_base: string; - volume_24h_quote: string; - volume_24h_settle: string; - mark_price: string; - funding_rate: string; - funding_rate_indicative: string; - index_price: string; - quanto_base_rate?: string; // Deprecated - basis_rate: string; - basis_value: string; - lowest_ask: string; - highest_bid: string; -} +private async onWsOpen( + event: any, + wsKey: TWSKey, + url: string, + ws: WebSocket, +) ⋮---- -quanto_base_rate?: string; // Deprecated +// Resolve & cleanup deferred "connection attempt in progress" promise ⋮---- -export interface DeliveryAccount { - total: string; // Balance, only applicable to classic contract account - unrealised_pnl: string; - position_margin?: string; // Deprecated - order_margin: string; // Initial margin for all pending orders - available: string; - point: string; - currency: string; - in_dual_mode: boolean; - position_mode?: string; // Position mode: single - one-way, dual - dual-side, split - sub-positions (in_dual_mode is deprecated) - enable_credit: boolean; - position_initial_margin: string; - maintenance_margin: string; - bonus: string; - enable_evolved_classic?: boolean; // Deprecated - cross_order_margin: string; - cross_initial_margin: string; - cross_maintenance_margin: string; - cross_unrealised_pnl: string; - cross_available: string; - isolated_position_margin: string; - enable_new_dual_mode?: boolean; // Deprecated - margin_mode?: number; // 0: classic delivery account; 1: Multi-Currency Margin Mode; 2: Portfolio Margin Mode; 3: Single-Currency Margin Mode - history: { - dnw: string; - pnl: string; - fee: string; - refr: string; - fund: string; - point_dnw: string; - point_fee: string; - point_refr: string; - bonus_dnw: string; - bonus_offset: string; - }; - enable_tiered_mm: boolean; -} +// eslint-disable-next-line @typescript-eslint/no-unused-vars ⋮---- -total: string; // Balance, only applicable to classic contract account +// Remove before resolving, in case there's more requests queued ⋮---- -position_margin?: string; // Deprecated -order_margin: string; // Initial margin for all pending orders +// Some websockets require an auth packet to be sent after opening the connection ⋮---- -position_mode?: string; // Position mode: single - one-way, dual - dual-side, split - sub-positions (in_dual_mode is deprecated) +// Reconnect to topics known before it connected ⋮---- -enable_evolved_classic?: boolean; // Deprecated +// Request sub to public topics, if any ⋮---- -enable_new_dual_mode?: boolean; // Deprecated -margin_mode?: number; // 0: classic delivery account; 1: Multi-Currency Margin Mode; 2: Portfolio Margin Mode; 3: Single-Currency Margin Mode +// Request sub to private topics, if auth on connect isn't needed ⋮---- -export interface DeliveryBook { - time: number; - change: string; - balance: string; - type: - | 'dnw' - | 'pnl' - | 'fee' - | 'refr' - | 'fund' - | 'point_dnw' - | 'point_fee' - | 'point_refr' - | 'bonus_offset'; - text: string; - contract?: string; - trade_id?: string; -} +// If enabled, automatically reauth WS API if reconnected ⋮---- -export interface DeliveryTradingHistoryRecord { - id: number; - create_time: number; - contract: string; - order_id: string; - size: number; - price: string; - role: 'taker' | 'maker'; - text: string; - fee: string; - point_fee: string; -} +// eslint-disable-next-line @typescript-eslint/no-unused-vars ⋮---- -export interface DeliveryClosedPosition { - time: number; - contract: string; - side: 'long' | 'short'; - pnl: string; - pnl_pnl: string; - pnl_fund: string; - pnl_fee: string; - text: string; - max_size: string; - first_open_time: number; - long_price: string; - short_price: string; -} +/** + * Handle subscription to private topics _after_ authentication successfully completes asynchronously. + * + * Only used for exchanges that require auth before sending private topic subscription requests + */ +private onWsAuthenticated( + wsKey: TWSKey, + event: { isWSAPI?: boolean; WSAPIAuthChannel?: string }, +) ⋮---- -export interface DeliveryLiquidationHistoryRecord { - time: number; - contract: string; - leverage?: string; - size: number; - margin?: string; - entry_price?: string; - liq_price?: string; - mark_price?: string; - order_id?: number; - order_price: string; - fill_price: string; - left: number; -} +// Resolve & cleanup deferred "auth attempt in progress" promise ⋮---- -export interface DeliverySettlementHistoryRecord { - time: number; - contract: string; - leverage: string; - size: number; - margin: string; - entry_price: string; - settle_price: string; - profit: string; - fee: string; -} +// Remove before continuing, in case there's more requests queued +⋮---- +private onWsMessage(event: unknown, wsKey: TWSKey, ws: WebSocket) +⋮---- +// any message can clear the pong timer - wouldn't get a message if the ws wasn't working +⋮---- +// console.log(`raw event: `, { data, dataType, emittableEvents }); +⋮---- +private onWsClose(event: unknown, wsKey: TWSKey) +⋮---- +// unintentional close, attempt recovery +⋮---- +// clean up any pending promises for this connection +⋮---- +// intentional close - clean up +// clean up any pending promises for this connection +⋮---- +// clean up any pending promises for this connection +⋮---- +// This was an intentional close, delete all state for this connection, as if it never existed: +⋮---- +private getWs(wsKey: TWSKey) +⋮---- +private setWsState(wsKey: TWSKey, state: WsConnectionStateEnum) +⋮---- +/** + * Promise-driven method to assert that a ws has successfully connected (will await until connection is open) + */ +protected async assertIsConnected(wsKey: TWSKey): Promise +⋮---- +// Already in progress? Await shared promise and retry +⋮---- +// Start connection, it should automatically store/return a promise. +⋮---- +/** + * Promise-driven method to assert that a ws has been successfully authenticated (will await until auth is confirmed) + */ +public async assertIsAuthenticated(wsKey: TWSKey): Promise +⋮---- +// Already in progress? Await shared promise and retry +⋮---- +// this.logger.trace('assertIsAuthenticated(): ok'); +⋮---- +// Start authentication, it should automatically store/return a promise. ================ -File: src/types/response/margin.ts +File: src/lib/multipartUtil.ts +================ +/** File payload for Gate multipart/form-data OTC endpoints */ +export type GateMultipartFile = + | Blob + | Buffer + | { filename?: string; content: Blob | Buffer }; +⋮---- +export function appendGateMultipartFile( + form: FormData, + fieldName: string, + file: GateMultipartFile, +): void +⋮---- +export function appendGateMultipartFields( + form: FormData, + fields: Record, +): void + +================ +File: src/types/request/options.ts ================ /**========================================================================================================================== - * MARGIN + * OPTIONS * ========================================================================================================================== */ -⋮---- -export interface MarginAccount { - currency_pair: string; - locked: boolean; - risk: string; - base: { - currency: string; - available: string; - locked: string; - borrowed: string; - interest: string; - }; - quote: { - currency: string; - available: string; - locked: string; - borrowed: string; - interest: string; - }; +export interface GetOptionsSettlementHistoryReq { + underlying: string; + limit?: number; + offset?: number; + from?: number; + to?: number; +} +export interface GetOptionsMySettlementsReq { + underlying: string; + contract?: string; + limit?: number; + offset?: number; + from?: number; + to?: number; } ⋮---- -export interface MarginBalanceHistoryRecord { - id: string; - time: string; - time_ms: number; - currency: string; - currency_pair: string; - change: string; - balance: string; - type: string; +export interface GetOptionsOrderBookReq { + contract: string; + interval?: '0' | '0.1' | '0.01'; + limit?: number; + with_id?: boolean; } ⋮---- -export interface CrossMarginCurrency { - name: string; - rate: string; - prec: string; - discount: string; - min_borrow_amount: string; - user_max_borrow_amount: string; - total_max_borrow_amount: string; - price: string; - loanable: boolean; - status: number; +export interface GetOptionsCandlesReq { + contract: string; + limit?: number; + from?: number; + to?: number; + interval?: '1m' | '5m' | '15m' | '30m' | '1h'; } ⋮---- -export interface CrossMarginAccount { - user_id: number; - refresh_time: number; - locked: boolean; - balances: { - [currency: string]: { - available: string; - freeze: string; - borrowed: string; - interest: string; - negative_liab: string; - futures_pos_liab: string; - equity: string; - total_freeze: string; - total_liab: string; - }; - }; - total: string; - borrowed: string; - interest: string; - risk: string; - total_initial_margin: string; - total_margin_balance: string; - total_maintenance_margin: string; - total_initial_margin_rate: string; - total_maintenance_margin_rate: string; - total_available_margin: string; - portfolio_margin_total: string; - portfolio_margin_total_liab: string; - portfolio_margin_total_equity: string; +export interface GetOptionsUnderlyingCandlesReq { + underlying: string; + limit?: number; + from?: number; + to?: number; + interval?: '1m' | '5m' | '15m' | '30m' | '1h'; } ⋮---- -export interface CrossMarginAccountHistoryRecord { - id: string; - time: number; - currency: string; - change: string; - balance: string; - type: string; +export interface GetOptionsTradesReq { + contract?: string; + type?: 'C' | 'P'; + limit?: number; + offset?: number; + from?: number; + to?: number; } ⋮---- -export interface CrossMarginMorrowLoanRecord { - id: string; - create_time: number; - update_time: number; - currency: string; - amount: string; +export interface GetOptionsAccountChangeReq { + limit?: number; + offset?: number; + from?: number; + to?: number; + type?: 'dnw' | 'prem' | 'fee' | 'refr' | 'set'; +} +⋮---- +export interface SubmitOptionsOrderReq { + contract: string; + size: number; + iceberg?: number; + price?: string; + close?: boolean; + reduce_only?: boolean; + tif?: 'gtc' | 'ioc' | 'poc'; text?: string; - status: number; - repaid: string; - repaid_interest: string; - unpaid_interest: string; } ⋮---- -export interface MarginUserAccount { - currency_pair: string; - account_type: string; // Description updated to remove "risk" option - leverage: string; - locked: boolean; - risk?: string; // Deprecated - mmr?: string; // Refined description - base: { - currency: string; - available: string; - locked: string; - borrowed: string; - interest: string; - }; - quote: { - currency: string; - available: string; - locked: string; - borrowed: string; - interest: string; - }; +export interface AmendOptionsOrderReq { + contract: string; // Options contract name + price: string; // Order price + size: number; // Order size } ⋮---- -account_type: string; // Description updated to remove "risk" option +contract: string; // Options contract name +price: string; // Order price +size: number; // Order size ⋮---- -risk?: string; // Deprecated -mmr?: string; // Refined description +export interface GetOptionsOrdersReq { + contract?: string; + underlying?: string; + status: 'open' | 'finished'; + limit?: number; + offset?: number; + from?: number; + to?: number; +} +⋮---- +export interface GetOptionsPersonalHistoryReq { + underlying: string; + contract?: string; + limit?: number; + offset?: number; + from?: number; + to?: number; +} +⋮---- +export interface OptionsMMPSettingsReq { + underlying: string; + window: number; // Time window in milliseconds, between 1-5000, 0 to disable MMP + frozen_period: number; // Frozen period in milliseconds, 0 to freeze indefinitely until reset API is called + qty_limit: string; // Maximum transaction volume (positive number, up to 2 decimal places) + delta_limit: string; // Maximum net delta value (positive number, up to 2 decimal places) +} +⋮---- +window: number; // Time window in milliseconds, between 1-5000, 0 to disable MMP +frozen_period: number; // Frozen period in milliseconds, 0 to freeze indefinitely until reset API is called +qty_limit: string; // Maximum transaction volume (positive number, up to 2 decimal places) +delta_limit: string; // Maximum net delta value (positive number, up to 2 decimal places) ================ -File: src/types/response/marginuni.ts +File: src/types/request/rebate.ts ================ -/**========================================================================================================================== - * MARGIN UNI - * ========================================================================================================================== - */ -⋮---- -export interface LendingMarket { - currency_pair: string; - base_min_borrow_amount: string; - quote_min_borrow_amount: string; - leverage: string; +export interface GetAgencyTransactionHistoryReq { + currency_pair?: string; + user_id?: number; + from?: number; + to?: number; + limit?: number; + offset?: number; } ⋮---- -export interface MarginUNILoan { - currency: string; - currency_pair: string; - amount: string; - type: string; // Lending type, margin indicates margin borrowing - create_time: number; - update_time: number; +export interface GetAgencyCommissionHistoryReq { + currency?: string; + user_id?: number; + from?: number; + to?: number; + limit?: number; + offset?: number; } ⋮---- -type: string; // Lending type, margin indicates margin borrowing +export interface GetPartnerSubordinateListReq { + user_id?: number; + limit?: number; + offset?: number; +} ⋮---- -export interface MarginUNILoanRecord { - type: string; - currency_pair: string; - currency: string; - amount: string; - create_time: number; +export interface GetBrokerCommissionHistoryReq { + limit?: number; + offset?: number; + user_id?: number; + from?: number; + to?: number; } ⋮---- -export interface MarginUNIInterestRecord { - currency: string; - currency_pair: string; - actual_rate: string; - interest: string; - status: number; - type: string; // Lending type, margin indicates margin borrowing - create_time: number; +export interface GetBrokerTransactionHistoryReq { + limit?: number; + offset?: number; + user_id?: number; + from?: number; + to?: number; } ⋮---- -type: string; // Lending type, margin indicates margin borrowing +// Interfaces for request and response +export interface PartnerTransactionReq { + currency_pair?: string; + user_id?: number; + from?: number; + to?: number; + limit?: number; + offset?: number; +} ⋮---- -export interface MarginUNIMaxBorrowable { - currency: string; - currency_pair: string; - borrowable: string; +/** GET /rebate/partner/data/aggregated */ +export interface GetPartnerAgentDataAggregatedReq { + /** `yyyy-mm-dd hh:ii:ss` (UTC+8); default start of last 7 days */ + start_date?: string; + /** `yyyy-mm-dd hh:ii:ss` (UTC+8); default end of last 7 days */ + end_date?: string; + /** + * 0 All (default), 1 Spot, 2 Futures, 3 Alpha, 4 Web3, 5 Perps (DEX), + * 6 Exchange All, 7 Web3 All, 8 TradFi. `trading_user_count` only when 0. + */ + business_type?: number; } +⋮---- +/** `yyyy-mm-dd hh:ii:ss` (UTC+8); default start of last 7 days */ +⋮---- +/** `yyyy-mm-dd hh:ii:ss` (UTC+8); default end of last 7 days */ +⋮---- +/** + * 0 All (default), 1 Spot, 2 Futures, 3 Alpha, 4 Web3, 5 Perps (DEX), + * 6 Exchange All, 7 Web3 All, 8 TradFi. `trading_user_count` only when 0. + */ ================ -File: src/types/response/multicollateralLoan.ts +File: src/types/response/account.ts ================ /**========================================================================================================================== - * MULTI COLLATERAL LOAN + * ACCOUNT * ========================================================================================================================== */ ⋮---- -export interface MultiLoanOrder { - order_id: string; - order_type: string; - fixed_type: string; - fixed_rate: string; - expire_time: number; - auto_renew: boolean; - auto_repay: boolean; - current_ltv: string; - status: string; - borrow_time: number; - total_left_repay_usdt: string; - total_left_collateral_usdt: string; - borrow_currencies: { - currency: string; - index_price: string; - left_repay_principal: string; - left_repay_interest: string; - left_repay_usdt: string; - }[]; - collateral_currencies: { - currency: string; - index_price: string; - left_collateral: string; - left_collateral_usdt: string; - }[]; -} -⋮---- -export interface RepayMultiLoanResp { - order_id: number; - repaid_currencies: { - succeeded: boolean; - label?: string; - message?: string; - currency: string; - repaid_principal: string; - repaid_interest: string; - }[]; -} -⋮---- -export interface MultiLoanRepayRecord { - order_id: number; - record_id: number; - init_ltv: string; - before_ltv: string; - after_ltv: string; - borrow_time: number; - repay_time: number; - borrow_currencies: { - currency: string; - index_price: string; - before_amount: string; - before_amount_usdt: string; - after_amount: string; - after_amount_usdt: string; - }[]; - collateral_currencies: { - currency: string; - index_price: string; - before_amount: string; - before_amount_usdt: string; - after_amount: string; - after_amount_usdt: string; - }[]; - repaid_currencies: { - currency: string; - index_price: string; - repaid_amount: string; - repaid_principal: string; - repaid_interest: string; - repaid_amount_usdt: string; - }[]; - total_interest_list: { - currency: string; - index_price: string; - amount: string; - amount_usdt: string; - }[]; - left_repay_interest_list: { - currency: string; - index_price: string; - before_amount: string; - before_amount_usdt: string; - after_amount: string; - after_amount_usdt: string; - }[]; +export interface AccountDetail { + user_id: number; + ip_whitelist: string[]; + currency_pairs: string[]; + key: { + mode: number; + }; + tier: number; + copy_trading_role: number; } ⋮---- -export interface UpdateMultiLoanResp { - order_id: number; - collateral_currencies: { - succeeded: boolean; - label?: string; - message?: string; - currency: string; - amount: string; - }[]; +export interface AccountRateLimit { + type: string; + tier: string; + ratio: string; + main_ratio: string; + updated_at: string; } ⋮---- -export interface MultiLoanAdjustmentRecord { - order_id: number; - record_id: number; - before_ltv: string; - after_ltv: string; - operate_time: number; - borrow_currencies: { - currency: string; - index_price: string; - before_amount: string; - before_amount_usdt: string; - after_amount: string; - after_amount_usdt: string; - }[]; - collateral_currencies: { - currency: string; - index_price: string; - before_amount: string; - before_amount_usdt: string; - after_amount: string; - after_amount_usdt: string; - }[]; +export interface StpGroup { + id: number; + name: string; + creator_id: number; + create_time: number; } ⋮---- -export interface MultiLoanCurrencyQuota { - currency: string; - index_price: string; - min_quota: string; - left_quota: string; - left_quote_usdt: string; - /** Remaining borrow/collateral limit for fixed-term currency */ - left_quota_fixed?: string; - /** Remaining currency limit for fixed-term converted to USDT */ - left_quote_usdt_fixed?: string; +export interface StpGroupUser { + user_id: number; + stp_id: number; + create_time: number; } ⋮---- -/** Remaining borrow/collateral limit for fixed-term currency */ -⋮---- -/** Remaining currency limit for fixed-term converted to USDT */ -⋮---- -export interface MultiLoanSupportedCurrencies { - loan_currencies: { - currency: string; - price: string; - }[]; - collateral_currencies: { - currency: string; - index_price: string; - discount: string; +export interface AccountMainKey { + state: number; // 1 - Normal, 2 - Locked, 3 - Frozen + mode: number; // 1 - Classic, 2 - Legacy Unified + name: string; + currency_pairs: string[]; + user_id: number; + ip_whitelist: string[]; + perms: { + name: string; + read_only: boolean; }[]; + key: string; + created_at: string; + updated_at: string; + last_access: string; } ⋮---- -export interface MultiLoanRatio { - init_ltv: string; - alert_ltv: string; - liquidate_ltv: string; -} -⋮---- -export interface MultiLoanFixedRate { - currency: string; - rate_7d: string; - rate_30d: string; - update_time: number; -} +state: number; // 1 - Normal, 2 - Locked, 3 - Frozen +mode: number; // 1 - Classic, 2 - Legacy Unified ================ -File: src/types/response/options.ts +File: src/types/response/alpha.ts ================ /**========================================================================================================================== - * OPTIONS + * ALPHA * ========================================================================================================================== */ ⋮---- -export interface OptionsContract { - name: string; - tag: string; // Expiry period: day, week, month - create_time: number; - expiration_time: number; - is_call: boolean; - strike_price: string; - last_price: string; - mark_price: string; - orderbook_id: number; - trade_id?: number; // Deprecated - trade_size: number; - position_size: number; - underlying: string; - underlying_price: string; // Forward futures price for the delivery date - multiplier: string; // Option contract multiplier - order_price_round: string; - mark_price_round: string; // Minimum unit of mark price - maker_fee_rate: string; - taker_fee_rate: string; - price_limit_fee_rate: string; - ref_discount_rate: string; - ref_rebate_rate: string; - order_price_deviate?: string; // Deprecated - order_size_min: number; - order_size_max: number; - orders_limit: number; // Maximum number of orders per user in this market +export interface AlphaAccount { + currency: string; // Currency name + available: string; // Available Balance + locked: string; // Locked balance + token_address: string; // Token address + chain: string; // Blockchain name } ⋮---- -tag: string; // Expiry period: day, week, month -⋮---- -trade_id?: number; // Deprecated +currency: string; // Currency name +available: string; // Available Balance +locked: string; // Locked balance +token_address: string; // Token address +chain: string; // Blockchain name ⋮---- -underlying_price: string; // Forward futures price for the delivery date -multiplier: string; // Option contract multiplier +export interface AlphaAccountBook { + id: number; // Order ID + time: number; // Operation timestamp + currency: string; // Currency name + change: string; // Change amount + balance: string; // Balance after change +} ⋮---- -mark_price_round: string; // Minimum unit of mark price +id: number; // Order ID +time: number; // Operation timestamp +currency: string; // Currency name +change: string; // Change amount +balance: string; // Balance after change ⋮---- -order_price_deviate?: string; // Deprecated +export interface CreateAlphaQuoteResp { + quote_id: string; // Quote ID for order placement, valid for 1 minute + min_amount: string; // Minimum order size + max_amount: string; // Maximum order size + price: string; // Token Price (USDT-based) + slippage: string; // Slippage + estimate_gas_fee_amount_usdt: string; // Estimated Gas Fee (USDT-based) + order_fee: string; // Slippage tolerance (10 means 10% tolerance) + target_token_min_amount: string; // Minimum received amount + target_token_max_amount: string; // Maximum received amount + error_type: number; // Failure Type (0: Success, 1: Exceeds maximum value, 2: Below minimum value) +} ⋮---- -orders_limit: number; // Maximum number of orders per user in this market +quote_id: string; // Quote ID for order placement, valid for 1 minute +min_amount: string; // Minimum order size +max_amount: string; // Maximum order size +price: string; // Token Price (USDT-based) +slippage: string; // Slippage +estimate_gas_fee_amount_usdt: string; // Estimated Gas Fee (USDT-based) +order_fee: string; // Slippage tolerance (10 means 10% tolerance) +target_token_min_amount: string; // Minimum received amount +target_token_max_amount: string; // Maximum received amount +error_type: number; // Failure Type (0: Success, 1: Exceeds maximum value, 2: Below minimum value) ⋮---- -export interface OptionsSettlementHistoryRecord { - time: number; - contract: string; - profit: string; - fee: string; - strike_price: string; - settle_price: string; +export interface CreateAlphaOrderResp { + order_id: string; // Order ID + status: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) + side: string; // Buy or sell orders (buy/sell) + gas_mode: string; // Trading mode (speed: Smart mode, custom: Custom mode) + create_time: number; // Creation timestamp + amount: string; // Trade Quantity + token_address: string; // Token contract address + chain: string; // Blockchain name } ⋮---- -export interface OptionsUserSettlement { - time: number; - underlying: string; - contract: string; - strike_price: string; - settle_price: string; - size: number; - settle_profit: string; - fee: string; - realised_pnl: string; -} +order_id: string; // Order ID +status: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) +side: string; // Buy or sell orders (buy/sell) +gas_mode: string; // Trading mode (speed: Smart mode, custom: Custom mode) +create_time: number; // Creation timestamp +amount: string; // Trade Quantity +token_address: string; // Token contract address +chain: string; // Blockchain name ⋮---- -export interface OptionsOrderBook { - id?: number; - current: number; - update: number; - asks: { p: string; s: number }[]; - bids: { p: string; s: number }[]; +export interface AlphaOrder { + order_id: string; // Order ID + tx_hash: string; // Transaction Hash + side: string; // Buy or sell orders (buy/sell) + usdt_amount: string; // Amount (USDT) + currency: string; // Token + currency_amount: string; // Token amount + status: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) + gas_mode: string; // Trading mode (speed: Smart mode, custom: Custom mode) + chain: string; // Blockchain + gas_fee: string; // Gas Fee (USDT-based) + transaction_fee: string; // Trading Fee (USDT-based) + failed_reason: string; // Failure reason (if applicable) + create_time: number; // Creation timestamp } ⋮---- -export interface OptionsTicker { - name: string; - last_price: string; - mark_price: string; - index_price: string; - ask1_size: number; - ask1_price: string; - bid1_size: number; - bid1_price: string; - position_size: number; - mark_iv: string; - bid_iv: string; - ask_iv: string; - leverage: string; // Leverage calculation formula updated with reference note - delta: string; - gamma: string; - vega: string; - theta: string; - rho: string; +order_id: string; // Order ID +tx_hash: string; // Transaction Hash +side: string; // Buy or sell orders (buy/sell) +usdt_amount: string; // Amount (USDT) +currency: string; // Token +currency_amount: string; // Token amount +status: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) +gas_mode: string; // Trading mode (speed: Smart mode, custom: Custom mode) +chain: string; // Blockchain +gas_fee: string; // Gas Fee (USDT-based) +transaction_fee: string; // Trading Fee (USDT-based) +failed_reason: string; // Failure reason (if applicable) +create_time: number; // Creation timestamp +⋮---- +export interface AlphaCurrency { + currency: string; // Currency symbol + name: string; // Currency name + chain: string; // The main chain corresponding to the coin + address: string; // Contract Address + amount_precision: number; // Amount scale + precision: number; // Price scale + status: number; // Currency Trading Status (1: Normal trading, 2: Suspended trading, 3: Delisted) } ⋮---- -leverage: string; // Leverage calculation formula updated with reference note +currency: string; // Currency symbol +name: string; // Currency name +chain: string; // The main chain corresponding to the coin +address: string; // Contract Address +amount_precision: number; // Amount scale +precision: number; // Price scale +status: number; // Currency Trading Status (1: Normal trading, 2: Suspended trading, 3: Delisted) ⋮---- -export interface OptionsCandle { - t: number; - v?: number; - c: string; - h: string; - l: string; - o: string; +export interface AlphaTicker { + currency: string; // Currency symbol + last: string; // Last trading price + change: string; // 24h price change percentage (negative for decrease, e.g., -7.45) + volume: string; // 24h Trading Volume (USDT) + market_cap: string; // Current Token Market Cap } ⋮---- -export interface OptionsUnderlyingCandle { - t: number; - v?: number; - c: string; - h: string; - l: string; - o: string; - sum: string; -} +currency: string; // Currency symbol +last: string; // Last trading price +change: string; // 24h price change percentage (negative for decrease, e.g., -7.45) +volume: string; // 24h Trading Volume (USDT) +market_cap: string; // Current Token Market Cap + +================ +File: src/types/response/autoinvest.ts +================ +/**========================================================================================================================== + * EARN AUTO INVEST + * ========================================================================================================================== + */ ⋮---- -export interface OptionsTrade { +/** POST /earn/autoinvest/plans/create — example response shape */ +export interface CreateAutoInvestPlanResp { id: number; - create_time: number; - create_time_ms: number; - contract: string; - size: number; - price: string; - is_internal?: boolean; // Deprecated + amount: string; + money: string; + next_time: number; + period_type: string; + period_day: number; + period_hour: number; + fund_flow: string; + fund_source: string; } ⋮---- -is_internal?: boolean; // Deprecated -⋮---- -export interface OptionsAccount { - user: number; - total?: string; // Only applicable to classic options accounts (unified account limitation) - equity?: string; // Only applicable to classic options accounts (unified account limitation) - short_enabled: boolean; - unrealised_pnl: string; // Enhanced with calculation formula - init_margin: string; - maint_margin: string; - order_margin: string; - available: string; - point: string; - currency: string; - liq_triggered?: boolean; // Whether account is in liquidation status - margin_mode?: number; // 0: classic options account; 1: Multi-Currency Margin Mode; 2: Portfolio Margin Mode; 3: Single-Currency Margin Mode +export interface AutoInvestCoinItem { + key: string; + value: string; + asset_icon_url: string; + sort: number; } ⋮---- -total?: string; // Only applicable to classic options accounts (unified account limitation) -equity?: string; // Only applicable to classic options accounts (unified account limitation) -⋮---- -unrealised_pnl: string; // Enhanced with calculation formula -⋮---- -liq_triggered?: boolean; // Whether account is in liquidation status -margin_mode?: number; // 0: classic options account; 1: Multi-Currency Margin Mode; 2: Portfolio Margin Mode; 3: Single-Currency Margin Mode -⋮---- -export interface OptionsAccountChangeRecord { - time: number; - change: string; - balance: string; - type: 'dnw' | 'prem' | 'fee' | 'refr' | 'set'; - text: string; +export interface AutoInvestMinAmountResp { + min_amount: string; } ⋮---- -export interface OptionsPositionsUnderlying { - user: number; - underlying: string; - underlying_price: string; // Forward futures price for the delivery date - contract: string; - size: number; - entry_price: string; - mark_price: string; - mark_iv: string; - realised_pnl: string; - unrealised_pnl: string; - pending_orders: number; - close_order: { - id: number; - price: string; - is_liq: boolean; - } | null; - delta: string; - gamma: string; - vega: string; - theta: string; +export interface AutoInvestPlanExecutionRecord { + id: number; + type: string; + money: string; + user_id: number; + plan_id: number; + plan_version: number; + amount: string; + create_time: number; + update_time: number; + status: string; + status_type: number; + /** 2 = buy, other = sell */ + side: number; + status_message: string; + detail: string; + asset: string; } ⋮---- -underlying_price: string; // Forward futures price for the delivery date +/** 2 = buy, other = sell */ ⋮---- -export interface GetOptionsLiquidationResp { - time: number; - contract: string; - side: 'long' | 'short'; - pnl: string; - text: string; - settle_size: string; +export interface AutoInvestPlanExecutionRecordsPaginated { + page: number; + page_size: number; + total_page: number; + total: number; + list: AutoInvestPlanExecutionRecord[]; } ⋮---- -export interface SubmitOptionsOrderResp { +export interface AutoInvestOrderItem { id: number; - user: number; - create_time: number; - finish_time: number; - finish_as: - | 'filled' - | 'cancelled' - | 'liquidated' - | 'ioc' - | 'auto_deleveraged' - | 'reduce_only' - | 'position_closed'; - status: 'open' | 'finished'; - contract: string; - size: number; - iceberg: number; + type: string; + amount: string; + plan_id: number; + side: number; + asset: string; + record_id: number; + total_money: string; + market: string; price: string; - is_close: boolean; - is_reduce_only: boolean; - is_liq: boolean; - tif: 'gtc' | 'ioc' | 'poc'; - left: number; - fill_price: string; - text: string; - tkfr: string; - mkfr: string; - refu: number; - refr: string; + create_time: number; + total: string; + fund_flow: string; + error_code: number; + error_msg: string; + status: number; } ⋮---- -export interface OptionsUserHistoryRecord { - id: number; - create_time: number; - contract: string; - order_id: number; - size: number; - price: string; - underlying_price: string; // Forward futures price for the delivery date - role: 'taker' | 'maker'; +export interface AutoInvestConfigItem { + coin: string; + max_limit: string; } ⋮---- -underlying_price: string; // Forward futures price for the delivery date +export interface AutoInvestPlanPortfolioItem { + asset: string; + ratio: string; + cum_invest?: string; + cum_hold?: string; + cum_redeem?: string; + avg_price?: string; + redeem_status?: number; + lend_amount?: string; +} ⋮---- -export interface OptionsMMPSettings { - underlying: string; - window: number; - frozen_period: number; - qty_limit: string; - delta_limit: string; - trigger_time_ms: number; // Trigger freeze time in milliseconds, 0 means no freeze triggered - frozen_until_ms: number; // Unfreeze time in milliseconds, if no frozen period is configured, no unfreeze time after freeze is triggered +export interface AutoInvestPlanDetail { + id: number; + version: number; + name: string; + create_time: number; + update_time: number; + user_id: number; + money: string; + amount: string; + period_type: string; + period_day: number; + period_hour: number; + portfolio: AutoInvestPlanPortfolioItem[]; + next_time?: number; + period?: number; + fund_source?: string; + fund_flow?: string; } ⋮---- -trigger_time_ms: number; // Trigger freeze time in milliseconds, 0 means no freeze triggered -frozen_until_ms: number; // Unfreeze time in milliseconds, if no frozen period is configured, no unfreeze time after freeze is triggered +export interface AutoInvestPlansListResp { + page: number; + page_size: number; + page_count: number; + total_count: number; + list: AutoInvestPlanDetail[]; +} ================ -File: src/types/response/p2pMerchant.ts +File: src/types/response/delivery.ts ================ -/** P2P Merchant API response types */ +/**========================================================================================================================== + * DELIVERY + * ========================================================================================================================== + */ ⋮---- -export interface P2PMerchantApiResp { - timestamp: number; - method: string; - code: number; - message: string; - data: T; - version: string; +export interface DeliveryOrderBook { + id?: number; + current: number; + update: number; + asks: { p: string; s: number }[]; + bids: { p: string; s: number }[]; } ⋮---- -export interface P2PMerchantUserInfo { - is_self?: boolean; - user_timest?: string; - counterparties_num?: number; - email_verified?: string; - verified?: string; - has_phone?: string; - user_name?: string; - user_note?: string; - complete_transactions?: string; - paid_transactions?: string; - accepted_transactions?: string; - transactions_used_time?: string; - cancelled_used_time_month?: string; - complete_transactions_month?: string; - complete_rate_month?: number; - orders_buy_rate_month?: number; - is_black?: number; - is_follow?: number; - have_traded?: number; - biz_uid?: string; - blue_vip?: number; - work_status?: number; - registration_days?: number; - first_trade_days?: number; - need_replenish?: number; - merchant_info?: { type?: string; market?: string }; - online_status?: number; - work_hours?: Record | null; - transactions_month?: number; - transactions_all?: number; - trade_versatile?: boolean; - [key: string]: unknown; +export interface DeliveryTrade { + id: number; + create_time: number; + create_time_ms: number; + contract: string; + size: number; + price: string; + is_internal?: boolean; // Deprecated } ⋮---- -export interface P2PMerchantCounterpartyUserInfo { - user_timest?: string; - email_verified?: string; - verified?: string; - has_phone?: string; - user_name?: string; - user_note?: string; - complete_transactions?: string; - paid_transactions?: string; - accepted_transactions?: string; - transactions_used_time?: string; - cancelled_used_time_month?: string; - complete_transactions_month?: string; - complete_rate_month?: number; - is_follow?: number; - have_traded?: number; - biz_uid?: string; - registration_days?: number; - first_trade_days?: number; - trade_versatile?: boolean; - [key: string]: unknown; -} +is_internal?: boolean; // Deprecated ⋮---- -export interface P2PMerchantPaymentMethod { - pay_type: string; - pay_name: string; - ids: number[]; - list: Record[]; +export interface DeliveryCandle { + t: number; + v?: number; + c: string; + h: string; + l: string; + o: string; } ⋮---- -export interface P2PMerchantTransactionListItem { - type_buy?: number; - timest?: string; - timest_expire?: string; - type?: string; - trade_type?: string; - timestamp?: number; - rate?: string; - amount?: string; - total?: string; - txid?: number; - status?: string; - order_status?: string; - [key: string]: unknown; +export interface DeliveryTicker { + contract: string; + last: string; + change_percentage: string; + total_size: string; + low_24h: string; + high_24h: string; + volume_24h: string; + volume_24h_btc?: string; + volume_24h_usd?: string; + volume_24h_base: string; + volume_24h_quote: string; + volume_24h_settle: string; + mark_price: string; + funding_rate: string; + funding_rate_indicative: string; + index_price: string; + quanto_base_rate?: string; // Deprecated + basis_rate: string; + basis_value: string; + lowest_ask: string; + highest_bid: string; } ⋮---- -export interface P2PMerchantTransactionListData { - list: P2PMerchantTransactionListItem[]; - trans_time?: { od_time?: number }[]; - count: number; - exported_num: number; -} +quanto_base_rate?: string; // Deprecated ⋮---- -export interface P2PMerchantTransactionDetails { - is_sell?: number; - txid?: number; - orderid?: number; - timest?: number; - last_pay_time?: number; - remain_pay_time?: number; - currencyType?: string; - want_type?: string; - rate?: string; - amount?: string; - total?: string; - status?: string; - state?: string; - its_uid?: string; - its_nickname?: string; - its_realname?: string; - [key: string]: unknown; +export interface DeliveryAccount { + total: string; // Balance, only applicable to classic contract account + unrealised_pnl: string; + position_margin?: string; // Deprecated + order_margin: string; // Initial margin for all pending orders + available: string; + point: string; + currency: string; + in_dual_mode: boolean; + position_mode?: string; // Position mode: single - one-way, dual - dual-side, split - sub-positions (in_dual_mode is deprecated) + enable_credit: boolean; + position_initial_margin: string; + maintenance_margin: string; + bonus: string; + enable_evolved_classic?: boolean; // Deprecated + cross_order_margin: string; + cross_initial_margin: string; + cross_maintenance_margin: string; + cross_unrealised_pnl: string; + cross_available: string; + isolated_position_margin: string; + enable_new_dual_mode?: boolean; // Deprecated + margin_mode?: number; // 0: classic delivery account; 1: Multi-Currency Margin Mode; 2: Portfolio Margin Mode; 3: Single-Currency Margin Mode + history: { + dnw: string; + pnl: string; + fee: string; + refr: string; + fund: string; + point_dnw: string; + point_fee: string; + point_refr: string; + bonus_dnw: string; + bonus_offset: string; + }; + enable_tiered_mm: boolean; } ⋮---- -export interface P2PMerchantAdsDetail { - rate?: string; - type?: string; - amount?: string; - min_amount?: string; - max_amount?: string; - fiat_min_amount?: string; // v4.106.102: Min fiat amount per order - fiat_max_amount?: string; // v4.106.102: Max fiat amount per order - minFiatAmount?: string; // v4.106.102 - maxFiatAmount?: string; // v4.106.102 - limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount - limitBasisText?: string; // v4.106.102 - polymarket_limit?: string; // v4.106.102 - total?: string; - orderid?: number; - timestamp?: number; - currencyType?: string; - want_type?: string; - status?: string; - [key: string]: unknown; -} +total: string; // Balance, only applicable to classic contract account ⋮---- -fiat_min_amount?: string; // v4.106.102: Min fiat amount per order -fiat_max_amount?: string; // v4.106.102: Max fiat amount per order -minFiatAmount?: string; // v4.106.102 -maxFiatAmount?: string; // v4.106.102 -limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount -limitBasisText?: string; // v4.106.102 -polymarket_limit?: string; // v4.106.102 +position_margin?: string; // Deprecated +order_margin: string; // Initial margin for all pending orders ⋮---- -export interface P2PMerchantMyAdsListItem { - type?: string; - rate?: string; - amount?: string; - total?: string; - id?: string; - status?: string; - currencyType?: string; - want_type?: string; - fiat_min_amount?: string; // v4.106.102 - fiat_max_amount?: string; // v4.106.102 - limit_basis?: string; // v4.106.103 - limit_basis_text?: string; // v4.106.103 - [key: string]: unknown; -} +position_mode?: string; // Position mode: single - one-way, dual - dual-side, split - sub-positions (in_dual_mode is deprecated) ⋮---- -fiat_min_amount?: string; // v4.106.102 -fiat_max_amount?: string; // v4.106.102 -limit_basis?: string; // v4.106.103 -limit_basis_text?: string; // v4.106.103 +enable_evolved_classic?: boolean; // Deprecated ⋮---- -export interface P2PMerchantMyAdsListData { - lists: P2PMerchantMyAdsListItem[]; -} +enable_new_dual_mode?: boolean; // Deprecated +margin_mode?: number; // 0: classic delivery account; 1: Multi-Currency Margin Mode; 2: Portfolio Margin Mode; 3: Single-Currency Margin Mode ⋮---- -export interface P2PMerchantAdsListItem { - index?: number; - asset?: string; - fiat_unit?: string; - adv_no?: number; - price?: string; - max_single_trans_amount?: string; - min_single_trans_amount?: string; - nick_name?: string; - surplus_amount?: string; // v4.106.103: Remaining tradable crypto quantity - trade_methods?: string[]; // v4.106.103: Supported payment methods list - fiat_min_amount?: string; // v4.106.103 - fiat_max_amount?: string; // v4.106.103 - limit_basis?: string; // v4.106.103 - limit_basis_text?: string; // v4.106.103 +export interface DeliveryBook { + time: number; + change: string; + balance: string; + type: + | 'dnw' + | 'pnl' + | 'fee' + | 'refr' + | 'fund' + | 'point_dnw' + | 'point_fee' + | 'point_refr' + | 'bonus_offset'; + text: string; + contract?: string; + trade_id?: string; } ⋮---- -surplus_amount?: string; // v4.106.103: Remaining tradable crypto quantity -trade_methods?: string[]; // v4.106.103: Supported payment methods list -fiat_min_amount?: string; // v4.106.103 -fiat_max_amount?: string; // v4.106.103 -limit_basis?: string; // v4.106.103 -limit_basis_text?: string; // v4.106.103 -⋮---- -export interface P2PMerchantChatMessage { - is_sell?: number; - msg_type?: number; - msg?: string; - username?: string; - uid?: string; - timest?: number; - type?: number; - pic?: string; - file_key?: string; - file_type?: string; - width?: string; - height?: string; - msg_obj?: Record; - risk_type?: number; // v4.106.96: 1 off-platform traffic diversion risk - toast_msg?: string; // v4.106.96 - [key: string]: unknown; +export interface DeliveryTradingHistoryRecord { + id: number; + create_time: number; + contract: string; + order_id: string; + size: number; + price: string; + role: 'taker' | 'maker'; + text: string; + fee: string; + point_fee: string; } ⋮---- -risk_type?: number; // v4.106.96: 1 off-platform traffic diversion risk -toast_msg?: string; // v4.106.96 -⋮---- -/** v4.106.96: Risk control response when place_biz_push_order hits off-platform diversion check */ -export interface P2PMerchantPlaceOrderRiskData { - risk_code?: string; - risk_event?: { - type?: string; - title?: string; - msg?: string; - action?: string; - content_risk_type?: string; - trade_tips?: string; - auto_reply?: string; - }; +export interface DeliveryClosedPosition { + time: number; + contract: string; + side: 'long' | 'short'; + pnl: string; + pnl_pnl: string; + pnl_fund: string; + pnl_fee: string; + text: string; + max_size: string; + first_open_time: number; + long_price: string; + short_price: string; } ⋮---- -/** v4.106.96: send_chat_message risk fields in data */ -export interface P2PMerchantSendChatMessageData { - risk_type?: number; - toast_msg?: string; - [key: string]: unknown; +export interface DeliveryLiquidationHistoryRecord { + time: number; + contract: string; + leverage?: string; + size: number; + margin?: string; + entry_price?: string; + liq_price?: string; + mark_price?: string; + order_id?: number; + order_price: string; + fill_price: string; + left: number; } ⋮---- -export interface P2PMerchantChatsListData { - messages: P2PMerchantChatMessage[]; - has_history?: boolean; - txid?: number; - SRVTM?: number; - order_status?: string; - memo?: string; +export interface DeliverySettlementHistoryRecord { + time: number; + contract: string; + leverage: string; + size: number; + margin: string; + entry_price: string; + settle_price: string; + profit: string; + fee: string; } ================ -File: src/types/response/rebate.ts +File: src/types/response/margin.ts ================ -export interface AgencyTransactionHistoryRecord { - transaction_time: number; - user_id: number; - group_name: string; - fee: string; - fee_asset: string; +/**========================================================================================================================== + * MARGIN + * ========================================================================================================================== + */ +⋮---- +export interface MarginAccount { currency_pair: string; - amount: string; - amount_asset: string; - source: string; + locked: boolean; + risk: string; + base: { + currency: string; + available: string; + locked: string; + borrowed: string; + interest: string; + }; + quote: { + currency: string; + available: string; + locked: string; + borrowed: string; + interest: string; + }; } ⋮---- -export interface AgencyCommissionHistoryRecord { - commission_time: number; - user_id: number; - group_name: string; - /** Rebate commission amount (not a generic trade notional). */ - commission_amount: string; - /** Asset of the rebate commission. */ - commission_asset: string; - source: string; +export interface MarginBalanceHistoryRecord { + id: string; + time: string; + time_ms: number; + currency: string; + currency_pair: string; + change: string; + balance: string; + type: string; } ⋮---- -/** Rebate commission amount (not a generic trade notional). */ -⋮---- -/** Asset of the rebate commission. */ -⋮---- -export interface PartnerSubordinate { - user_id: number; - user_join_time: number; - type: number; - desc: string; +export interface CrossMarginCurrency { + name: string; + rate: string; + prec: string; + discount: string; + min_borrow_amount: string; + user_max_borrow_amount: string; + total_max_borrow_amount: string; + price: string; + loanable: boolean; + status: number; } ⋮---- -export interface BrokerCommissionHistoryRecord { - commission_time: number; +export interface CrossMarginAccount { user_id: number; - group_name: string; - amount: string; - fee: string; - fee_asset: string; - rebate_fee: string; - source: string; // Rebate source, e.g. Spot, Futures, Options, Alpha, TradFi - currency_pair: string; - sub_broker_info: { - user_id: number; - original_commission_rate: string; - relative_commission_rate: string; - commission_rate: string; + refresh_time: number; + locked: boolean; + balances: { + [currency: string]: { + available: string; + freeze: string; + borrowed: string; + interest: string; + negative_liab: string; + futures_pos_liab: string; + equity: string; + total_freeze: string; + total_liab: string; + }; }; + total: string; + borrowed: string; + interest: string; + risk: string; + total_initial_margin: string; + total_margin_balance: string; + total_maintenance_margin: string; + total_initial_margin_rate: string; + total_maintenance_margin_rate: string; + total_available_margin: string; + portfolio_margin_total: string; + portfolio_margin_total_liab: string; + portfolio_margin_total_equity: string; } ⋮---- -source: string; // Rebate source, e.g. Spot, Futures, Options, Alpha, TradFi +export interface CrossMarginAccountHistoryRecord { + id: string; + time: number; + currency: string; + change: string; + balance: string; + type: string; +} ⋮---- -export interface BrokerTransactionHistoryRecord { - transaction_time: number; - user_id: number; - group_name: string; - fee: string; - currency_pair: string; +export interface CrossMarginMorrowLoanRecord { + id: string; + create_time: number; + update_time: number; + currency: string; amount: string; - fee_asset: string; - source: string; // Rebate source, e.g. Spot, Futures, Options, Alpha, TradFi - sub_broker_info: { - user_id: number; - original_commission_rate: string; - relative_commission_rate: string; - commission_rate: string; + text?: string; + status: number; + repaid: string; + repaid_interest: string; + unpaid_interest: string; +} +⋮---- +export interface MarginUserAccount { + currency_pair: string; + account_type: string; // Description updated to remove "risk" option + leverage: string; + locked: boolean; + risk?: string; // Deprecated + mmr?: string; // Refined description + base: { + currency: string; + available: string; + locked: string; + borrowed: string; + interest: string; + }; + quote: { + currency: string; + available: string; + locked: string; + borrowed: string; + interest: string; }; } ⋮---- -source: string; // Rebate source, e.g. Spot, Futures, Options, Alpha, TradFi +account_type: string; // Description updated to remove "risk" option ⋮---- -export interface PartnerCommission { - commission_time: number; - user_id: number; - group_name: string; - /** Rebate commission amount (not a generic trade notional). */ - commission_amount: string; - /** Asset of the rebate commission. */ - commission_asset: string; - source: string; +risk?: string; // Deprecated +mmr?: string; // Refined description + +================ +File: src/types/response/marginuni.ts +================ +/**========================================================================================================================== + * MARGIN UNI + * ========================================================================================================================== + */ +⋮---- +export interface LendingMarket { + currency_pair: string; + base_min_borrow_amount: string; + quote_min_borrow_amount: string; + leverage: string; } ⋮---- -/** Rebate commission amount (not a generic trade notional). */ +export interface MarginUNILoan { + currency: string; + currency_pair: string; + amount: string; + type: string; // Lending type, margin indicates margin borrowing + create_time: number; + update_time: number; +} ⋮---- -/** Asset of the rebate commission. */ +type: string; // Lending type, margin indicates margin borrowing ⋮---- -export interface PartnerTransaction { - transaction_time: number; - user_id: number; - group_name: string; - fee: string; - fee_asset: string; +export interface MarginUNILoanRecord { + type: string; currency_pair: string; + currency: string; amount: string; - amount_asset: string; - source: string; + create_time: number; } ⋮---- -/** `data` object for GET /rebate/partner/data/aggregated */ -export interface PartnerDataAggregated { - rebate_amount: string; - trade_volume: string; - net_fee: string; - customer_count: number; - /** Only when querying all business types (`business_type=0`); may be null */ - trading_user_count?: string | null; - time_range_desc: string; - business_type: number; - business_type_desc: string; +export interface MarginUNIInterestRecord { + currency: string; + currency_pair: string; + actual_rate: string; + interest: string; + status: number; + type: string; // Lending type, margin indicates margin borrowing + create_time: number; } ⋮---- -/** Only when querying all business types (`business_type=0`); may be null */ +type: string; // Lending type, margin indicates margin borrowing ⋮---- -export interface PartnerDataAggregatedResponse { - code: number; - message: string; - data: PartnerDataAggregated; - timestamp: number; +export interface MarginUNIMaxBorrowable { + currency: string; + currency_pair: string; + borrowable: string; } ================ -File: src/types/shared.ts +File: src/types/response/multicollateralLoan.ts ================ -export type GateBaseUrlKey = - | 'live' - | 'futuresLiveAlternative' - | 'futuresTestnet'; -⋮---- -// interfaces +/**========================================================================================================================== + * MULTI COLLATERAL LOAN + * ========================================================================================================================== + */ ⋮---- -export interface FromToPageLimit { - from: number; - to: number; - page: number; - limit: number; +export interface MultiLoanOrder { + order_id: string; + order_type: string; + fixed_type: string; + fixed_rate: string; + expire_time: number; + auto_renew: boolean; + auto_repay: boolean; + current_ltv: string; + status: string; + borrow_time: number; + total_left_repay_usdt: string; + total_left_collateral_usdt: string; + borrow_currencies: { + currency: string; + index_price: string; + left_repay_principal: string; + left_repay_interest: string; + left_repay_usdt: string; + }[]; + collateral_currencies: { + currency: string; + index_price: string; + left_collateral: string; + left_collateral_usdt: string; + }[]; } ⋮---- -// Used for spot and flash swap -export interface CurrencyPair { - id?: string; - base?: string; - base_name?: string; - quote?: string; - quote_name?: string; - fee?: string; - min_base_amount?: string; - min_quote_amount?: string; - max_base_amount?: string; - max_quote_amount?: string; - amount_precision?: number; - precision?: number; - trade_status?: 'untradable' | 'buyable' | 'sellable' | 'tradable'; - sell_start?: number; - buy_start?: number; - type: string; - delisting_time?: number; - trade_url?: string; - up_rate?: string; // v4.106.4: Maximum price increase percentage - down_rate?: string; // v4.106.4: Maximum price decrease percentage +export interface RepayMultiLoanResp { + order_id: number; + repaid_currencies: { + succeeded: boolean; + label?: string; + message?: string; + currency: string; + repaid_principal: string; + repaid_interest: string; + }[]; } ⋮---- -up_rate?: string; // v4.106.4: Maximum price increase percentage -down_rate?: string; // v4.106.4: Maximum price decrease percentage - -================ -File: src/WebsocketAPIClient.ts -================ -import { DefaultLogger } from './lib/logger.js'; -import { WS_KEY_MAP } from './lib/websocket/websocket-util.js'; -import { WSClientConfigurableOptions } from './types/websockets/client.js'; -import { - WSAPIFuturesOrder, - WSAPIFuturesOrderAmendReq, - WSAPIFuturesOrderBatchPlaceRespItem, - WSAPIFuturesOrderCancelCPReq, - WSAPIFuturesOrderCancelIdsRespItem, - WSAPIFuturesOrderCancelReq, - WSAPIFuturesOrderListReq, - WSAPIFuturesOrderPlaceReq, - WSAPIFuturesOrderStatusReq, - WSAPIResponse, - WSAPISpotOrder, - WSAPISpotOrderAmendReq, - WSAPISpotOrderCancelCPReq, - WSAPISpotOrderCancelIdsReq, - WSAPISpotOrderCancelIdsRespItem, - WSAPISpotOrderCancelReq, - WSAPISpotOrderListReq, - WSAPISpotOrderPlaceReq, - WSAPISpotOrderStatusReq, - WSAPIWsKey, -} from './types/websockets/wsAPI.js'; -import { WebsocketClient } from './WebsocketClient.js'; -⋮---- -/** - * Configurable options specific to only the REST-like WebsocketAPIClient - */ -export interface WSAPIClientConfigurableOptions { - /** - * Default: true - * - * Attach default event listeners, which will console log any high level - * events (opened/reconnecting/reconnected/etc). - * - * If you disable this, you should set your own event listeners - * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. - */ - attachEventListeners: boolean; +export interface MultiLoanRepayRecord { + order_id: number; + record_id: number; + init_ltv: string; + before_ltv: string; + after_ltv: string; + borrow_time: number; + repay_time: number; + borrow_currencies: { + currency: string; + index_price: string; + before_amount: string; + before_amount_usdt: string; + after_amount: string; + after_amount_usdt: string; + }[]; + collateral_currencies: { + currency: string; + index_price: string; + before_amount: string; + before_amount_usdt: string; + after_amount: string; + after_amount_usdt: string; + }[]; + repaid_currencies: { + currency: string; + index_price: string; + repaid_amount: string; + repaid_principal: string; + repaid_interest: string; + repaid_amount_usdt: string; + }[]; + total_interest_list: { + currency: string; + index_price: string; + amount: string; + amount_usdt: string; + }[]; + left_repay_interest_list: { + currency: string; + index_price: string; + before_amount: string; + before_amount_usdt: string; + after_amount: string; + after_amount_usdt: 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 UpdateMultiLoanResp { + order_id: number; + collateral_currencies: { + succeeded: boolean; + label?: string; + message?: string; + currency: string; + amount: string; + }[]; +} ⋮---- -/** - * This is a minimal Websocket API wrapper around the WebsocketClient. - * - * Some methods support passing in a custom "wsKey". This is a reference to which WS connection should - * be used to transmit that message. This is only useful if you wish to use an alternative wss - * domain that is supported by the SDK. - * - * Note: To use testnet, don't set the wsKey - use `testnet: true` in - * the constructor instead. - * - * 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/gateio-api/blob/master/examples/ws-private-spot-wsapi.ts#L119 - */ -export class WebsocketAPIClient +export interface MultiLoanAdjustmentRecord { + order_id: number; + record_id: number; + before_ltv: string; + after_ltv: string; + operate_time: number; + borrow_currencies: { + currency: string; + index_price: string; + before_amount: string; + before_amount_usdt: string; + after_amount: string; + after_amount_usdt: string; + }[]; + collateral_currencies: { + currency: string; + index_price: string; + before_amount: string; + before_amount_usdt: string; + after_amount: string; + after_amount_usdt: string; + }[]; +} ⋮---- -constructor( - options?: WSClientConfigurableOptions & - Partial, - logger?: DefaultLogger, -) +export interface MultiLoanCurrencyQuota { + currency: string; + index_price: string; + min_quota: string; + left_quota: string; + left_quote_usdt: string; + /** Remaining borrow/collateral limit for fixed-term currency */ + left_quota_fixed?: string; + /** Remaining currency limit for fixed-term converted to USDT */ + left_quote_usdt_fixed?: string; +} ⋮---- -public getWSClient(): WebsocketClient +/** Remaining borrow/collateral limit for fixed-term currency */ ⋮---- -public setTimeOffsetMs(newOffset: number): void +/** Remaining currency limit for fixed-term converted to USDT */ ⋮---- -/* - * - * SPOT - Trading requests - * - */ -⋮---- -/** - * Submit a spot order - */ -submitNewSpotOrder( - params: WSAPISpotOrderPlaceReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface MultiLoanSupportedCurrencies { + loan_currencies: { + currency: string; + price: string; + }[]; + collateral_currencies: { + currency: string; + index_price: string; + discount: string; + }[]; +} ⋮---- -/** - * Cancel a spot order - */ -cancelSpotOrder( - params: WSAPISpotOrderCancelReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface MultiLoanRatio { + init_ltv: string; + alert_ltv: string; + liquidate_ltv: string; +} ⋮---- -/** - * Cancel all spot orders with the given id list - */ -cancelSpotOrderById( - params: WSAPISpotOrderCancelIdsReq[], - wsKey?: WSAPIWsKey, -): Promise> +export interface MultiLoanFixedRate { + currency: string; + rate_7d: string; + rate_30d: string; + update_time: number; +} + +================ +File: src/types/response/options.ts +================ +/**========================================================================================================================== + * OPTIONS + * ========================================================================================================================== + */ ⋮---- -/** - * Cancel a spot order for a given symbol - */ -cancelSpotOrderForSymbol( - params: WSAPISpotOrderCancelCPReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface OptionsContract { + name: string; + tag: string; // Expiry period: day, week, month + create_time: number; + expiration_time: number; + is_call: boolean; + strike_price: string; + last_price: string; + mark_price: string; + orderbook_id: number; + trade_id?: number; // Deprecated + trade_size: number; + position_size: number; + underlying: string; + underlying_price: string; // Forward futures price for the delivery date + multiplier: string; // Option contract multiplier + order_price_round: string; + mark_price_round: string; // Minimum unit of mark price + maker_fee_rate: string; + taker_fee_rate: string; + price_limit_fee_rate: string; + ref_discount_rate: string; + ref_rebate_rate: string; + order_price_deviate?: string; // Deprecated + order_size_min: number; + order_size_max: number; + orders_limit: number; // Maximum number of orders per user in this market +} ⋮---- -/** - * Update a spot order - */ -updateSpotOrder( - params: WSAPISpotOrderAmendReq, - wsKey?: WSAPIWsKey, -): Promise> +tag: string; // Expiry period: day, week, month ⋮---- -/** - * Get the status of a spot order - */ -getSpotOrderStatus( - params: WSAPISpotOrderStatusReq, - wsKey?: WSAPIWsKey, -): Promise> +trade_id?: number; // Deprecated ⋮---- -/** - * Get all spot orders - */ -getSpotOrders( - params: WSAPISpotOrderListReq, - wsKey?: WSAPIWsKey, -): Promise> +underlying_price: string; // Forward futures price for the delivery date +multiplier: string; // Option contract multiplier ⋮---- -/* - * - * Futures - Trading requests - * - */ +mark_price_round: string; // Minimum unit of mark price ⋮---- -/** - * Submit a futures order. - * - * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection - */ -submitNewFuturesOrder( - params: WSAPIFuturesOrderPlaceReq, - wsKey?: WSAPIWsKey, -): Promise> +order_price_deviate?: string; // Deprecated ⋮---- -/** - * Submit a batch of futures orders - * - * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection - */ -submitNewFuturesBatchOrder( - params: WSAPIFuturesOrderPlaceReq[], - wsKey?: WSAPIWsKey, -): Promise> +orders_limit: number; // Maximum number of orders per user in this market ⋮---- -/** - * Cancel a futures order - * - * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection - */ -cancelFuturesOrder( - params: WSAPIFuturesOrderCancelReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface OptionsSettlementHistoryRecord { + time: number; + contract: string; + profit: string; + fee: string; + strike_price: string; + settle_price: string; +} ⋮---- -/** - * Cancel futures orders by id list - * - * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection - */ -cancelFuturesOrderById( - params: string[], - wsKey?: WSAPIWsKey, -): Promise> +export interface OptionsUserSettlement { + time: number; + underlying: string; + contract: string; + strike_price: string; + settle_price: string; + size: number; + settle_profit: string; + fee: string; + realised_pnl: string; +} ⋮---- -/** - * Cancel all open futures orders - * - * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection - */ -cancelFuturesAllOpenOrders( - params: WSAPIFuturesOrderCancelCPReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface OptionsOrderBook { + id?: number; + current: number; + update: number; + asks: { p: string; s: number }[]; + bids: { p: string; s: number }[]; +} ⋮---- -/** - * Update a futures order - * - * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection - */ -updateFuturesOrder( - params: WSAPIFuturesOrderAmendReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface OptionsTicker { + name: string; + last_price: string; + mark_price: string; + index_price: string; + ask1_size: number; + ask1_price: string; + bid1_size: number; + bid1_price: string; + position_size: number; + mark_iv: string; + bid_iv: string; + ask_iv: string; + leverage: string; // Leverage calculation formula updated with reference note + delta: string; + gamma: string; + vega: string; + theta: string; + rho: string; +} ⋮---- -/** - * Get all futures orders - * - * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection - */ -getFuturesOrders( - params: WSAPIFuturesOrderListReq, - wsKey?: WSAPIWsKey, -): Promise> +leverage: string; // Leverage calculation formula updated with reference note ⋮---- -/** - * Get futures order status - * - * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection - */ -getFuturesOrderStatus( - params: WSAPIFuturesOrderStatusReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface OptionsCandle { + t: number; + v?: number; + c: string; + h: string; + l: string; + o: string; +} ⋮---- -/** - * - * - * - * - * - * - * - * Private methods for handling some of the convenience/automation provided by the WS API Client - * - * - * - * - * - * - * - */ -⋮---- -private setupDefaultEventListeners() +export interface OptionsUnderlyingCandle { + t: number; + v?: number; + c: string; + h: string; + l: string; + o: string; + sum: string; +} ⋮---- -/** - * General event handlers for monitoring the WebsocketClient - */ +export interface OptionsTrade { + id: number; + create_time: number; + create_time_ms: number; + contract: string; + size: number; + price: string; + is_internal?: boolean; // Deprecated +} ⋮---- -// Blind JSON.stringify can fail on circular references +is_internal?: boolean; // Deprecated ⋮---- -// 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 -bundleReport.html -.history/ -dist -coverage -localtest.sh -repomix.sh -doc - -ws-private-spot-wsapi-performance.ts -ws-private-perp-futures-wsapi-readonly.ts -privatetest.ts - -privaterepotracker -restClientRegex.ts - -testfile.ts - -================ -File: examples/Rest/otc/submitOTCBankPersonalSupplement.ts -================ -import { readFileSync } from 'fs'; +export interface OptionsAccount { + user: number; + total?: string; // Only applicable to classic options accounts (unified account limitation) + equity?: string; // Only applicable to classic options accounts (unified account limitation) + short_enabled: boolean; + unrealised_pnl: string; // Enhanced with calculation formula + init_margin: string; + maint_margin: string; + order_margin: string; + available: string; + point: string; + currency: string; + liq_triggered?: boolean; // Whether account is in liquidation status + margin_mode?: number; // 0: classic options account; 1: Multi-Currency Margin Mode; 2: Portfolio Margin Mode; 3: Single-Currency Margin Mode +} ⋮---- -import { RestClient } from '../../../src/index.js'; -// import { RestClient } from 'gateio-api'; +total?: string; // Only applicable to classic options accounts (unified account limitation) +equity?: string; // Only applicable to classic options accounts (unified account limitation) ⋮---- -async function submitOTCBankPersonalSupplementExample() - -================ -File: src/lib/BaseWSClient.ts -================ -import EventEmitter from 'events'; -import WebSocket from 'isomorphic-ws'; +unrealised_pnl: string; // Enhanced with calculation formula ⋮---- -import { - WebsocketClientOptions, - WSClientConfigurableOptions, -} from '../types/websockets/client.js'; -import { WsOperation } from '../types/websockets/requests.js'; -import { WS_LOGGER_CATEGORY } from '../WebsocketClient.js'; -import { DefaultLogger } from './logger.js'; -import { isMessageEvent, MessageEventLike } from './requestUtils.js'; -import { checkWebCryptoAPISupported } from './webCryptoAPI.js'; -import { - safeTerminateWs, - WsTopicRequest, - WsTopicRequestOrStringTopic, -} from './websocket/websocket-util.js'; -import { WsStore } from './websocket/WsStore.js'; -import { - WSConnectedResult, - WsConnectionStateEnum, -} from './websocket/WsStore.types.js'; +liq_triggered?: boolean; // Whether account is in liquidation status +margin_mode?: number; // 0: classic options account; 1: Multi-Currency Margin Mode; 2: Portfolio Margin Mode; 3: Single-Currency Margin Mode ⋮---- -interface WSClientEventMap { - /** Connection opened. If this connection was previously opened and reconnected, expect the reconnected event instead */ - open: (evt: { - wsKey: WsKey; - event: any; - wsUrl: string; - ws: WebSocket; - }) => void /** Reconnecting a dropped connection */; - reconnect: (evt: { wsKey: WsKey; event: any }) => void; - /** Successfully reconnected a connection that dropped */ - reconnected: (evt: { - wsKey: WsKey; - event: any; - wsUrl: string; - ws: WebSocket; - }) => void; - /** Connection closed */ - close: (evt: { wsKey: WsKey; event: any }) => void; - /** Received reply to websocket command (e.g. after subscribing to topics) */ - response: (response: any & { wsKey: WsKey }) => void; - /** Received data for topic */ - update: (response: any & { wsKey: WsKey }) => void; - /** Exception from ws client OR custom listeners (e.g. if you throw inside your event handler) */ - exception: (response: any & { wsKey: WsKey }) => void; - error: (response: any & { wsKey: WsKey }) => void; - /** Confirmation that a connection successfully authenticated */ - authenticated: (event: { wsKey: WsKey; event: any }) => void; +export interface OptionsAccountChangeRecord { + time: number; + change: string; + balance: string; + type: 'dnw' | 'prem' | 'fee' | 'refr' | 'set'; + text: string; } ⋮---- -/** Connection opened. If this connection was previously opened and reconnected, expect the reconnected event instead */ -⋮---- -}) => void /** Reconnecting a dropped connection */; -⋮---- -/** Successfully reconnected a connection that dropped */ +export interface OptionsPositionsUnderlying { + user: number; + underlying: string; + underlying_price: string; // Forward futures price for the delivery date + contract: string; + size: number; + entry_price: string; + mark_price: string; + mark_iv: string; + realised_pnl: string; + unrealised_pnl: string; + pending_orders: number; + close_order: { + id: number; + price: string; + is_liq: boolean; + } | null; + delta: string; + gamma: string; + vega: string; + theta: string; +} ⋮---- -/** Connection closed */ +underlying_price: string; // Forward futures price for the delivery date ⋮---- -/** Received reply to websocket command (e.g. after subscribing to topics) */ +export interface GetOptionsLiquidationResp { + time: number; + contract: string; + side: 'long' | 'short'; + pnl: string; + text: string; + settle_size: string; +} ⋮---- -/** Received data for topic */ +export interface SubmitOptionsOrderResp { + id: number; + user: number; + create_time: number; + finish_time: number; + finish_as: + | 'filled' + | 'cancelled' + | 'liquidated' + | 'ioc' + | 'auto_deleveraged' + | 'reduce_only' + | 'position_closed'; + status: 'open' | 'finished'; + contract: string; + size: number; + iceberg: number; + price: string; + is_close: boolean; + is_reduce_only: boolean; + is_liq: boolean; + tif: 'gtc' | 'ioc' | 'poc'; + left: number; + fill_price: string; + text: string; + tkfr: string; + mkfr: string; + refu: number; + refr: string; +} ⋮---- -/** Exception from ws client OR custom listeners (e.g. if you throw inside your event handler) */ +export interface OptionsUserHistoryRecord { + id: number; + create_time: number; + contract: string; + order_id: number; + size: number; + price: string; + underlying_price: string; // Forward futures price for the delivery date + role: 'taker' | 'maker'; +} ⋮---- -/** Confirmation that a connection successfully authenticated */ +underlying_price: string; // Forward futures price for the delivery date ⋮---- -export interface EmittableEvent { - eventType: 'response' | 'update' | 'exception' | 'authenticated'; - event: TEvent; +export interface OptionsMMPSettings { + underlying: string; + window: number; + frozen_period: number; + qty_limit: string; + delta_limit: string; + trigger_time_ms: number; // Trigger freeze time in milliseconds, 0 means no freeze triggered + frozen_until_ms: number; // Unfreeze time in milliseconds, if no frozen period is configured, no unfreeze time after freeze is triggered } ⋮---- -// Type safety for on and emit handlers: https://stackoverflow.com/a/61609010/880837 -export interface BaseWebsocketClient { - on>( - event: U, - listener: WSClientEventMap[U], - ): this; +trigger_time_ms: number; // Trigger freeze time in milliseconds, 0 means no freeze triggered +frozen_until_ms: number; // Unfreeze time in milliseconds, if no frozen period is configured, no unfreeze time after freeze is triggered - emit>( - event: U, - ...args: Parameters[U]> - ): boolean; +================ +File: src/types/response/rebate.ts +================ +export interface AgencyTransactionHistoryRecord { + transaction_time: number; + user_id: number; + group_name: string; + fee: string; + fee_asset: string; + currency_pair: string; + amount: string; + amount_asset: string; + source: string; } ⋮---- -on>( - event: U, - listener: WSClientEventMap[U], - ): this; -⋮---- -emit>( - event: U, - ...args: Parameters[U]> - ): boolean; -⋮---- -/** - * Users can conveniently pass topics as strings or objects (object has topic name + optional params). - * - * This method normalises topics into objects (object has topic name + optional params). - */ -function getNormalisedTopicRequests( - wsTopicRequests: WsTopicRequestOrStringTopic[], -): WsTopicRequest[] -⋮---- -// passed as string, convert to object -⋮---- -// already a normalised object, thanks to user -⋮---- -/** - * Base WebSocket abstraction layer. Handles connections, tracking each connection as a unique "WS Key" - */ -// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging -export abstract class BaseWebsocketClient< +export interface AgencyCommissionHistoryRecord { + commission_time: number; + user_id: number; + group_name: string; + /** Rebate commission amount (not a generic trade notional). */ + commission_amount: string; + /** Asset of the rebate commission. */ + commission_asset: string; + source: string; +} ⋮---- -/** - * The WS connections supported by the client, each identified by a unique primary key - */ +/** Rebate commission amount (not a generic trade notional). */ ⋮---- -/** - * State store to track a list of topics (topic requests) we are expected to be subscribed to if reconnected - */ +/** Asset of the rebate commission. */ ⋮---- -constructor( - options?: WSClientConfigurableOptions, - logger?: typeof DefaultLogger, -) +export interface PartnerSubordinate { + user_id: number; + user_join_time: number; + type: number; + desc: string; +} ⋮---- -// Some defaults: +export interface BrokerCommissionHistoryRecord { + commission_time: number; + user_id: number; + group_name: string; + amount: string; + fee: string; + fee_asset: string; + rebate_fee: string; + source: string; // Rebate source, e.g. Spot, Futures, Options, Alpha, TradFi + currency_pair: string; + sub_broker_info: { + user_id: number; + original_commission_rate: string; + relative_commission_rate: string; + commission_rate: string; + }; +} ⋮---- -// Gate.io only has one connection (for both public & private). Auth works with every sub, not on connect, so this is turned off. +source: string; // Rebate source, e.g. Spot, Futures, Options, Alpha, TradFi ⋮---- -// Gate.io requires auth to be added to every request, when subscribing to private topics. This is handled automatically. +export interface BrokerTransactionHistoryRecord { + transaction_time: number; + user_id: number; + group_name: string; + fee: string; + currency_pair: string; + amount: string; + fee_asset: string; + source: string; // Rebate source, e.g. Spot, Futures, Options, Alpha, TradFi + sub_broker_info: { + user_id: number; + original_commission_rate: string; + relative_commission_rate: string; + commission_rate: string; + }; +} ⋮---- -// Automatically re-auth WS API, if we were auth'd before and get reconnected +source: string; // Rebate source, e.g. Spot, Futures, Options, Alpha, TradFi ⋮---- -// Check Web Crypto API support when credentials are provided and no custom sign function is used +export interface PartnerCommission { + commission_time: number; + user_id: number; + group_name: string; + /** Rebate commission amount (not a generic trade notional). */ + commission_amount: string; + /** Asset of the rebate commission. */ + commission_asset: string; + source: string; +} ⋮---- -protected abstract isAuthOnConnectWsKey(wsKey: TWSKey): boolean; +/** Rebate commission amount (not a generic trade notional). */ ⋮---- -protected abstract sendPingEvent(wsKey: TWSKey, ws: WebSocket): void; +/** Asset of the rebate commission. */ ⋮---- -protected abstract sendPongEvent(wsKey: TWSKey, ws: WebSocket): void; +export interface PartnerTransaction { + transaction_time: number; + user_id: number; + group_name: string; + fee: string; + fee_asset: string; + currency_pair: string; + amount: string; + amount_asset: string; + source: string; +} ⋮---- -protected abstract isWsPing(data: any): boolean; +/** `data` object for GET /rebate/partner/data/aggregated */ +export interface PartnerDataAggregated { + rebate_amount: string; + trade_volume: string; + net_fee: string; + customer_count: number; + /** Only when querying all business types (`business_type=0`); may be null */ + trading_user_count?: string | null; + time_range_desc: string; + business_type: number; + business_type_desc: string; +} ⋮---- -protected abstract isWsPong(data: any): boolean; +/** Only when querying all business types (`business_type=0`); may be null */ ⋮---- -protected abstract getWsAuthRequestEvent(wsKey: TWSKey): Promise; +export interface PartnerDataAggregatedResponse { + code: number; + message: string; + data: PartnerDataAggregated; + timestamp: number; +} + +================ +File: src/types/shared.ts +================ +export type GateBaseUrlKey = + | 'live' + | 'futuresLiveAlternative' + | 'futuresTestnet'; ⋮---- -protected abstract isPrivateTopicRequest( - request: WsTopicRequest, - wsKey: TWSKey, - ): boolean; +// interfaces ⋮---- -protected abstract getPrivateWSKeys(): TWSKey[]; +export interface FromToPageLimit { + from: number; + to: number; + page: number; + limit: number; +} ⋮---- -protected abstract getWsUrl(wsKey: TWSKey): string; +// Used for spot and flash swap +export interface CurrencyPair { + id?: string; + base?: string; + base_name?: string; + quote?: string; + quote_name?: string; + fee?: string; + min_base_amount?: string; + min_quote_amount?: string; + max_base_amount?: string; + max_quote_amount?: string; + amount_precision?: number; + precision?: number; + trade_status?: 'untradable' | 'buyable' | 'sellable' | 'tradable'; + sell_start?: number; + buy_start?: number; + type: string; + delisting_time?: number; + trade_url?: string; + up_rate?: string; // v4.106.4: Maximum price increase percentage + down_rate?: string; // v4.106.4: Maximum price decrease percentage +} ⋮---- -protected abstract getMaxTopicsPerSubscribeEvent( - wsKey: TWSKey, - ): number | null; +up_rate?: string; // v4.106.4: Maximum price increase percentage +down_rate?: string; // v4.106.4: Maximum price decrease percentage + +================ +File: src/WebsocketAPIClient.ts +================ +import { DefaultLogger } from './lib/logger.js'; +import { WS_KEY_MAP } from './lib/websocket/websocket-util.js'; +import { WSClientConfigurableOptions } from './types/websockets/client.js'; +import { + WSAPIFuturesOrder, + WSAPIFuturesOrderAmendReq, + WSAPIFuturesOrderBatchPlaceRespItem, + WSAPIFuturesOrderCancelCPReq, + WSAPIFuturesOrderCancelIdsRespItem, + WSAPIFuturesOrderCancelReq, + WSAPIFuturesOrderListReq, + WSAPIFuturesOrderPlaceReq, + WSAPIFuturesOrderStatusReq, + WSAPIResponse, + WSAPISpotOrder, + WSAPISpotOrderAmendReq, + WSAPISpotOrderCancelCPReq, + WSAPISpotOrderCancelIdsReq, + WSAPISpotOrderCancelIdsRespItem, + WSAPISpotOrderCancelReq, + WSAPISpotOrderListReq, + WSAPISpotOrderPlaceReq, + WSAPISpotOrderStatusReq, + WSAPIWsKey, +} from './types/websockets/wsAPI.js'; +import { WebsocketClient } from './WebsocketClient.js'; ⋮---- /** - * Returns a list of string events that can be individually sent upstream to complete subscribing/unsubscribing/etc to these topics - */ -protected abstract getWsOperationEventsForTopics( - topics: WsTopicRequest[], - wsKey: TWSKey, - operation: WsOperation, - ): Promise; -⋮---- -/** - * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) + * 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(....)`. */ -protected abstract resolveEmittableEvents( - wsKey: TWSKey, - event: MessageEventLike, - ): EmittableEvent[]; + attachEventListeners: boolean; +} ⋮---- /** - * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library + * 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(....)`. */ -protected abstract connectAll(): Promise[]; -⋮---- -protected isPrivateWsKey(wsKey: TWSKey): boolean -⋮---- -/** Returns auto-incrementing request ID, used to track promise references for async requests */ -protected getNewRequestId(): string ⋮---- -protected abstract sendWSAPIRequest( - wsKey: TWSKey, - channel: string, - params?: any, - ): Promise; +/** + * This is a minimal Websocket API wrapper around the WebsocketClient. + * + * Some methods support passing in a custom "wsKey". This is a reference to which WS connection should + * be used to transmit that message. This is only useful if you wish to use an alternative wss + * domain that is supported by the SDK. + * + * Note: To use testnet, don't set the wsKey - use `testnet: true` in + * the constructor instead. + * + * 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/gateio-api/blob/master/examples/ws-private-spot-wsapi.ts#L119 + */ +export class WebsocketAPIClient ⋮---- -protected abstract sendWSAPIRequest( - wsKey: TWSKey, - channel: string, - params: any, - ): Promise; +constructor( + options?: WSClientConfigurableOptions & + Partial, + logger?: DefaultLogger, +) ⋮---- -public getTimeOffsetMs() +public getWSClient(): WebsocketClient ⋮---- -// TODO: not implemented -public setTimeOffsetMs(newOffset: number) +public setTimeOffsetMs(newOffset: number): void ⋮---- -/** - * Don't call directly! Use subscribe() instead! - * - * Subscribe to one or more topics on a WS connection (identified by WS Key). +/* * - * - Topics are automatically cached - * - Connections are automatically opened, if not yet connected - * - Authentication is automatically handled - * - Topics are automatically resubscribed to, if something happens to the connection, unless you call unsubsribeTopicsForWsKey(topics, key). + * SPOT - Trading requests * - * @param wsRequests array of topics to subscribe to - * @param wsKey ws key referring to the ws connection these topics should be subscribed on */ -protected subscribeTopicsForWsKey( - wsTopicRequests: WsTopicRequestOrStringTopic[], - wsKey: TWSKey, -) -⋮---- -// Store topics, so future automation (post-auth, post-reconnect) has everything needed to resubscribe automatically -⋮---- -// start connection process if it hasn't yet begun. Topics are automatically subscribed to on-connect -⋮---- -// Subscribe should happen automatically once connected, nothing to do here after topics are added to wsStore. ⋮---- /** - * Are we in the process of connection? Nothing to send yet. - */ -⋮---- -// We're connected. Check if auth is needed and if already authenticated + * Submit a spot order + */ +submitNewSpotOrder( + params: WSAPISpotOrderPlaceReq, + wsKey?: WSAPIWsKey, +): Promise> ⋮---- /** - * If not authenticated yet and auth is required, don't request topics yet. - * - * Auth should already automatically be in progress, so no action needed from here. Topics will automatically subscribe post-auth success. - */ -⋮---- -// Finally, request subscription to topics if the connection is healthy and ready -⋮---- -protected unsubscribeTopicsForWsKey( - wsTopicRequests: WsTopicRequestOrStringTopic[], - wsKey: TWSKey, -) -⋮---- -// Store topics, so future automation (post-auth, post-reconnect) has everything needed to resubscribe automatically -⋮---- -// If not connected, don't need to do anything. -// Removing the topic from the store is enough to stop it from being resubscribed to on reconnect. -⋮---- -// We're connected. Check if auth is needed and if already authenticated + * Cancel a spot order + */ +cancelSpotOrder( + params: WSAPISpotOrderCancelReq, + wsKey?: WSAPIWsKey, +): Promise> ⋮---- /** - * If not authenticated yet and auth is required, don't need to do anything. - * We don't subscribe to topics until auth is complete anyway. - */ -⋮---- -// Finally, request subscription to topics if the connection is healthy and ready + * Cancel all spot orders with the given id list + */ +cancelSpotOrderById( + params: WSAPISpotOrderCancelIdsReq[], + wsKey?: WSAPIWsKey, +): Promise> ⋮---- /** - * Splits topic requests into two groups, public & private topic requests + * Cancel a spot order for a given symbol */ -private sortTopicRequestsIntoPublicPrivate( - wsTopicRequests: WsTopicRequest[], - wsKey: TWSKey, -): -⋮---- -/** Get the WsStore that tracks websockets & topics */ -public getWsStore(): WsStore> -⋮---- -public close(wsKey: TWSKey, force?: boolean) -⋮---- -public closeAll(force?: boolean) -⋮---- -public isConnected(wsKey: TWSKey): boolean +cancelSpotOrderForSymbol( + params: WSAPISpotOrderCancelCPReq, + wsKey?: WSAPIWsKey, +): Promise> ⋮---- /** - * Request connection to a specific websocket, instead of waiting for automatic connection. + * Update a spot order */ -protected async connect( - wsKey: TWSKey, -): Promise -⋮---- -private connectToWsUrl(url: string, wsKey: TWSKey): WebSocket -⋮---- -private parseWsError(context: string, error: any, wsKey: TWSKey) -⋮---- -/** Get a signature, build the auth request and send it */ -private async sendAuthRequest(wsKey: TWSKey): Promise -⋮---- -// console.log('ws auth req', request); -⋮---- -private reconnectWithDelay(wsKey: TWSKey, connectionDelayMs: number) -⋮---- -private ping(wsKey: TWSKey) -⋮---- -private clearTimers(wsKey: TWSKey) -⋮---- -// Send a ping at intervals -private clearPingTimer(wsKey: TWSKey) +updateSpotOrder( + params: WSAPISpotOrderAmendReq, + wsKey?: WSAPIWsKey, +): Promise> ⋮---- -// Expect a pong within a time limit -private clearPongTimer(wsKey: TWSKey) +/** + * Get the status of a spot order + */ +getSpotOrderStatus( + params: WSAPISpotOrderStatusReq, + wsKey?: WSAPIWsKey, +): Promise> ⋮---- -// this.logger.trace(`Cleared pong timeout for "${wsKey}"`); +/** + * Get all spot orders + */ +getSpotOrders( + params: WSAPISpotOrderListReq, + wsKey?: WSAPIWsKey, +): Promise> ⋮---- -// this.logger.trace(`No active pong timer for "${wsKey}"`); +/* + * + * Futures - Trading requests + * + */ ⋮---- /** - * Simply builds and sends subscribe events for a list of topics for a ws key + * Submit a futures order. * - * @private Use the `subscribe(topics)` or `subscribeTopicsForWsKey(topics, wsKey)` method to subscribe to topics. Send WS message to subscribe to topics. + * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection */ -private async requestSubscribeTopics( - wsKey: TWSKey, - topics: WsTopicRequest[], -) -⋮---- -// Automatically splits requests into smaller batches, if needed -⋮---- -`Subscribing to ${topics.length} "${wsKey}" topics in ${subscribeWsMessages.length} batches.`, // Events: "${JSON.stringify(topics)}" -⋮---- -// console.log(`batches: `, JSON.stringify(subscribeWsMessages, null, 2)); -⋮---- -// this.logger.trace(`Sending batch via message: "${wsMessage}"`); +submitNewFuturesOrder( + params: WSAPIFuturesOrderPlaceReq, + wsKey?: WSAPIWsKey, +): Promise> ⋮---- /** - * Simply builds and sends unsubscribe events for a list of topics for a ws key + * Submit a batch of futures orders * - * @private Use the `unsubscribe(topics)` method to unsubscribe from topics. Send WS message to unsubscribe from topics. + * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection */ -private async requestUnsubscribeTopics( - wsKey: TWSKey, - wsTopicRequests: WsTopicRequest[], -) +submitNewFuturesBatchOrder( + params: WSAPIFuturesOrderPlaceReq[], + wsKey?: WSAPIWsKey, +): Promise> ⋮---- /** - * Try sending a string event on a WS connection (identified by the WS Key) + * Cancel a futures order + * + * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection */ -public tryWsSend( - wsKey: TWSKey, - wsMessage: string, - throwExceptions?: boolean, -) -⋮---- -private async onWsOpen( - event: any, - wsKey: TWSKey, - url: string, - ws: WebSocket, -) -⋮---- -// Resolve & cleanup deferred "connection attempt in progress" promise -⋮---- -// eslint-disable-next-line @typescript-eslint/no-unused-vars -⋮---- -// Remove before resolving, in case there's more requests queued -⋮---- -// Some websockets require an auth packet to be sent after opening the connection -⋮---- -// Reconnect to topics known before it connected -⋮---- -// Request sub to public topics, if any -⋮---- -// Request sub to private topics, if auth on connect isn't needed -⋮---- -// If enabled, automatically reauth WS API if reconnected -⋮---- -// eslint-disable-next-line @typescript-eslint/no-unused-vars +cancelFuturesOrder( + params: WSAPIFuturesOrderCancelReq, + wsKey?: WSAPIWsKey, +): Promise> ⋮---- /** - * Handle subscription to private topics _after_ authentication successfully completes asynchronously. + * Cancel futures orders by id list * - * Only used for exchanges that require auth before sending private topic subscription requests + * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection */ -private onWsAuthenticated( - wsKey: TWSKey, - event: { isWSAPI?: boolean; WSAPIAuthChannel?: string }, -) -⋮---- -// Resolve & cleanup deferred "auth attempt in progress" promise -⋮---- -// Remove before continuing, in case there's more requests queued -⋮---- -private onWsMessage(event: unknown, wsKey: TWSKey, ws: WebSocket) -⋮---- -// any message can clear the pong timer - wouldn't get a message if the ws wasn't working -⋮---- -// console.log(`raw event: `, { data, dataType, emittableEvents }); -⋮---- -private onWsClose(event: unknown, wsKey: TWSKey) -⋮---- -// unintentional close, attempt recovery -⋮---- -// clean up any pending promises for this connection -⋮---- -// intentional close - clean up -// clean up any pending promises for this connection -⋮---- -// clean up any pending promises for this connection -⋮---- -// This was an intentional close, delete all state for this connection, as if it never existed: -⋮---- -private getWs(wsKey: TWSKey) +cancelFuturesOrderById( + params: string[], + wsKey?: WSAPIWsKey, +): Promise> ⋮---- -private setWsState(wsKey: TWSKey, state: WsConnectionStateEnum) +/** + * Cancel all open futures orders + * + * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection + */ +cancelFuturesAllOpenOrders( + params: WSAPIFuturesOrderCancelCPReq, + wsKey?: WSAPIWsKey, +): Promise> ⋮---- /** - * Promise-driven method to assert that a ws has successfully connected (will await until connection is open) + * Update a futures order + * + * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection */ -protected async assertIsConnected(wsKey: TWSKey): Promise +updateFuturesOrder( + params: WSAPIFuturesOrderAmendReq, + wsKey?: WSAPIWsKey, +): Promise> ⋮---- -// Already in progress? Await shared promise and retry +/** + * Get all futures orders + * + * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection + */ +getFuturesOrders( + params: WSAPIFuturesOrderListReq, + wsKey?: WSAPIWsKey, +): Promise> ⋮---- -// Start connection, it should automatically store/return a promise. +/** + * Get futures order status + * + * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection + */ +getFuturesOrderStatus( + params: WSAPIFuturesOrderStatusReq, + wsKey?: WSAPIWsKey, +): Promise> ⋮---- /** - * Promise-driven method to assert that a ws has been successfully authenticated (will await until auth is confirmed) + * + * + * + * + * + * + * + * Private methods for handling some of the convenience/automation provided by the WS API Client + * + * + * + * + * + * + * */ -public async assertIsAuthenticated(wsKey: TWSKey): Promise ⋮---- -// Already in progress? Await shared promise and retry +private setupDefaultEventListeners() ⋮---- -// this.logger.trace('assertIsAuthenticated(): ok'); +/** + * General event handlers for monitoring the WebsocketClient + */ ⋮---- -// Start authentication, it should automatically store/return a promise. +// Blind JSON.stringify can fail on circular references +⋮---- +// JSON.stringify({ ...data, target: 'WebSocket' }), ================ -File: src/types/request/alpha.ts +File: .nvmrc ================ -/**========================================================================================================================== - * ALPHA - * ========================================================================================================================== - */ -⋮---- -export interface GetAlphaAccountBookReq { - from: number; // Start timestamp for the query - to?: number; // End timestamp for the query, defaults to current time if not specified - page?: number; // Page number - limit?: number; // Maximum 100 items per page -} -⋮---- -from: number; // Start timestamp for the query -to?: number; // End timestamp for the query, defaults to current time if not specified -page?: number; // Page number -limit?: number; // Maximum 100 items per page -⋮---- -export interface CreateAlphaQuoteReq { - currency: string; // Trading symbol - side: 'buy' | 'sell'; // Buy or sell orders - amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) - gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) - slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom -} -⋮---- -currency: string; // Trading symbol -side: 'buy' | 'sell'; // Buy or sell orders -amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) -gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) -slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom -⋮---- -export interface CreateAlphaOrderReq { - currency: string; // Trading symbol - side: 'buy' | 'sell'; // Buy or sell orders - amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) - gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) - slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom - quote_id: string; // Quote ID returned from quotation API -} -⋮---- -currency: string; // Trading symbol -side: 'buy' | 'sell'; // Buy or sell orders -amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) -gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) -slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom -quote_id: string; // Quote ID returned from quotation API -⋮---- -export interface GetAlphaOrdersReq { - currency?: string; // Trading symbol - side?: 'buy' | 'sell'; // Buy or sell orders - status?: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) - from?: number; // Start time for order query - to?: number; // End time for order query, defaults to current time if not specified - limit?: number; // Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 - page?: number; // Page number -} -⋮---- -currency?: string; // Trading symbol -side?: 'buy' | 'sell'; // Buy or sell orders -status?: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) -from?: number; // Start time for order query -to?: number; // End time for order query, defaults to current time if not specified -limit?: number; // Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 -page?: number; // Page number -⋮---- -export interface GetAlphaOrderReq { - order_id: string; // Order ID -} -⋮---- -order_id: string; // Order ID -⋮---- -export interface GetAlphaCurrenciesReq { - currency?: string; // Query currency information by currency symbol - limit?: number; // Maximum number of records returned in a single list - page?: number; // Page number -} -⋮---- -currency?: string; // Query currency information by currency symbol -limit?: number; // Maximum number of records returned in a single list -page?: number; // Page number -⋮---- -export interface GetAlphaTickersReq { - currency?: string; // Query by specified currency name - limit?: number; // Maximum number of records returned in a single list - page?: number; // Page number -} -⋮---- -currency?: string; // Query by specified currency name -limit?: number; // Maximum number of records returned in a single list -page?: number; // Page number +v24.18.0 ================ -File: src/types/request/autoinvest.ts +File: docs/GATE_SDK_QUICKSTART_GUIDE.md ================ -/**========================================================================================================================== - * EARN AUTO INVEST - * ========================================================================================================================== - */ -⋮---- -export interface AutoInvestPlanPortfolioItemInput { - asset: string; - ratio: string; -} -⋮---- -/** POST /earn/autoinvest/plans/create */ -export interface CreateAutoInvestPlanReq { - plan_name?: string; - plan_des?: string; - plan_money: string; - plan_amount: string; - plan_period_type: - | 'daily' - | 'weekly' - | 'biweekly' - | 'monthly' - | 'hourly' - | '4-hourly'; - plan_period_day: number; - plan_period_hour: number; - items: AutoInvestPlanPortfolioItemInput[]; - /** Fund source: `spot` or `earn`; default spot */ - fund_source?: string; - /** Fund flow: `auto_invest` or `earn`; default auto_invest */ - fund_flow?: string; - /** 0 normal creation, 1 quick investment */ - type?: number; -} -⋮---- -/** Fund source: `spot` or `earn`; default spot */ -⋮---- -/** Fund flow: `auto_invest` or `earn`; default auto_invest */ -⋮---- -/** 0 normal creation, 1 quick investment */ -⋮---- + + +# Gate API JavaScript Tutorial for Node.js + + + +> [!TIP] +> Read this guide in tutorial format on the Siebly website: [Gate JavaScript REST API and WebSocket Tutorial](https://siebly.io/sdk/gate/javascript/tutorial) + + + +This tutorial uses [`gateio-api`](https://www.npmjs.com/package/gateio-api), Siebly's Node.js, JavaScript, and TypeScript SDK for Gate.com. It covers public and private REST API calls, Spot and Futures TestNet orders, live WebSocket streams, WebSocket API commands, API hosts, and proxies. + +The SDK handles REST API request signing, private WebSocket authentication, product-specific WebSocket routing, heartbeats, reconnects, resubscriptions, and WebSocket API response matching. Request and response types are included for TypeScript users. + +**Key links** + +- Gate JavaScript SDK by Siebly: [`gateio-api`](https://siebly.io/sdk/gate/javascript) +- npm package: [`gateio-api`](https://www.npmjs.com/package/gateio-api) +- GitHub repository: [`tiagosiebler/gateio-api`](https://github.com/tiagosiebler/gateio-api) +- SDK examples: [Gate SDK examples](https://siebly.io/examples/Gate) +- SDK endpoint map: [Gate JavaScript endpoint reference](./endpointFunctionList.md) +- Gate REST API documentation: [Gate API v4](https://www.gate.com/docs/developers/apiv4/en/) +- Gate Spot WebSocket documentation: [Spot WebSocket API](https://www.gate.com/docs/developers/apiv4/ws/) +- Gate Futures WebSocket documentation: [Futures WebSocket API](https://www.gate.com/docs/developers/futures/ws/) +- Trading-system terms: [Siebly glossary](https://siebly.io/reference/glossary) +- More JavaScript and TypeScript SDKs: [Siebly.io](https://siebly.io) + +## Why use `gateio-api`? + +The JavaScript SDK handles all the complexities of integrating with Gate's REST APIs & WebSockets, so you can focus on your system without wasting excessive time on plumbing. + +Private Gate REST API requests require a timestamp and HMAC-SHA512 signature. Private WebSocket subscriptions require authentication, and each product family has its own WebSocket connection. A Spot subscription cannot be sent through a USDT perpetual Futures connection. + +`gateio-api` handles those mechanics and gives each job a focused client: + +| Client | Use it for | +| -------------------- | ------------------------------------------------------------ | +| `RestClient` | Public and private REST API calls across Gate product groups | +| `WebsocketClient` | Public and private WebSocket subscriptions | +| `WebsocketAPIClient` | Promise-based Spot and Futures order commands over WebSocket | + +`WebsocketClient` also handles heartbeats, reconnects, cached subscriptions, and resubscription. `WebsocketAPIClient` adds login, request IDs, response matching, and promise resolution. + +## Install the SDK + +```bash +npm install gateio-api +``` + +The package includes CommonJS, ESM, and TypeScript declarations. Every example below is plain JavaScript using ESM imports. + +## Create Gate API keys + +Public market data does not require credentials. Private REST API calls, private streams, and WebSocket API commands require an API key and secret. + +Create and manage keys from the [Gate API key page](https://www.gate.com/myaccount/api_key_manage). Start with the least access your application needs: + +- Use a read-only key while building account views and recovery code. +- Enable Spot read-write access only for Spot order workflows. +- Enable perpetual-contract read-write access only for Futures order workflows. +- Add an IP whitelist when your outbound IP is stable. +- Keep live and TestNet credentials separate. +- Allow a few minutes for API key and permission changes to take effect. +- Do not enable withdrawal permission for anything in this tutorial. + +Set these live credential names in your shell, secret manager, or deployment environment: + +- `GATE_API_KEY` +- `GATE_API_SECRET` + +Use separate names for TestNet: + +- `GATE_TESTNET_API_KEY` +- `GATE_TESTNET_API_SECRET` +- `GATE_PLACE_TESTNET_ORDER=true` + +The order examples check `GATE_PLACE_TESTNET_ORDER` before sending an order. Do not log API keys or secrets, and never put them in browser code. + +## Gate products and request vocabulary + +Several short fields determine where a request goes and what its values mean: + +| Field | Example | Meaning | +| --------------- | ------------------------------ | -------------------------------------------------------------------------------------------------- | +| `currency_pair` | `BTC_USDT` | A Spot or margin market | +| `account` | `spot` | The account used by a Spot order or query | +| `settle` | `usdt` | The settlement currency for a Futures or Delivery REST API request | +| `contract` | `BTC_USDT` | The exact Futures, Delivery, or Options contract | +| `size` | `1` or `-1` | Futures contract count, not a BTC or USDT amount | +| `text` | `t-my-order-123` | Your [custom order ID](https://siebly.io/reference/glossary#custom-order-id) | +| `wsKey` | `WS_KEY_MAP.perpFuturesUSDTV4` | The [WebSocket key](https://siebly.io/reference/glossary#ws-key) that selects a product connection | + +For Spot orders, `account` can be `spot`, `margin`, `cross_margin`, or `unified`, depending on the account and endpoint. This tutorial uses `spot`. + +For USDT perpetual Futures, use `settle: 'usdt'` and a contract such as `BTC_USDT`. The `size` is a number of contracts. In one-way mode, a positive size buys and a negative size sells. The contract's `quanto_multiplier` tells you how much underlying currency one contract represents. + +Keep these routing values visible in code and logs. They are part of the request, not interchangeable labels. + + + +## Start building: first calls and streams + +Run each example on its own. Start with public data, then add authenticated account state and live streams. + +### 1. Make public REST API calls + +Public calls need no API key. Gate response bodies are endpoint-specific: server time and order books are objects, tickers are arrays, and candles are tuple arrays. + + + +```javascript +import { RestClient } from 'gateio-api'; + +const client = new RestClient(); + +async function main() { + try { + const time = await client.getServerTime(); + console.log('Server time:', time.server_time); + } catch (error) { + console.error('Server time request failed:', error); + } + + try { + const pair = await client.getSpotCurrencyPair({ + currency_pair: 'BTC_USDT', + }); + console.log('BTC_USDT metadata:', pair); + } catch (error) { + console.error('Currency pair request failed:', error); + } + + try { + const tickers = await client.getSpotTicker({ + currency_pair: 'BTC_USDT', + }); + console.log('BTC_USDT ticker:', tickers[0]); + } catch (error) { + console.error('Ticker request failed:', error); + } + + try { + const orderBook = await client.getSpotOrderBook({ + currency_pair: 'BTC_USDT', + limit: 5, + }); + console.log('Best bid:', orderBook.bids[0]); + console.log('Best ask:', orderBook.asks[0]); + } catch (error) { + console.error('Order book request failed:', error); + } + + try { + const candles = await client.getSpotCandles({ + currency_pair: 'BTC_USDT', + interval: '1h', + limit: 10, + }); + console.log('Latest candle:', candles[0]); + } catch (error) { + console.error('Candles request failed:', error); + } +} + +main(); +``` + +The SDK returns the endpoint body directly. There is no shared result wrapper to unwrap. + +Each Spot candle is a tuple: + +```text +[ + timestamp, + quoteVolume, + close, + high, + low, + open, + baseVolume, + closed +] +``` + +Use the [SDK endpoint map](./endpointFunctionList.md) or the official endpoint documentation when reading tuple positions and endpoint-specific objects. + +### 2. Make private REST API calls + +Private calls use the same `RestClient`. Add your key and secret, then call private methods normally. The SDK adds the required timestamp and signature. + + + +```javascript +import { RestClient } from 'gateio-api'; + +const client = new RestClient({ + apiKey: process.env.GATE_API_KEY, + apiSecret: process.env.GATE_API_SECRET, +}); + +async function main() { + try { + const balances = await client.getSpotAccounts(); + console.log('Spot balances:', balances); + } catch (error) { + console.error('Balance request failed:', error); + } + + try { + const openOrders = await client.getSpotOpenOrders({ + account: 'spot', + }); + console.log('Open Spot orders grouped by pair:', openOrders); + } catch (error) { + console.error('Open-order request failed:', error); + } + + try { + const recentOrders = await client.getSpotOrders({ + currency_pair: 'BTC_USDT', + status: 'finished', + account: 'spot', + limit: 20, + }); + console.log('Recent BTC_USDT orders:', recentOrders); + } catch (error) { + console.error('Order-history request failed:', error); + } + + try { + const trades = await client.getSpotTradingHistory({ + currency_pair: 'BTC_USDT', + account: 'spot', + limit: 20, + }); + console.log('Recent BTC_USDT trades:', trades); + } catch (error) { + console.error('Trade-history request failed:', error); + } +} + +main(); +``` + +`getSpotAccounts()`, `getSpotOrders()`, and `getSpotTradingHistory()` return arrays. `getSpotOpenOrders()` returns an array whose entries group open orders by currency pair. Other private endpoints return objects or different array shapes, so check the [SDK endpoint map](./endpointFunctionList.md) instead of assuming a common format. + +### 3. Subscribe to public WebSocket streams + +Every subscription includes both a topic and an explicit `wsKey`. The key tells the SDK which Gate connection should carry the subscription. + + + +```javascript +import { WebsocketClient, WS_KEY_MAP } from 'gateio-api'; + +const ws = new WebsocketClient(); + +ws.on('response', (response) => { + console.log('Subscription response:', response); +}); + +ws.on('update', (update) => { + console.log('WebSocket update:', update); +}); + +ws.on('reconnect', ({ wsKey }) => { + console.log('Reconnecting:', wsKey); +}); + +ws.on('reconnected', (event) => { + console.log('Reconnected:', event.wsKey); +}); + +ws.on('exception', (error) => { + console.error('WebSocket exception:', error); +}); + +try { + ws.subscribe( + { + topic: 'spot.tickers', + payload: ['BTC_USDT'], + }, + WS_KEY_MAP.spotV4, + ); +} catch (error) { + console.error('Spot subscription failed:', error); +} + +try { + ws.subscribe( + { + topic: 'futures.tickers', + payload: ['BTC_USDT'], + }, + WS_KEY_MAP.perpFuturesUSDTV4, + ); +} catch (error) { + console.error('Futures subscription failed:', error); +} + +process.once('SIGINT', () => { + ws.closeAll(); +}); +``` + +Gate sends Spot ticker data as an object in `result`, while a Futures ticker update can contain an array. The SDK adds `wsKey` to each update so one event handler can identify the source connection. + +The main WebSocket events are: + +| Event | Meaning | +| --------------- | ------------------------------------------------------------- | +| `open` | A connection opened for the reported `wsKey` | +| `response` | Subscription, unsubscription, or request response | +| `update` | Market or account data | +| `authenticated` | A private connection authenticated successfully | +| `reconnect` | The connection dropped and a reconnect is starting | +| `reconnected` | The connection is open and cached subscriptions were restored | +| `close` | A connection closed for the reported `wsKey` | +| `exception` | The client or connection reported an error | + +A successful `response` event confirms the [subscription acknowledgement](https://siebly.io/reference/glossary#subscription-acknowledgement). It does not mean that a market update has arrived yet. + +### 4. Subscribe to private Spot streams + +Private streams use the same client with credentials. This example follows Spot balances, orders, and user trades. + + + +```javascript +import { WebsocketClient, WS_KEY_MAP } from 'gateio-api'; + +const ws = new WebsocketClient({ + apiKey: process.env.GATE_API_KEY, + apiSecret: process.env.GATE_API_SECRET, +}); + +ws.on('authenticated', ({ wsKey }) => { + console.log('Authenticated:', wsKey); +}); + +ws.on('response', (response) => { + console.log('Subscription response:', response); +}); + +ws.on('update', (update) => { + console.log('Private Spot update:', update); +}); + +ws.on('reconnected', (event) => { + console.log('Reconnected:', event.wsKey); +}); + +ws.on('exception', (error) => { + console.error('WebSocket exception:', error); +}); + +try { + ws.subscribe( + { + topic: 'spot.balances', + }, + WS_KEY_MAP.spotV4, + ); +} catch (error) { + console.error('Balance subscription failed:', error); +} + +try { + ws.subscribe( + { + topic: 'spot.orders', + payload: ['BTC_USDT'], + }, + WS_KEY_MAP.spotV4, + ); +} catch (error) { + console.error('Order subscription failed:', error); +} + +try { + ws.subscribe( + { + topic: 'spot.usertrades', + payload: ['BTC_USDT'], + }, + WS_KEY_MAP.spotV4, + ); +} catch (error) { + console.error('Trade subscription failed:', error); +} + +process.once('SIGINT', () => { + ws.closeAll(); +}); +``` + +Use the `authenticated` event as a connection-level signal. Use private updates as [private stream confirmation](https://siebly.io/reference/glossary#private-stream-confirmation) of account and order changes. + +Other private Spot topics include `spot.margin_balances` and `spot.cross_balances`. Check each channel's payload rules before subscribing. + +### 5. Subscribe to private Futures streams + +Futures private channels use your Gate user ID. Contract-specific channels also include the contract. Retrieve the user ID once from the REST API, then use the payload required by each channel. + +```javascript +import { RestClient, WebsocketClient, WS_KEY_MAP } from 'gateio-api'; + +const rest = new RestClient({ + apiKey: process.env.GATE_API_KEY, + apiSecret: process.env.GATE_API_SECRET, +}); + +const ws = new WebsocketClient({ + apiKey: process.env.GATE_API_KEY, + apiSecret: process.env.GATE_API_SECRET, +}); + +ws.on('authenticated', ({ wsKey }) => { + console.log('Authenticated:', wsKey); +}); + +ws.on('response', (response) => { + console.log('Subscription response:', response); +}); + +ws.on('update', (update) => { + console.log('Private Futures update:', update); +}); + +ws.on('exception', (error) => { + console.error('WebSocket exception:', error); +}); + +async function main() { + let account; + + try { + account = await rest.getAccountDetail(); + console.log('Gate user ID:', account.user_id); + } catch (error) { + console.error('Account detail request failed:', error); + return; + } + + const userId = String(account.user_id); + const payload = [userId, 'BTC_USDT']; + const wsKey = WS_KEY_MAP.perpFuturesUSDTV4; + + try { + ws.subscribe( + { + topic: 'futures.orders', + payload, + }, + wsKey, + ); + } catch (error) { + console.error('Order subscription failed:', error); + } + + try { + ws.subscribe( + { + topic: 'futures.usertrades', + payload, + }, + wsKey, + ); + } catch (error) { + console.error('Trade subscription failed:', error); + } + + try { + ws.subscribe( + { + topic: 'futures.balances', + payload: [userId], + }, + wsKey, + ); + } catch (error) { + console.error('Balance subscription failed:', error); + } + + try { + ws.subscribe( + { + topic: 'futures.positions', + payload, + }, + wsKey, + ); + } catch (error) { + console.error('Position subscription failed:', error); + } +} + +process.once('SIGINT', () => { + ws.closeAll(); +}); + +main(); +``` + +Keep the `wsKey` aligned with the settlement currency and product. USDT perpetual Futures use `WS_KEY_MAP.perpFuturesUSDTV4`; BTC perpetual Futures use `WS_KEY_MAP.perpFuturesBTCV4`. + +Gate also provides private Futures channels such as `futures.autoorders`. Use the payload documented for that specific channel. + +### 6. Place and cancel a Spot order in TestNet + +Gate TestNet uses separate credentials and API hosts. This example: + +1. Checks the explicit order opt-in. +2. Loads current `BTC_USDT` trading rules and the order book. +3. Calculates an amount that meets the pair's base and quote minimums. +4. Places a post-only limit buy at the current best bid. +5. Queries the order and cancels it if it remains open. + +The order uses `time_in_force: 'poc'`, Gate's post-only setting. A fast market can move before the request arrives, in which case Gate can reject or finish the order instead of leaving it on the book. + + + +```javascript +import { RestClient } from 'gateio-api'; + +const client = new RestClient({ + apiKey: process.env.GATE_TESTNET_API_KEY, + apiSecret: process.env.GATE_TESTNET_API_SECRET, + baseUrl: 'https://api-testnet.gateapi.io/api/v4', +}); + +async function main() { + if (process.env.GATE_PLACE_TESTNET_ORDER !== 'true') { + console.error('Set GATE_PLACE_TESTNET_ORDER=true to run this example.'); + return; + } + + if ( + !process.env.GATE_TESTNET_API_KEY || + !process.env.GATE_TESTNET_API_SECRET + ) { + console.error('Set GATE_TESTNET_API_KEY and GATE_TESTNET_API_SECRET.'); + return; + } + + let pair; + + try { + pair = await client.getSpotCurrencyPair({ + currency_pair: 'BTC_USDT', + }); + } catch (error) { + console.error('Currency pair request failed:', error); + return; + } + + let orderBook; + + try { + orderBook = await client.getSpotOrderBook({ + currency_pair: 'BTC_USDT', + limit: 5, + }); + } catch (error) { + console.error('Order book request failed:', error); + return; + } + + if (pair.trade_status !== 'tradable' && pair.trade_status !== 'buyable') { + console.error('BTC_USDT is not currently buyable.'); + return; + } + + const price = orderBook.bids[0]?.[0]; + const amountPrecision = pair.amount_precision; + const minBase = Number(pair.min_base_amount); + const minQuote = Number(pair.min_quote_amount); + const priceNumber = Number(price); + + if ( + !price || + amountPrecision === undefined || + !Number.isFinite(minBase) || + !Number.isFinite(minQuote) || + !Number.isFinite(priceNumber) || + priceNumber <= 0 + ) { + console.error('Required market metadata is unavailable.'); + return; + } + + const amountStep = 10 ** -amountPrecision; + const minimumAmount = Math.max(minBase, minQuote / priceNumber); + const amountNumber = (Math.ceil(minimumAmount / amountStep) + 1) * amountStep; + const amount = amountNumber.toFixed(amountPrecision); + + if (amountNumber < minBase || amountNumber * priceNumber < minQuote) { + console.error('Could not derive a valid TestNet order.'); + return; + } + + const maxBase = Number(pair.max_base_amount); + const maxQuote = Number(pair.max_quote_amount); + + if ( + (Number.isFinite(maxBase) && amountNumber > maxBase) || + (Number.isFinite(maxQuote) && amountNumber * priceNumber > maxQuote) + ) { + console.error('Derived amount exceeds the pair limits.'); + return; + } + + const text = `t-siebly${Date.now().toString().slice(-12)}`; + let placedOrder; + + try { + placedOrder = await client.submitSpotOrder({ + currency_pair: 'BTC_USDT', + account: 'spot', + side: 'buy', + type: 'limit', + amount, + price, + time_in_force: 'poc', + text, + }); + console.log('Placed Spot order:', placedOrder); + } catch (error) { + console.error('Spot order placement failed:', error); + return; + } + + if (!placedOrder.id) { + console.error('Gate did not return an order ID.'); + return; + } + + let currentOrder; + + try { + currentOrder = await client.getSpotOrder({ + order_id: placedOrder.id, + currency_pair: 'BTC_USDT', + account: 'spot', + }); + console.log('Current Spot order:', currentOrder); + } catch (error) { + console.error('Spot order query failed:', error); + } + + if (currentOrder && currentOrder.status !== 'open') { + console.log('Order is no longer open:', currentOrder.status); + return; + } + + try { + const cancelledOrder = await client.cancelSpotOrder({ + order_id: placedOrder.id, + currency_pair: 'BTC_USDT', + account: 'spot', + }); + console.log('Cancelled Spot order:', cancelledOrder); + } catch (error) { + console.error('Spot order cancellation failed:', error); + } +} + +main(); +``` + +The extra amount increment avoids falling just below the quote minimum after decimal rounding. Before using another pair, read its `amount_precision`, `precision`, minimums, maximums, and `trade_status`. + +### 7. Place and cancel a USDT perpetual order in TestNet + +A Futures `size` is a contract count. It is not an amount of BTC or USDT. This example reads the contract's minimum size and current price, and it only runs when the account is in one-way mode. It does not change account or position settings. + + + +```javascript +import { RestClient } from 'gateio-api'; + +const client = new RestClient({ + apiKey: process.env.GATE_TESTNET_API_KEY, + apiSecret: process.env.GATE_TESTNET_API_SECRET, + baseUrl: 'https://api-testnet.gateapi.io/api/v4', +}); + +async function main() { + if (process.env.GATE_PLACE_TESTNET_ORDER !== 'true') { + console.error('Set GATE_PLACE_TESTNET_ORDER=true to run this example.'); + return; + } + + if ( + !process.env.GATE_TESTNET_API_KEY || + !process.env.GATE_TESTNET_API_SECRET + ) { + console.error('Set GATE_TESTNET_API_KEY and GATE_TESTNET_API_SECRET.'); + return; + } + + let contract; + + try { + contract = await client.getFuturesContract({ + settle: 'usdt', + contract: 'BTC_USDT', + }); + } catch (error) { + console.error('Contract request failed:', error); + return; + } + + let orderBook; + + try { + orderBook = await client.getFuturesOrderBook({ + settle: 'usdt', + contract: 'BTC_USDT', + limit: 5, + }); + } catch (error) { + console.error('Order book request failed:', error); + return; + } + + let account; + + try { + account = await client.getFuturesAccount({ + settle: 'usdt', + }); + } catch (error) { + console.error('Futures account request failed:', error); + return; + } + + const oneWayMode = account.position_mode + ? account.position_mode === 'single' + : !account.in_dual_mode; + + if (!oneWayMode) { + console.error('This example requires one-way Futures position mode.'); + return; + } + + if (contract.status && contract.status !== 'trading') { + console.error('BTC_USDT Futures is not currently trading.'); + return; + } + + const price = orderBook.bids[0]?.p; + const size = Number(contract.order_size_min); + + if ( + !price || + !Number.isFinite(Number(price)) || + Number(price) <= 0 || + !Number.isFinite(size) || + size <= 0 || + (contract.enable_decimal === false && !Number.isInteger(size)) + ) { + console.error('Required contract metadata is unavailable.'); + return; + } + + console.log('One contract represents:', contract.quanto_multiplier, 'BTC'); + console.log('Price increment:', contract.order_price_round); + + const text = `t-siebly${Date.now().toString().slice(-12)}`; + let placedOrder; + + try { + placedOrder = await client.submitFuturesOrder({ + settle: 'usdt', + contract: 'BTC_USDT', + size, + price, + tif: 'poc', + text, + }); + console.log('Placed Futures order:', placedOrder); + } catch (error) { + console.error('Futures order placement failed:', error); + return; + } + + if (placedOrder.id === undefined) { + console.error('Gate did not return an order ID.'); + return; + } + + const orderId = String(placedOrder.id); + let currentOrder; + + try { + currentOrder = await client.getFuturesOrder({ + settle: 'usdt', + order_id: orderId, + }); + console.log('Current Futures order:', currentOrder); + } catch (error) { + console.error('Futures order query failed:', error); + } + + if (currentOrder && currentOrder.status !== 'open') { + console.log('Order is no longer open:', currentOrder.status); + return; + } + + try { + const cancelledOrder = await client.cancelFuturesOrder({ + settle: 'usdt', + order_id: orderId, + }); + console.log('Cancelled Futures order:', cancelledOrder); + } catch (error) { + console.error('Futures order cancellation failed:', error); + } +} + +main(); +``` + +In one-way mode, a positive `size` buys and a negative `size` sells. Dual-side mode uses different position semantics, so handle it in account-specific code after reading the [official Gate API v4 documentation](https://www.gate.com/docs/developers/apiv4/en/). + +The contract metadata supplies the size and price rules: + +- `order_size_min`: minimum contract count +- `order_price_round`: permitted price increment +- `quanto_multiplier`: underlying amount represented by one contract +- `enable_decimal`: whether fractional contract sizes are supported + +Do not derive a Futures order size from Spot precision rules. + +### 8. Send a Spot order through the WebSocket API + +`WebsocketAPIClient` turns Gate WebSocket API commands into promises. It connects and authenticates automatically on the first private command, adds a request ID, matches the response, and resolves the promise. + +This TestNet example uses the REST API only to read current market rules and the order book. The order, query, and cancellation use the WebSocket API. + + + +```javascript +import { RestClient, WebsocketAPIClient, WS_KEY_MAP } from 'gateio-api'; + +const rest = new RestClient({ + baseUrl: 'https://api-testnet.gateapi.io/api/v4', +}); + +const wsApi = new WebsocketAPIClient({ + apiKey: process.env.GATE_TESTNET_API_KEY, + apiSecret: process.env.GATE_TESTNET_API_SECRET, + wsUrl: 'wss://ws-testnet.gate.com/v4/ws/spot', +}); + +async function main() { + if (process.env.GATE_PLACE_TESTNET_ORDER !== 'true') { + console.error('Set GATE_PLACE_TESTNET_ORDER=true to run this example.'); + return; + } + + if ( + !process.env.GATE_TESTNET_API_KEY || + !process.env.GATE_TESTNET_API_SECRET + ) { + console.error('Set GATE_TESTNET_API_KEY and GATE_TESTNET_API_SECRET.'); + return; + } + + let pair; + + try { + pair = await rest.getSpotCurrencyPair({ + currency_pair: 'BTC_USDT', + }); + } catch (error) { + console.error('Currency pair request failed:', error); + return; + } + + let orderBook; + + try { + orderBook = await rest.getSpotOrderBook({ + currency_pair: 'BTC_USDT', + limit: 5, + }); + } catch (error) { + console.error('Order book request failed:', error); + return; + } + + if (pair.trade_status !== 'tradable' && pair.trade_status !== 'buyable') { + console.error('BTC_USDT is not currently buyable.'); + return; + } + + const price = orderBook.bids[0]?.[0]; + const amountPrecision = pair.amount_precision; + const minBase = Number(pair.min_base_amount); + const minQuote = Number(pair.min_quote_amount); + const priceNumber = Number(price); + + if ( + !price || + amountPrecision === undefined || + !Number.isFinite(minBase) || + !Number.isFinite(minQuote) || + !Number.isFinite(priceNumber) || + priceNumber <= 0 + ) { + console.error('Required market metadata is unavailable.'); + return; + } + + const amountStep = 10 ** -amountPrecision; + const minimumAmount = Math.max(minBase, minQuote / priceNumber); + const amountNumber = (Math.ceil(minimumAmount / amountStep) + 1) * amountStep; + const amount = amountNumber.toFixed(amountPrecision); + + if (amountNumber < minBase || amountNumber * priceNumber < minQuote) { + console.error('Could not derive a valid TestNet order.'); + return; + } + + const maxBase = Number(pair.max_base_amount); + const maxQuote = Number(pair.max_quote_amount); + + if ( + (Number.isFinite(maxBase) && amountNumber > maxBase) || + (Number.isFinite(maxQuote) && amountNumber * priceNumber > maxQuote) + ) { + console.error('Derived amount exceeds the pair limits.'); + return; + } + + const text = `t-siebly${Date.now().toString().slice(-12)}`; + const wsKey = WS_KEY_MAP.spotV4; + + try { + let placedResponse; + + try { + placedResponse = await wsApi.submitNewSpotOrder( + { + currency_pair: 'BTC_USDT', + account: 'spot', + side: 'buy', + type: 'limit', + amount, + price, + time_in_force: 'poc', + text, + }, + wsKey, + ); + console.log('Command status:', placedResponse.header.status); + console.log('Placed Spot order:', placedResponse.data.result); + } catch (error) { + console.error('Spot WebSocket API placement failed:', error); + return; + } + + const orderId = placedResponse.data.result.id; + let statusResponse; + + try { + statusResponse = await wsApi.getSpotOrderStatus( + { + order_id: orderId, + currency_pair: 'BTC_USDT', + account: 'spot', + }, + wsKey, + ); + console.log('Current Spot order:', statusResponse.data.result); + } catch (error) { + console.error('Spot WebSocket API query failed:', error); + } + + if (statusResponse && statusResponse.data.result.status !== 'open') { + console.log( + 'Order is no longer open:', + statusResponse.data.result.status, + ); + return; + } + + try { + const cancelledResponse = await wsApi.cancelSpotOrder( + { + order_id: orderId, + currency_pair: 'BTC_USDT', + account: 'spot', + }, + wsKey, + ); + console.log('Cancelled Spot order:', cancelledResponse.data.result); + } catch (error) { + console.error('Spot WebSocket API cancellation failed:', error); + } + } finally { + wsApi.getWSClient().closeAll(); + } +} + +main(); +``` + +### 9. Send a USDT perpetual order through the WebSocket API + +Futures WebSocket API commands use a product-specific WebSocket key. Pass it explicitly so the contract and connection remain clear. + + + +```javascript +import { RestClient, WebsocketAPIClient, WS_KEY_MAP } from 'gateio-api'; + +const rest = new RestClient({ + apiKey: process.env.GATE_TESTNET_API_KEY, + apiSecret: process.env.GATE_TESTNET_API_SECRET, + baseUrl: 'https://api-testnet.gateapi.io/api/v4', +}); + +const wsApi = new WebsocketAPIClient({ + apiKey: process.env.GATE_TESTNET_API_KEY, + apiSecret: process.env.GATE_TESTNET_API_SECRET, + wsUrl: 'wss://ws-testnet.gate.com/v4/ws/futures/usdt', +}); + +async function main() { + if (process.env.GATE_PLACE_TESTNET_ORDER !== 'true') { + console.error('Set GATE_PLACE_TESTNET_ORDER=true to run this example.'); + return; + } + + if ( + !process.env.GATE_TESTNET_API_KEY || + !process.env.GATE_TESTNET_API_SECRET + ) { + console.error('Set GATE_TESTNET_API_KEY and GATE_TESTNET_API_SECRET.'); + return; + } + + let contract; + + try { + contract = await rest.getFuturesContract({ + settle: 'usdt', + contract: 'BTC_USDT', + }); + } catch (error) { + console.error('Contract request failed:', error); + return; + } + + let orderBook; + + try { + orderBook = await rest.getFuturesOrderBook({ + settle: 'usdt', + contract: 'BTC_USDT', + limit: 5, + }); + } catch (error) { + console.error('Order book request failed:', error); + return; + } + + let account; + + try { + account = await rest.getFuturesAccount({ + settle: 'usdt', + }); + } catch (error) { + console.error('Futures account request failed:', error); + return; + } + + const oneWayMode = account.position_mode + ? account.position_mode === 'single' + : !account.in_dual_mode; + + if (!oneWayMode) { + console.error('This example requires one-way Futures position mode.'); + return; + } + + if (contract.status && contract.status !== 'trading') { + console.error('BTC_USDT Futures is not currently trading.'); + return; + } + + const price = orderBook.bids[0]?.p; + const size = Number(contract.order_size_min); + + if ( + !price || + !Number.isFinite(Number(price)) || + Number(price) <= 0 || + !Number.isFinite(size) || + size <= 0 || + (contract.enable_decimal === false && !Number.isInteger(size)) + ) { + console.error('Required contract metadata is unavailable.'); + return; + } + + const text = `t-siebly${Date.now().toString().slice(-12)}`; + const wsKey = WS_KEY_MAP.perpFuturesUSDTV4; + + try { + let placedResponse; + + try { + placedResponse = await wsApi.submitNewFuturesOrder( + { + contract: 'BTC_USDT', + size, + price, + tif: 'poc', + text, + }, + wsKey, + ); + console.log('Command status:', placedResponse.header.status); + console.log('Placed Futures order:', placedResponse.data.result); + } catch (error) { + console.error('Futures WebSocket API placement failed:', error); + return; + } + + const orderId = String(placedResponse.data.result.id); + let statusResponse; + + try { + statusResponse = await wsApi.getFuturesOrderStatus( + { + order_id: orderId, + }, + wsKey, + ); + console.log('Current Futures order:', statusResponse.data.result); + } catch (error) { + console.error('Futures WebSocket API query failed:', error); + } + + if (statusResponse && statusResponse.data.result.status !== 'open') { + console.log( + 'Order is no longer open:', + statusResponse.data.result.status, + ); + return; + } + + try { + const cancelledResponse = await wsApi.cancelFuturesOrder( + { + order_id: orderId, + }, + wsKey, + ); + console.log('Cancelled Futures order:', cancelledResponse.data.result); + } catch (error) { + console.error('Futures WebSocket API cancellation failed:', error); + } + } finally { + wsApi.getWSClient().closeAll(); + } +} + +main(); +``` + +Successful commands have `header.status === '200'`, and the endpoint result is in `data.result`. The SDK rejects a command promise when Gate returns a non-success status. + +An accepted command is not proof that an order later filled, remained open, or was cancelled. Treat the response as [pending confirmation](https://siebly.io/reference/glossary#pending-confirmation), then confirm the final state through the private order stream or a REST API query. + + + +## Work with the Gate REST API + +`RestClient` covers Gate's product groups through named methods. Public methods work without credentials. Private methods use the API key and secret passed to the client. + +### Understand response shapes + +The client resolves to the endpoint's response body: + +```javascript +import { RestClient } from 'gateio-api'; + +const client = new RestClient(); + +async function main() { + try { + const result = await client.getSpotOrderBook({ + currency_pair: 'BTC_USDT', + }); + console.log(result); + } catch (error) { + console.error('Order book request failed:', error); + } +} + +main(); +``` + +There is no shared response envelope. Check the [SDK endpoint map](./endpointFunctionList.md) before deciding how to handle `result`. + +| Method | Response shape | +| ----------------------- | ------------------------------------------ | +| `getServerTime()` | Object with `server_time` | +| `getSpotCurrencyPair()` | Currency-pair object | +| `getSpotTicker()` | Array of ticker objects | +| `getSpotOrderBook()` | Object with tuple-array `bids` and `asks` | +| `getSpotCandles()` | Array of candle tuples | +| `getFuturesContract()` | Contract object | +| `getFuturesTickers()` | Array of ticker objects | +| `getFuturesOrderBook()` | Object with `{ p, s }` bid and ask entries | +| `getFuturesAccount()` | Account object | +| `getFuturesPositions()` | Array of position objects | + +Prices and quantities are commonly returned as strings. Keep them as strings while passing them between Gate API methods. Convert them deliberately when doing calculations, and round the result back to the product's required precision. + +### Read account state + +An authenticated integration usually needs these views: + +| State | Spot method | USDT perpetual method | +| ------------------- | ------------------------- | ---------------------------------------------------------- | +| Balances or account | `getSpotAccounts()` | `getFuturesAccount({ settle: 'usdt' })` | +| Positions | Not applicable | `getFuturesPositions({ settle: 'usdt' })` | +| Open orders | `getSpotOpenOrders()` | `getFuturesOrders({ settle: 'usdt', status: 'open' })` | +| Recent orders | `getSpotOrders()` | `getFuturesOrders({ settle: 'usdt', status: 'finished' })` | +| Trades | `getSpotTradingHistory()` | `getFuturesTradingHistory({ settle: 'usdt' })` | + +These REST API views form a reliable [account state](https://siebly.io/reference/glossary#accountstate) baseline before stream updates are applied. + +### Explore other Gate product groups + +The same `RestClient` also covers the following APIs. Start with read methods and check account eligibility, permissions, and product-specific rules before using any write method. + +| Product group | Representative SDK methods | +| ----------------------- | --------------------------------------------------------------------------- | +| Margin and cross margin | `getMarginAccounts()`, `getCrossMarginAccount()`, `getMarginUserAccounts()` | +| Universal margin loans | `getMarginUNILoans()`, `getMarginUNIMaxBorrow()` | +| Unified Account | `getUnifiedAccountInfo()`, `getUnifiedAccountMode()`, `getUnifiedLoans()` | +| Delivery | `getAllDeliveryContracts()`, `getDeliveryAccount()`, `getDeliveryOrders()` | +| Options | `getOptionsContracts()`, `getOptionsAccount()`, `getOptionsOrders()` | +| Wallet and transfers | `getBalances()`, `submitTransfer()`, `getTransferStatus()` | +| Multi-collateral loans | `getMultiLoanOrders()`, `getMultiLoanSupportedCurrencies()` | +| Flash Swap | `getFlashSwapCurrencyPairs()`, `getFlashSwapOrders()` | +| Earn and lending | `getEarnFixedTermProducts()`, `getEarnFixedTermLends()` | +| Auto Invest | `getAutoInvestCoins()`, `getAutoInvestPlans()`, `getAutoInvestOrders()` | +| Subaccounts | `getSubAccounts()`, `getSubBalance()`, `getSubFuturesBalances()` | +| Rebates and partners | `getPartnerTransactionHistory()`, `getPartnerCommissionHistory()` | +| OTC | `getOTCBankList()`, `getOTCFiatOrderList()` | +| P2P Merchant | `getP2PMerchantUserInfo()`, `getP2PMerchantPendingTransactionList()` | +| CrossEx | `getCrossExSymbols()`, `getCrossExAccounts()`, `getCrossExPositions()` | +| Alpha | `getAlphaCurrencies()`, `getAlphaTickers()`, `getAlphaOrders()` | +| TradFi | `getTradFiSymbols()`, `getTradFiAssets()`, `getTradFiOrders()` | + +See the [complete SDK endpoint map](./endpointFunctionList.md) for every supported method, its authentication requirement, HTTP method, and Gate path. + + + +## Build with WebSocket streams + +Use `WebsocketClient` for ongoing market and account updates. A subscription request has two independent parts: + +- `topic` and `payload` select the Gate channel and its data. +- `wsKey` selects the product connection that carries the subscription. + +One `subscribe()` call can contain several topics when they share the same `wsKey`. Use separate calls for topics on different product connections. + +### Choose the correct WebSocket key + +| Product connection | SDK key | +| ---------------------- | ---------------------------------- | +| Spot | `WS_KEY_MAP.spotV4` | +| USDT perpetual Futures | `WS_KEY_MAP.perpFuturesUSDTV4` | +| BTC perpetual Futures | `WS_KEY_MAP.perpFuturesBTCV4` | +| USDT Delivery | `WS_KEY_MAP.deliveryFuturesUSDTV4` | +| BTC Delivery | `WS_KEY_MAP.deliveryFuturesBTCV4` | +| Options | `WS_KEY_MAP.optionsV4` | +| Announcements | `WS_KEY_MAP.announcementsV4` | + +Do not infer the connection from a symbol alone. `BTC_USDT` can appear in more than one product family. + +Useful public topics include: + +| Product | Starting topics | +| ------- | -------------------------------------------------------------------------------------------------------------- | +| Spot | `spot.tickers`, `spot.trades`, `spot.order_book`, `spot.order_book_update`, `spot.candlesticks` | +| Futures | `futures.tickers`, `futures.trades`, `futures.order_book`, `futures.order_book_update`, `futures.candlesticks` | +| Options | `options.tickers`, `options.trades`, `options.order_book`, `options.ul_tickers` | + +### Treat responses and updates differently + +The `response` event tells you whether Gate accepted a subscribe, unsubscribe, or request message. Check its `error` and `result`. + +The `update` event carries channel data. Inspect `channel`, `event`, `result`, and the SDK-added `wsKey` before updating local state. A subscription response and a data update can have different result shapes. + +### Recover after a reconnect + +The SDK reconnects and restores cached subscriptions. A stream gap can still hide balance, order, trade, or position changes. Reload the affected state from the REST API after `reconnected`. + +This Spot example reloads balances, open orders, and recent trades in sequence: + +```javascript +import { RestClient, WebsocketClient, WS_KEY_MAP } from 'gateio-api'; + +const rest = new RestClient({ + apiKey: process.env.GATE_API_KEY, + apiSecret: process.env.GATE_API_SECRET, +}); + +const ws = new WebsocketClient({ + apiKey: process.env.GATE_API_KEY, + apiSecret: process.env.GATE_API_SECRET, +}); + +let recoveryRunning = false; +let spotState; + +async function recoverSpotState() { + if (recoveryRunning) { + return; + } + + recoveryRunning = true; + + try { + let balances; + + try { + balances = await rest.getSpotAccounts(); + } catch (error) { + console.error('Balance recovery failed:', error); + return; + } + + let openOrders; + + try { + openOrders = await rest.getSpotOpenOrders({ + account: 'spot', + }); + } catch (error) { + console.error('Open-order recovery failed:', error); + return; + } + + let trades; + + try { + trades = await rest.getSpotTradingHistory({ + currency_pair: 'BTC_USDT', + account: 'spot', + limit: 100, + }); + } catch (error) { + console.error('Trade recovery failed:', error); + return; + } + + spotState = { + balances, + openOrders, + trades, + recoveredAt: Date.now(), + }; + + console.log('Recovered Spot state:', spotState); + } finally { + recoveryRunning = false; + } +} + +ws.on('reconnected', async ({ wsKey }) => { + if (wsKey !== WS_KEY_MAP.spotV4) { + return; + } + + await recoverSpotState(); +}); + +ws.on('update', (update) => { + console.log('Private Spot update:', update); +}); + +ws.on('exception', (error) => { + console.error('WebSocket exception:', error); +}); + +try { + ws.subscribe( + { + topic: 'spot.balances', + }, + WS_KEY_MAP.spotV4, + ); +} catch (error) { + console.error('Balance subscription failed:', error); +} + +try { + ws.subscribe( + { + topic: 'spot.orders', + payload: ['BTC_USDT'], + }, + WS_KEY_MAP.spotV4, + ); +} catch (error) { + console.error('Order subscription failed:', error); +} + +try { + ws.subscribe( + { + topic: 'spot.usertrades', + payload: ['BTC_USDT'], + }, + WS_KEY_MAP.spotV4, + ); +} catch (error) { + console.error('Trade subscription failed:', error); +} + +process.once('SIGINT', () => { + ws.closeAll(); +}); +``` + +This is [REST API hydration](https://siebly.io/reference/glossary#rest-hydration) applied as [scoped recovery](https://siebly.io/reference/glossary#scoped-recovery). The example replaces `spotState` only after all three reads succeed. Reload only the state that may have changed on the affected connection, then reconcile it before trusting new updates. + +For a wider recovery design, see [Exchange State](https://siebly.io/reference/exchange-state) and [Runtime Workflows](https://siebly.io/reference/runtime-workflows). + + + +## Use the Gate WebSocket API + +`WebsocketAPIClient` is for request and response commands over WebSocket. It is not the same as a subscription stream. + +The client: + +1. Opens the selected WebSocket connection. +2. Authenticates automatically. +3. Adds a unique request ID. +4. Sends the command. +5. Matches Gate's response to the pending promise. +6. Resolves with `header`, `data.result`, `request_id`, and `wsKey`. + +Authentication happens automatically on the first command. `connectWSAPI(wsKey)` is available when an application wants to open and authenticate the connection early. Automatic WebSocket API reauthentication after a reconnect is enabled by default. + +Spot methods include: + +- `submitNewSpotOrder()` +- `getSpotOrderStatus()` +- `getSpotOrders()` +- `updateSpotOrder()` +- `cancelSpotOrder()` +- `cancelSpotOrderById()` +- `cancelSpotOrderForSymbol()` + +Futures methods include: + +- `submitNewFuturesOrder()` +- `submitNewFuturesBatchOrder()` +- `getFuturesOrderStatus()` +- `getFuturesOrders()` +- `updateFuturesOrder()` +- `cancelFuturesOrder()` + +Pass a Futures `wsKey` explicitly. This keeps the settlement connection visible: + +```javascript +import { WebsocketAPIClient, WS_KEY_MAP } from 'gateio-api'; + +const wsApi = new WebsocketAPIClient({ + apiKey: process.env.GATE_API_KEY, + apiSecret: process.env.GATE_API_SECRET, +}); + +async function main() { + try { + const response = await wsApi.getFuturesOrders( + { + contract: 'BTC_USDT', + status: 'open', + limit: 20, + }, + WS_KEY_MAP.perpFuturesUSDTV4, + ); + + console.log(response.header.status); + console.log(response.data.result); + } catch (error) { + console.error('WebSocket API order request failed:', error); + } finally { + wsApi.getWSClient().closeAll(); + } +} + +main(); +``` + +The response confirms the command outcome. Use private order streams or a REST API query to confirm the resulting exchange state. + + + +## Use Gate TestNet + +Gate TestNet is a separate environment with separate credentials. Use it for all order examples while learning the SDK. + +| Interface | Current TestNet host | +| ------------------------ | ---------------------------------------------- | +| REST API | `https://api-testnet.gateapi.io/api/v4` | +| Spot WebSocket | `wss://ws-testnet.gate.com/v4/ws/spot` | +| USDT perpetual WebSocket | `wss://ws-testnet.gate.com/v4/ws/futures/usdt` | + +Set the REST API host with `baseUrl` and the WebSocket host with `wsUrl`. Prefer explicit hosts for TestNet examples: + +- Spot WebSocket TestNet is not wired through `useTestnet: true` in this SDK. The Spot testnet map entry is a stub (`NoTestnetForSpotWebsockets!`), so set `wsUrl` to the Spot TestNet host above. +- For Futures-only REST TestNet, the SDK also accepts `baseUrlKey: 'futuresTestnet'`, which resolves to `https://fx-api-testnet.gateio.ws/api/v4`. The Global TestNet REST host in the table is the host used by the Spot and Futures order examples in this guide. + +```javascript +import { RestClient, WebsocketClient } from 'gateio-api'; + +const rest = new RestClient({ + apiKey: process.env.GATE_TESTNET_API_KEY, + apiSecret: process.env.GATE_TESTNET_API_SECRET, + baseUrl: 'https://api-testnet.gateapi.io/api/v4', +}); + +const spotWs = new WebsocketClient({ + apiKey: process.env.GATE_TESTNET_API_KEY, + apiSecret: process.env.GATE_TESTNET_API_SECRET, + wsUrl: 'wss://ws-testnet.gate.com/v4/ws/spot', +}); +``` + +Do not send live credentials to TestNet or TestNet credentials to live hosts. TestNet balances, liquidity, and available products can differ from live trading. + +Fund the required Spot or Futures TestNet account with test assets before running an order example. + + + +## Connect to Global and regional REST API hosts + +Use the API host associated with the Gate account and product you are integrating. Credentials and product availability are not interchangeable across account regions. + +| Environment or account | REST API base URL | Official reference | +| ------------------------ | --------------------------------------- | -------------------------------------------------------------------- | +| Global live | `https://api.gateio.ws/api/v4` | [Global Gate API v4](https://www.gate.com/docs/developers/apiv4/en/) | +| Global TestNet | `https://api-testnet.gateapi.io/api/v4` | [Global Gate API v4](https://www.gate.com/docs/developers/apiv4/en/) | +| Futures live alternative | `https://fx-api.gateio.ws/api/v4` | [Global Gate API v4](https://www.gate.com/docs/developers/apiv4/en/) | +| Gate US live | `https://api.gate.us/api/v4` | [Gate US API v4](https://us.gate.com/en-us/docs/developers/apiv4/) | +| Gate EU live | `https://api.gateeu.com/api/v4` | [Gate EU API v4](https://eu.gate.com/docs/developers/apiv4/en/) | + +Global live is the SDK default. Set `baseUrl` for another supported account host: + +```javascript +import { RestClient } from 'gateio-api'; + +const gateUs = new RestClient({ + apiKey: process.env.GATE_API_KEY, + apiSecret: process.env.GATE_API_SECRET, + baseUrl: 'https://api.gate.us/api/v4', +}); + +const gateEu = new RestClient({ + apiKey: process.env.GATE_API_KEY, + apiSecret: process.env.GATE_API_SECRET, + baseUrl: 'https://api.gateeu.com/api/v4', +}); +``` + +Use only the client that matches the account. Regional APIs can expose different products and endpoint sets. Check the regional documentation before calling a method, and use the region's own credentials. + +This guide does not assign regional WebSocket URLs. Use a regional WebSocket host only when the official documentation for that account region provides it. + + + +## Use a proxy with the REST API and WebSockets + +`gateio-api` accepts standard Node.js agents. Configure the agent in both places when all Gate traffic must use the proxy: + +- Pass `httpsAgent` in the second `RestClient` argument and set `proxy: false`. +- Pass the same agent as `wsOptions.agent` to `WebsocketClient` or `WebsocketAPIClient`. + +See [Using proxies with Siebly SDKs](https://siebly.io/blog/using-proxy-with-siebly-sdks) for deployment and troubleshooting guidance. + +### HTTP and HTTPS proxy + +Install the proxy agent: + +```bash +npm install https-proxy-agent +``` + +Set `GATE_PROXY_URL` to an `http://` or `https://` proxy URL. The example does not print the value because it may contain credentials. + +```javascript +import { HttpsProxyAgent } from 'https-proxy-agent'; +import { RestClient, WebsocketClient, WS_KEY_MAP } from 'gateio-api'; + +async function main() { + const proxyUrl = process.env.GATE_PROXY_URL; + + if (!proxyUrl) { + console.error('Set GATE_PROXY_URL.'); + return; + } + + const agent = new HttpsProxyAgent(proxyUrl); + + const rest = new RestClient( + {}, + { + httpsAgent: agent, + proxy: false, + }, + ); + + const ws = new WebsocketClient({ + wsOptions: { + agent, + }, + }); + + ws.on('open', ({ wsKey }) => { + console.log('WebSocket connected through proxy:', wsKey); + }); + + ws.on('response', (response) => { + console.log('Subscription response:', response); + }); + + ws.on('update', (update) => { + console.log('Ticker update through proxy:', update); + ws.closeAll(); + }); + + ws.on('exception', () => { + console.error('WebSocket proxy connection failed.'); + }); + + try { + const time = await rest.getServerTime(); + console.log('Server time through proxy:', time.server_time); + } catch { + console.error('REST API proxy request failed.'); + } + + try { + ws.subscribe( + { + topic: 'spot.tickers', + payload: ['BTC_USDT'], + }, + WS_KEY_MAP.spotV4, + ); + } catch { + console.error('WebSocket proxy subscription failed.'); + } + + process.once('SIGINT', () => { + ws.closeAll(); + }); +} + +main(); +``` + +For an authenticated HTTP or HTTPS proxy, include the username and password in `GATE_PROXY_URL`. Percent-encode reserved characters in each credential component. + +### SOCKS5 proxy + +Install the SOCKS agent: + +```bash +npm install socks-proxy-agent +``` + +Set `GATE_SOCKS_PROXY_URL` to a `socks5://` URL: + +```javascript +import { SocksProxyAgent } from 'socks-proxy-agent'; +import { RestClient, WebsocketClient, WS_KEY_MAP } from 'gateio-api'; + +async function main() { + const proxyUrl = process.env.GATE_SOCKS_PROXY_URL; + + if (!proxyUrl) { + console.error('Set GATE_SOCKS_PROXY_URL.'); + return; + } + + const agent = new SocksProxyAgent(proxyUrl); + + const rest = new RestClient( + {}, + { + httpsAgent: agent, + proxy: false, + }, + ); + + const ws = new WebsocketClient({ + wsOptions: { + agent, + }, + }); + + ws.on('open', ({ wsKey }) => { + console.log('WebSocket connected through SOCKS5:', wsKey); + }); + + ws.on('response', (response) => { + console.log('Subscription response:', response); + }); + + ws.on('update', (update) => { + console.log('Ticker update through SOCKS5:', update); + ws.closeAll(); + }); + + ws.on('exception', () => { + console.error('SOCKS5 WebSocket connection failed.'); + }); + + try { + const time = await rest.getServerTime(); + console.log('Server time through SOCKS5:', time.server_time); + } catch { + console.error('SOCKS5 REST API request failed.'); + } + + try { + ws.subscribe( + { + topic: 'spot.tickers', + payload: ['BTC_USDT'], + }, + WS_KEY_MAP.spotV4, + ); + } catch { + console.error('SOCKS5 WebSocket subscription failed.'); + } + + process.once('SIGINT', () => { + ws.closeAll(); + }); +} + +main(); +``` + +### Private REST API, stream, and WebSocket API traffic + +Use the same agent and credentials for private REST API calls, private subscriptions, and WebSocket API connections: + +```javascript +import { HttpsProxyAgent } from 'https-proxy-agent'; +import { + RestClient, + WebsocketAPIClient, + WebsocketClient, + WS_KEY_MAP, +} from 'gateio-api'; + +async function main() { + const proxyUrl = process.env.GATE_PROXY_URL; + + if (!proxyUrl) { + console.error('Set GATE_PROXY_URL.'); + return; + } + + const agent = new HttpsProxyAgent(proxyUrl); + + const rest = new RestClient( + { + apiKey: process.env.GATE_API_KEY, + apiSecret: process.env.GATE_API_SECRET, + }, + { + httpsAgent: agent, + proxy: false, + }, + ); + + const streams = new WebsocketClient({ + apiKey: process.env.GATE_API_KEY, + apiSecret: process.env.GATE_API_SECRET, + wsOptions: { + agent, + }, + }); + + const wsApi = new WebsocketAPIClient({ + apiKey: process.env.GATE_API_KEY, + apiSecret: process.env.GATE_API_SECRET, + wsOptions: { + agent, + }, + }); + + streams.on('authenticated', ({ wsKey }) => { + console.log('Private stream authenticated:', wsKey); + }); + + streams.on('update', (update) => { + console.log('Private update through proxy:', update); + }); + + streams.on('exception', () => { + console.error('Private stream proxy connection failed.'); + }); + + try { + const balances = await rest.getSpotAccounts(); + console.log('Spot balances through proxy:', balances); + } catch { + console.error('Private REST API proxy request failed.'); + } + + try { + streams.subscribe( + { + topic: 'spot.balances', + }, + WS_KEY_MAP.spotV4, + ); + } catch { + console.error('Private stream subscription failed.'); + } + + try { + await wsApi.getWSClient().connectWSAPI(WS_KEY_MAP.spotV4); + console.log('WebSocket API authenticated through proxy.'); + } catch { + console.error('WebSocket API proxy connection failed.'); + } + + process.once('SIGINT', () => { + streams.closeAll(); + wsApi.getWSClient().closeAll(); + }); +} + +main(); +``` + +To combine a proxy with TestNet or a regional API, keep `baseUrl` or `wsUrl` in the first client argument and the agent in the same positions shown above. + +The proxy's egress IP is the address Gate sees. Add that address to the API key whitelist when whitelisting is enabled. Use a stable proxy endpoint, monitor its latency, and never use a proxy to bypass account or regional restrictions. + +A proxy changes the network path, not request signing, account eligibility, or regional product access. Test public REST API and WebSocket traffic first. Treat HTTP 407 responses, TLS failures, and repeated reconnects as network faults. The SDK does not rotate proxy endpoints. + + + +## Production checklist + +### Keep request time accurate + +Gate private requests and WebSocket authentication depend on timestamp checks. The gap between request time and server time must not exceed 60 seconds. + +Synchronize the host clock with NTP. Use `getServerTime()` for diagnosis, but fix the system clock rather than adding a permanent application offset for a drifting machine. + +### Respect rate limits + +Rate limits vary by product and endpoint. Read the current [Gate API rate-limit documentation](https://www.gate.com/docs/developers/apiv4/en/#frequency-limit-rule) and monitor rejection labels. + +Retry temporary network failures and rate-limit responses with bounded exponential backoff and jitter. Do not blindly retry an order command after an ambiguous timeout. First reconcile by the order's `text` value or query current order state. + +### Use custom order IDs + +Set a unique `text` value beginning with `t-` on each application-owned order. Store it with your local request record. This gives retries, restarts, stream updates, and REST API recovery a common identifier. + +### Apply product metadata + +Before placing an order: + +- Check that the pair or contract is tradable. +- Apply minimum and maximum amounts. +- Round prices and quantities to the permitted increments. +- Treat Futures `size` as a contract count. +- Read `quanto_multiplier` before translating contract size into underlying exposure. +- Keep one-way, dual-side, and split position modes explicit. + +Refresh metadata regularly and when Gate rejects an order for a precision or size rule. + +### Confirm final state + +A REST API response or WebSocket API response can arrive before later fills, cancellations, or amendments. Record the command response, then confirm final state through private streams or a REST API query. + +After a reconnect, restore the affected [exchange state](https://siebly.io/reference/exchange-state) before resuming state-dependent actions. + +### Scope credentials and network access + +- Use separate keys for live and TestNet. +- Grant only the product permissions the process needs. +- Use read-only keys for monitoring services. +- Do not grant withdrawal permission. +- Add IP whitelists when egress addresses are stable. +- Keep secrets in a server-side secret manager or deployment environment. +- Monitor proxy availability and egress IP changes. + +### Shut down connections + +Call `closeAll()` on each WebSocket client when the process is ending. An unsubscribe request is unnecessary when the connection is about to close. + +## FAQ + +### Does `gateio-api` work with plain JavaScript? + +Yes. Every example in this guide is plain JavaScript. The examples use ESM imports, so save them as `.mjs` files or set `"type": "module"` in `package.json`. The package also includes a CommonJS build and TypeScript declarations. + +### Which client should I use? + +Use `RestClient` for public and private REST API calls, `WebsocketClient` for ongoing subscriptions, and `WebsocketAPIClient` for awaitable Spot and Futures commands over WebSocket. + +### Do public Gate API calls need credentials? + +No. Public market data works without an API key. Account data, private streams, and order commands require credentials with the relevant product permission. + +### Why did a REST API call return an object when another returned an array? + +Gate response bodies are endpoint-specific. The SDK returns the endpoint body directly. Check the [endpoint map](./endpointFunctionList.md) before reading the result. + +### Why does `getSpotTicker()` return an array for one pair? + +That is Gate's endpoint response shape. Read the first entry after checking that the array is not empty. + +### How are Spot candles structured? + +Spot candles are tuple arrays containing timestamp, quote volume, close, high, low, open, base volume, and a closed-window flag in that order. + +### Why does Gate use `BTC_USDT`? + +Gate uses underscore-separated currency pairs and contract names. Pass the exact identifier returned by the relevant market or contract metadata endpoint. + +### What do `account` and `settle` change? + +`account` selects the account used by a Spot order or query. `settle` selects the settlement currency and REST API path for Futures or Delivery requests. + +### What is the `text` order field? + +`text` is Gate's custom order ID field. Use a unique value beginning with `t-` to reconcile requests, stream updates, and order queries. + +### Why am I not receiving WebSocket updates? + +Check the topic payload, `wsKey`, API host, credentials, and permissions. Then inspect `response`, `authenticated`, and `exception` events. A successful subscription response confirms registration, but an update only arrives when the subscribed data changes. + +### Which `WS_KEY_MAP` value should I use? + +Choose the key for the exact product connection. For example, Spot uses `spotV4` and USDT perpetual Futures uses `perpFuturesUSDTV4`. + +### Why do private Futures topics use my Gate user ID? + +It is part of the payload required by those channels. Retrieve it with `getAccountDetail()` instead of hardcoding it. + +### What is the difference between a stream and the WebSocket API? + +Streams push subscribed market or account updates. The WebSocket API sends a command and resolves a promise with Gate's matching response. + +### Does a successful WebSocket API response mean the order filled? + +No. It confirms the command result. Confirm later order and fill state through private streams or a REST API query. + +### Why was a post-only order rejected or immediately finished? + +The best bid or ask can move between the order-book request and order placement. Gate will not let a post-only order take liquidity. Read the returned status and `finish_as`, then decide whether to refresh the book and submit a new order with a new `text`. + +### Why does a Futures order size look too small? + +Futures `size` is the number of contracts. Use `quanto_multiplier` to find the underlying amount represented by one contract. + +### Can live credentials be used in TestNet? + +No. TestNet and live trading use separate API keys and balances. Use the current TestNet `baseUrl` or `wsUrl` with TestNet credentials. + +### Can I use Gate US or Gate EU with the SDK? + +Yes, for endpoints available to that account region. Set the documented regional `baseUrl`, use credentials from the same region, and check its official API documentation for product coverage. + +### Can REST API and WebSocket traffic use the same proxy? + +Yes. Create one compatible agent, pass it as `httpsAgent` to `RestClient`, and pass it as `wsOptions.agent` to the WebSocket clients. + +### Does a proxy change signing or account eligibility? + +No. The SDK signs the same requests through the proxy. The Gate account, API host, product permissions, and regional availability still apply. + +### What causes `INVALID_SIGNATURE` or `REQUEST_EXPIRED`? + +Common causes are a drifting system clock, the wrong API secret, credentials from another environment, or an API request reaching the wrong host. Verify the clock, credential source, and API host without logging the secret. + +## Next steps + +- Browse the [Gate SDK examples](https://siebly.io/examples/Gate). +- Find methods in the [complete endpoint map](./endpointFunctionList.md). +- Review the [Gate SDK page](https://siebly.io/sdk/gate/javascript). +- Install or update [`gateio-api` from npm](https://www.npmjs.com/package/gateio-api). +- Browse the [`gateio-api` source repository](https://github.com/tiagosiebler/gateio-api). +- Read the official [Gate REST API documentation](https://www.gate.com/docs/developers/apiv4/en/). +- Read the official [Gate Spot WebSocket documentation](https://www.gate.com/docs/developers/apiv4/ws/). +- Read the official [Gate Futures WebSocket documentation](https://www.gate.com/docs/developers/futures/ws/). +- Review [Exchange State](https://siebly.io/reference/exchange-state) before building private state management. +- Use [Runtime Workflows](https://siebly.io/reference/runtime-workflows) when designing startup, reconnect, and reconciliation behavior. +- Open the [Siebly glossary](https://siebly.io/reference/glossary) for order, stream, and recovery terms. +- Report SDK issues in the [`gateio-api` GitHub repository](https://github.com/tiagosiebler/gateio-api/issues). + +================ +File: examples/Rest/otc/submitOTCBankPersonalSupplement.ts +================ +import { readFileSync } from 'fs'; +⋮---- +import { RestClient } from '../../../src/index.js'; +// import { RestClient } from 'gateio-api'; +⋮---- +async function submitOTCBankPersonalSupplementExample() + +================ +File: src/types/request/alpha.ts +================ +/**========================================================================================================================== + * ALPHA + * ========================================================================================================================== + */ +⋮---- +export interface GetAlphaAccountBookReq { + from: number; // Start timestamp for the query + to?: number; // End timestamp for the query, defaults to current time if not specified + page?: number; // Page number + limit?: number; // Maximum 100 items per page +} +⋮---- +from: number; // Start timestamp for the query +to?: number; // End timestamp for the query, defaults to current time if not specified +page?: number; // Page number +limit?: number; // Maximum 100 items per page +⋮---- +export interface CreateAlphaQuoteReq { + currency: string; // Trading symbol + side: 'buy' | 'sell'; // Buy or sell orders + amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) + gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) + slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom +} +⋮---- +currency: string; // Trading symbol +side: 'buy' | 'sell'; // Buy or sell orders +amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) +gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) +slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom +⋮---- +export interface CreateAlphaOrderReq { + currency: string; // Trading symbol + side: 'buy' | 'sell'; // Buy or sell orders + amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) + gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) + slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom + quote_id: string; // Quote ID returned from quotation API +} +⋮---- +currency: string; // Trading symbol +side: 'buy' | 'sell'; // Buy or sell orders +amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) +gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) +slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom +quote_id: string; // Quote ID returned from quotation API +⋮---- +export interface GetAlphaOrdersReq { + currency?: string; // Trading symbol + side?: 'buy' | 'sell'; // Buy or sell orders + status?: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) + from?: number; // Start time for order query + to?: number; // End time for order query, defaults to current time if not specified + limit?: number; // Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 + page?: number; // Page number +} +⋮---- +currency?: string; // Trading symbol +side?: 'buy' | 'sell'; // Buy or sell orders +status?: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) +from?: number; // Start time for order query +to?: number; // End time for order query, defaults to current time if not specified +limit?: number; // Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 +page?: number; // Page number +⋮---- +export interface GetAlphaOrderReq { + order_id: string; // Order ID +} +⋮---- +order_id: string; // Order ID +⋮---- +export interface GetAlphaCurrenciesReq { + currency?: string; // Query currency information by currency symbol + limit?: number; // Maximum number of records returned in a single list + page?: number; // Page number +} +⋮---- +currency?: string; // Query currency information by currency symbol +limit?: number; // Maximum number of records returned in a single list +page?: number; // Page number +⋮---- +export interface GetAlphaTickersReq { + currency?: string; // Query by specified currency name + limit?: number; // Maximum number of records returned in a single list + page?: number; // Page number +} +⋮---- +currency?: string; // Query by specified currency name +limit?: number; // Maximum number of records returned in a single list +page?: number; // Page number + +================ +File: src/types/request/autoinvest.ts +================ +/**========================================================================================================================== + * EARN AUTO INVEST + * ========================================================================================================================== + */ +⋮---- +export interface AutoInvestPlanPortfolioItemInput { + asset: string; + ratio: string; +} +⋮---- +/** POST /earn/autoinvest/plans/create */ +export interface CreateAutoInvestPlanReq { + plan_name?: string; + plan_des?: string; + plan_money: string; + plan_amount: string; + plan_period_type: + | 'daily' + | 'weekly' + | 'biweekly' + | 'monthly' + | 'hourly' + | '4-hourly'; + plan_period_day: number; + plan_period_hour: number; + items: AutoInvestPlanPortfolioItemInput[]; + /** Fund source: `spot` or `earn`; default spot */ + fund_source?: string; + /** Fund flow: `auto_invest` or `earn`; default auto_invest */ + fund_flow?: string; + /** 0 normal creation, 1 quick investment */ + type?: number; +} +⋮---- +/** Fund source: `spot` or `earn`; default spot */ +⋮---- +/** Fund flow: `auto_invest` or `earn`; default auto_invest */ +⋮---- +/** 0 normal creation, 1 quick investment */ +⋮---- /** POST /earn/autoinvest/plans/update */ export interface UpdateAutoInvestPlanReq { plan_id: number; @@ -6315,225 +8425,592 @@ export interface UpdateAutoInvestPlanReq { fund_flow?: string; } ⋮---- -/** POST /earn/autoinvest/plans/stop */ -export interface StopAutoInvestPlanReq { - plan_id: number; +/** POST /earn/autoinvest/plans/stop */ +export interface StopAutoInvestPlanReq { + plan_id: number; +} +⋮---- +/** POST /earn/autoinvest/plans/add_position */ +export interface AddAutoInvestPlanPositionReq { + plan_id: number; + amount: string; +} +⋮---- +/** POST /earn/autoinvest/min_invest_amount */ +export interface GetAutoInvestMinAmountReq { + money: string; + items: AutoInvestPlanPortfolioItemInput[]; +} +⋮---- +/** GET /earn/autoinvest/coins */ +export interface GetAutoInvestCoinsReq { + /** Pricing currency: USDT or BTC; default USDT */ + plan_money?: string; +} +⋮---- +/** Pricing currency: USDT or BTC; default USDT */ +⋮---- +/** GET /earn/autoinvest/plans/records */ +export interface GetAutoInvestPlanRecordsReq { + plan_id: number; + page?: number; + page_size?: number; +} +⋮---- +/** GET /earn/autoinvest/orders */ +export interface GetAutoInvestOrdersReq { + plan_id: number; + record_id: number; +} +⋮---- +/** GET /earn/autoinvest/plans/detail */ +export interface GetAutoInvestPlanDetailReq { + plan_id: number; +} +⋮---- +/** GET /earn/autoinvest/plans/list_info */ +export interface GetAutoInvestPlansReq { + /** Plan status: e.g. History (history) or Active (active) */ + status: string; + page?: number; + page_size?: number; +} +⋮---- +/** Plan status: e.g. History (history) or Active (active) */ + +================ +File: src/types/request/otc.ts +================ +import { GateMultipartFile } from '../../lib/multipartUtil.js'; +⋮---- +/**========================================================================================================================== + * OTC + * ========================================================================================================================== + */ +⋮---- +export interface CreateOTCQuoteReq { + side: 'PAY' | 'GET'; // PAY means user inputs pay amount, GET means user inputs get amount + pay_coin: string; // Currency the user pays + get_coin: string; // Currency the user receives + pay_amount?: string; // User payment currency amount (required if side is PAY) + get_amount?: string; // Amount of currency received by user (required if side is GET) + create_quote_token?: string; // Create quote token: 0: quote preview only; 1: generate quote token for order placement + promotion_code?: string; // Promotion code (optional) +} +⋮---- +side: 'PAY' | 'GET'; // PAY means user inputs pay amount, GET means user inputs get amount +pay_coin: string; // Currency the user pays +get_coin: string; // Currency the user receives +pay_amount?: string; // User payment currency amount (required if side is PAY) +get_amount?: string; // Amount of currency received by user (required if side is GET) +create_quote_token?: string; // Create quote token: 0: quote preview only; 1: generate quote token for order placement +promotion_code?: string; // Promotion code (optional) +⋮---- +export interface CreateOTCFiatOrderReq { + type: 'BUY' | 'SELL'; // BUY (on-ramp) or SELL (off-ramp) + side: string; // Quote direction returned by the quote API (used for order validation) + crypto_currency: string; // Cryptocurrency + fiat_currency: string; // Fiat currency + crypto_amount: string; // Amount of cryptocurrency + fiat_amount: string; // Fiat amount + promotion_code?: string; // Promotion code + quote_token: string; // Parameter returned by the quote API + /** From GET /otc/bank/list; default card has is_default=1 */ + bank_id: string; +} +⋮---- +type: 'BUY' | 'SELL'; // BUY (on-ramp) or SELL (off-ramp) +side: string; // Quote direction returned by the quote API (used for order validation) +crypto_currency: string; // Cryptocurrency +fiat_currency: string; // Fiat currency +crypto_amount: string; // Amount of cryptocurrency +fiat_amount: string; // Fiat amount +promotion_code?: string; // Promotion code +quote_token: string; // Parameter returned by the quote API +/** From GET /otc/bank/list; default card has is_default=1 */ +⋮---- +export interface CreateOTCStablecoinOrderReq { + pay_coin: string; // Currency paid by the user + get_coin: string; // Currency to be received by the user + pay_amount: string; // User payment currency amount + get_amount: string; // Amount of currency received by the user + side: string; // Quote direction returned by the quote API (used for order validation) + quote_token: string; // Parameter returned by the quote API + promotion_code?: string; // Promotion code (optional) +} +⋮---- +pay_coin: string; // Currency paid by the user +get_coin: string; // Currency to be received by the user +pay_amount: string; // User payment currency amount +get_amount: string; // Amount of currency received by the user +side: string; // Quote direction returned by the quote API (used for order validation) +quote_token: string; // Parameter returned by the quote API +promotion_code?: string; // Promotion code (optional) +⋮---- +export interface MarkOTCOrderAsPaidReq { + order_id: string; // Order ID + client_order_id?: string; // Client order ID (gateway/Inner Pay paths) + payment_receipt_file_key: string; // Required. Stored as file_key; jpg/jpeg/png/pdf; ≤10MB + payment_receipt?: string; // Alias compatible with payment_receipt_file_key +} +⋮---- +order_id: string; // Order ID +client_order_id?: string; // Client order ID (gateway/Inner Pay paths) +payment_receipt_file_key: string; // Required. Stored as file_key; jpg/jpeg/png/pdf; ≤10MB +payment_receipt?: string; // Alias compatible with payment_receipt_file_key +⋮---- +export interface CancelOTCOrderReq { + order_id: string; // Order ID } ⋮---- -/** POST /earn/autoinvest/plans/add_position */ -export interface AddAutoInvestPlanPositionReq { - plan_id: number; - amount: string; +order_id: string; // Order ID +⋮---- +export interface GetOTCFiatOrderListReq { + type?: 'BUY' | 'SELL'; // BUY (on-ramp) or SELL (off-ramp) + fiat_currency?: string; // Fiat currency + crypto_currency?: string; // Digital currency + start_time?: string; // Start Time + end_time?: string; // End time + status?: string; // DONE: Completed + pn?: string; // Page number + ps?: string; // Number of items per page } ⋮---- -/** POST /earn/autoinvest/min_invest_amount */ -export interface GetAutoInvestMinAmountReq { - money: string; - items: AutoInvestPlanPortfolioItemInput[]; +type?: 'BUY' | 'SELL'; // BUY (on-ramp) or SELL (off-ramp) +fiat_currency?: string; // Fiat currency +crypto_currency?: string; // Digital currency +start_time?: string; // Start Time +end_time?: string; // End time +status?: string; // DONE: Completed +pn?: string; // Page number +ps?: string; // Number of items per page +⋮---- +export interface GetOTCStablecoinOrderListReq { + page_size?: string; // Number of records per page + page_number?: string; // Page number + coin_name?: string; // Order currency + start_time?: string; // Start Time + end_time?: string; // End time + status?: string; // Status: PROCESSING: in progress / DONE: completed / FAILED: failed } ⋮---- -/** GET /earn/autoinvest/coins */ -export interface GetAutoInvestCoinsReq { - /** Pricing currency: USDT or BTC; default USDT */ - plan_money?: string; +page_size?: string; // Number of records per page +page_number?: string; // Page number +coin_name?: string; // Order currency +start_time?: string; // Start Time +end_time?: string; // End time +status?: string; // Status: PROCESSING: in progress / DONE: completed / FAILED: failed +⋮---- +export interface GetOTCFiatOrderDetailReq { + order_id: string; // Order ID } ⋮---- -/** Pricing currency: USDT or BTC; default USDT */ +order_id: string; // Order ID ⋮---- -/** GET /earn/autoinvest/plans/records */ -export interface GetAutoInvestPlanRecordsReq { - plan_id: number; - page?: number; - page_size?: number; +export interface OTCBankIdReq { + bank_id: string; } ⋮---- -/** GET /earn/autoinvest/orders */ -export interface GetAutoInvestOrdersReq { - plan_id: number; - record_id: number; +export interface GetOTCBankSupplementChecklistReq { + bank_id: string; } ⋮---- -/** GET /earn/autoinvest/plans/detail */ -export interface GetAutoInvestPlanDetailReq { - plan_id: number; +export interface CreateOTCBankReq { + bank_account_name: string; + bank_name: string; + bank_country: string; + bank_address: string; + iban: string; + swift: string; + remittance_line_number?: string; + agent_bank_name?: string; + agent_bank_swift?: string; + documentation_file: GateMultipartFile; } ⋮---- -/** GET /earn/autoinvest/plans/list_info */ -export interface GetAutoInvestPlansReq { - /** Plan status: e.g. History (history) or Active (active) */ - status: string; +export interface SubmitOTCBankPersonalSupplementReq { + bank_id: string; + id_document_front: GateMultipartFile; + id_document_back: GateMultipartFile; + address_proof: GateMultipartFile; +} +⋮---- +export interface SubmitOTCBankEnterpriseSupplementReq { + bank_id: string; + certificate: GateMultipartFile; + share_holders: GateMultipartFile; + passport: GateMultipartFile; + share_holding_structure: GateMultipartFile; + uid?: string; + funds_statement?: GateMultipartFile; + additional?: GateMultipartFile; +} + +================ +File: src/types/request/p2pMerchant.ts +================ +/** P2P Merchant API request types */ +⋮---- +export interface P2PMerchantGetCounterpartyUserInfoReq { + biz_uid: string; +} +⋮---- +export interface P2PMerchantGetMyselfPaymentReq { + fiat?: string; +} +⋮---- +export interface P2PMerchantGetPendingTransactionListReq { + crypto_currency: string; + fiat_currency: string; + order_tab?: string; + select_type?: string; + status?: string; + txid?: number; + start_time?: number; + end_time?: number; +} +⋮---- +export interface P2PMerchantGetCompletedTransactionListReq { + crypto_currency: string; + fiat_currency: string; + select_type?: string; + status?: string; + txid?: number; + start_time?: number; + end_time?: number; + query_dispute?: number; page?: number; - page_size?: number; + per_page?: number; +} +⋮---- +export interface P2PMerchantGetTransactionDetailsReq { + txid: number; + channel?: string; +} +⋮---- +export interface P2PMerchantConfirmPaymentReq { + trade_id: string; + payment_method: string; +} +⋮---- +export interface P2PMerchantConfirmReceiptReq { + trade_id: string; +} +⋮---- +export interface P2PMerchantCancelTransactionReq { + trade_id: string; + reason_id?: string; + reason_memo?: string; +} +⋮---- +export interface P2PMerchantPlaceBizPushOrderReq { + currencyType: string; + exchangeType: string; + type: string; + unitPrice: string; + number: string; + payType: string; + minAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType + maxAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType + pay_type_json?: string; + rateFixed?: string; + oid?: string; + tierLimit?: string; + verifiedLimit?: string; + regTimeLimit?: string; + advertisersLimit?: string; + hide_payment?: string; + expire_min?: string; + trade_tips?: string; + auto_reply?: string; + min_completed_limit?: string; + max_completed_limit?: string; + completed_rate_limit?: string; + user_country_limit?: string; + user_order_limit?: string; + rateReferenceId?: string; + rateOffset?: string; + float_trend?: string; + limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount; defaults to 0 + fiatMinAmount?: string; // v4.106.102: Required when limitBasis is 1 + fiatMaxAmount?: string; // v4.106.102: Required when limitBasis is 1 + polymarket_limit?: string; // v4.106.102: Restrict trading with Polymarket users +} +⋮---- +minAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType +maxAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType +⋮---- +limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount; defaults to 0 +fiatMinAmount?: string; // v4.106.102: Required when limitBasis is 1 +fiatMaxAmount?: string; // v4.106.102: Required when limitBasis is 1 +polymarket_limit?: string; // v4.106.102: Restrict trading with Polymarket users +⋮---- +/** POST /p2p/merchant/account/set_merchant_work_hours — v4.106.96 */ +export interface P2PMerchantSetMerchantWorkHoursReq { + work_status: 0 | 1 | 2; // 0 resting, 1 working, 2 custom working hours + cycle_type?: string; + day_of_week?: string; + time_zone?: string; // UTC offset -12 to +14 + start_time?: string; + end_time?: string; +} +⋮---- +work_status: 0 | 1 | 2; // 0 resting, 1 working, 2 custom working hours +⋮---- +time_zone?: string; // UTC offset -12 to +14 +⋮---- +export interface P2PMerchantAdsUpdateStatusReq { + adv_no: number; + adv_status: 1 | 3 | 4; + /** Optional query param */ + trade_type?: string; +} +⋮---- +/** Optional query param */ +⋮---- +export interface P2PMerchantAdsDetailReq { + adv_no: string; +} +⋮---- +export interface P2PMerchantMyAdsListReq { + asset?: string; + fiat_unit?: string; + trade_type?: string; +} +⋮---- +export interface P2PMerchantGetAdsListReq { + asset: string; + fiat_unit: string; + trade_type: string; +} +⋮---- +export interface P2PMerchantGetChatsListReq { + txid: number; + lastreceived?: number; + firstreceived?: number; +} +⋮---- +export interface P2PMerchantSendChatMessageReq { + txid: number; + message: string; + /** 0=Text, 1=File (video or image). Default 0 */ + type?: 0 | 1; } ⋮---- -/** Plan status: e.g. History (history) or Active (active) */ +/** 0=Text, 1=File (video or image). Default 0 */ +⋮---- +export interface P2PMerchantUploadChatFileReq { + image_content_type: string; + base64_img: string; +} ================ -File: src/types/request/otc.ts +File: src/types/request/spot.ts ================ -import { GateMultipartFile } from '../../lib/multipartUtil.js'; -⋮---- /**========================================================================================================================== - * OTC + * SPOT * ========================================================================================================================== */ ⋮---- -export interface CreateOTCQuoteReq { - side: 'PAY' | 'GET'; // PAY means user inputs pay amount, GET means user inputs get amount - pay_coin: string; // Currency the user pays - get_coin: string; // Currency the user receives - pay_amount?: string; // User payment currency amount (required if side is PAY) - get_amount?: string; // Amount of currency received by user (required if side is GET) - create_quote_token?: string; // Create quote token: 0: quote preview only; 1: generate quote token for order placement - promotion_code?: string; // Promotion code (optional) +/** Limit-order take-profit / stop-loss on create */ +export interface SpotOrderTPSL { + trigger_price: string; + order_price: string; } ⋮---- -side: 'PAY' | 'GET'; // PAY means user inputs pay amount, GET means user inputs get amount -pay_coin: string; // Currency the user pays -get_coin: string; // Currency the user receives -pay_amount?: string; // User payment currency amount (required if side is PAY) -get_amount?: string; // Amount of currency received by user (required if side is GET) -create_quote_token?: string; // Create quote token: 0: quote preview only; 1: generate quote token for order placement -promotion_code?: string; // Promotion code (optional) +/** Limit-order take-profit / stop-loss on amend; `{}` cancels, `null` leaves unchanged */ +export type PatchSpotOrderTPSL = SpotOrderTPSL | {} | null; ⋮---- -export interface CreateOTCFiatOrderReq { - type: 'BUY' | 'SELL'; // BUY (on-ramp) or SELL (off-ramp) - side: string; // Quote direction returned by the quote API (used for order validation) - crypto_currency: string; // Cryptocurrency - fiat_currency: string; // Fiat currency - crypto_amount: string; // Amount of cryptocurrency - fiat_amount: string; // Fiat amount - promotion_code?: string; // Promotion code - quote_token: string; // Parameter returned by the quote API - /** From GET /otc/bank/list; default card has is_default=1 */ - bank_id: string; +export interface GetSpotOrderBookReq { + currency_pair: string; + interval?: string; + limit?: number; + with_id?: boolean; } ⋮---- -type: 'BUY' | 'SELL'; // BUY (on-ramp) or SELL (off-ramp) -side: string; // Quote direction returned by the quote API (used for order validation) -crypto_currency: string; // Cryptocurrency -fiat_currency: string; // Fiat currency -crypto_amount: string; // Amount of cryptocurrency -fiat_amount: string; // Fiat amount -promotion_code?: string; // Promotion code -quote_token: string; // Parameter returned by the quote API -/** From GET /otc/bank/list; default card has is_default=1 */ -⋮---- -export interface CreateOTCStablecoinOrderReq { - pay_coin?: string; // Currency paid by the user - get_coin?: string; // Currency to be received by the user - pay_amount?: string; // User payment currency amount - get_amount?: string; // Amount of currency received by the user - side?: string; // Quote direction returned by the quote API (used for order validation) - promotion_code?: string; // Promotion code - quote_token?: string; // Parameter returned by the quote API +export interface GetSpotTradesReq { + currency_pair: string; + limit?: number; + last_id?: string; + reverse?: boolean; + from?: number; + to?: number; + page?: number; } ⋮---- -pay_coin?: string; // Currency paid by the user -get_coin?: string; // Currency to be received by the user -pay_amount?: string; // User payment currency amount -get_amount?: string; // Amount of currency received by the user -side?: string; // Quote direction returned by the quote API (used for order validation) -promotion_code?: string; // Promotion code -quote_token?: string; // Parameter returned by the quote API +export interface GetSpotCandlesReq { + currency_pair: string; + limit?: number; + from?: number; + to?: number; + interval?: + | '1s' + | '10s' + | '1m' + | '5m' + | '15m' + | '30m' + | '1h' + | '4h' + | '8h' + | '1d' + | '7d' + | '30d'; +} ⋮---- -export interface MarkOTCOrderAsPaidReq { - order_id: string; // Order ID - client_order_id?: string; // Client order ID (gateway/Inner Pay paths) - payment_receipt_file_key: string; // Required. Stored as file_key; jpg/jpeg/png/pdf; ≤4MB - payment_receipt?: string; // Alias compatible with payment_receipt_file_key +export interface GetSpotAccountBookReq { + currency?: string; + from?: number; + to?: number; + page?: number; + limit?: number; + /** + * BizType / business type filter. Sub-account transfer internal BizType values include + * 150215, 150216, 150217, 150218, 150219 (Subaccount Transfer); see Gate BizType reference. + */ + type?: string; + code?: string; } ⋮---- -order_id: string; // Order ID -client_order_id?: string; // Client order ID (gateway/Inner Pay paths) -payment_receipt_file_key: string; // Required. Stored as file_key; jpg/jpeg/png/pdf; ≤4MB -payment_receipt?: string; // Alias compatible with payment_receipt_file_key +/** + * BizType / business type filter. Sub-account transfer internal BizType values include + * 150215, 150216, 150217, 150218, 150219 (Subaccount Transfer); see Gate BizType reference. + */ ⋮---- -export interface CancelOTCOrderReq { - order_id: string; // Order ID +export interface SubmitSpotClosePosCrossDisabledReq { + text?: string; + currency_pair: string; + amount: string; + price: string; + action_mode?: 'ACK' | 'RESULT' | 'FULL'; } ⋮---- -order_id: string; // Order ID +export interface GetSpotOrdersReq { + currency_pair: string; + status: 'open' | 'finished'; + page?: number; + limit?: number; + account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; + from?: number; + to?: number; + side?: 'buy' | 'sell'; +} ⋮---- -export interface GetOTCFiatOrderListReq { - type?: 'BUY' | 'SELL'; // BUY (on-ramp) or SELL (off-ramp) - fiat_currency?: string; // Fiat currency - crypto_currency?: string; // Digital currency - start_time?: string; // Start Time - end_time?: string; // End time - status?: string; // DONE: Completed - pn?: string; // Page number - ps?: string; // Number of items per page +export interface CancelSpotBatchOrdersReq { + currency_pair: string; + id: string; + account?: 'cross_margin'; + action_mode?: 'ACK' | 'RESULT' | 'FULL'; } ⋮---- -type?: 'BUY' | 'SELL'; // BUY (on-ramp) or SELL (off-ramp) -fiat_currency?: string; // Fiat currency -crypto_currency?: string; // Digital currency -start_time?: string; // Start Time -end_time?: string; // End time -status?: string; // DONE: Completed -pn?: string; // Page number -ps?: string; // Number of items per page +export interface DeleteSpotOrderReq { + order_id: string; + currency_pair: string; + account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; + action_mode?: 'ACK' | 'RESULT' | 'FULL'; + xGateExptime?: number; +} ⋮---- -export interface GetOTCStablecoinOrderListReq { - page_size?: string; // Number of records per page - page_number?: string; // Page number - coin_name?: string; // Order currency - start_time?: string; // Start Time - end_time?: string; // End time - status?: string; // Status: PROCESSING: in progress / DONE: completed / FAILED: failed +export interface GetSpotOrderReq { + order_id: string; + currency_pair: string; + account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; } ⋮---- -page_size?: string; // Number of records per page -page_number?: string; // Page number -coin_name?: string; // Order currency -start_time?: string; // Start Time -end_time?: string; // End time -status?: string; // Status: PROCESSING: in progress / DONE: completed / FAILED: failed +export interface GetSpotTradingHistoryReq { + currency_pair?: string; + limit?: number; + page?: number; + order_id?: string; + account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; + from?: number; + to?: number; +} ⋮---- -export interface GetOTCFiatOrderDetailReq { - order_id: string; // Order ID +export interface UpdateSpotBatchOrdersReq { + order_id?: string; + currency_pair?: string; + amount?: string; + price?: string; + amend_text?: string; + stop_loss?: PatchSpotOrderTPSL; + stop_profit?: PatchSpotOrderTPSL; } ⋮---- -order_id: string; // Order ID +export interface GetSpotInsuranceHistoryReq { + business: 'margin' | 'unified'; + currency: string; + from: number; + to: number; + page?: number; + limit?: number; +} ⋮---- -export interface OTCBankIdReq { - bank_id: string; +export interface GetSpotAutoOrdersReq { + status: 'open' | 'finished'; + market?: string; + account?: 'normal' | 'margin' | 'cross_margin' | 'unified'; + limit?: number; + offset?: number; } ⋮---- -export interface GetOTCBankSupplementChecklistReq { - bank_id: string; +export interface SubmitSpotOrderReq { + xGateExptime?: number; + side: 'buy' | 'sell'; + amount: string; + text?: string; + currency_pair: string; + type?: 'limit' | 'market'; + account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; + price?: string; + time_in_force?: 'gtc' | 'ioc' | 'poc' | 'fok'; + iceberg?: string; + auto_borrow?: boolean; + auto_repay?: boolean; + stp_act?: string; + action_mode?: string; + stop_loss?: PatchSpotOrderTPSL; + stop_profit?: PatchSpotOrderTPSL; + post_only?: boolean; } ⋮---- -export interface CreateOTCBankReq { - bank_account_name: string; - bank_name: string; - bank_country: string; - bank_address: string; - iban: string; - swift: string; - remittance_line_number?: string; - agent_bank_name?: string; - agent_bank_swift?: string; - documentation_file: GateMultipartFile; +export interface UpdateSpotOrderReq { + xGateExptime?: number; + order_id: string; + currency_pair: string; + account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; + amount?: string; + price?: string; + amend_text?: string; + action_mode?: 'ACK' | 'RESULT' | 'FULL'; + stop_loss?: PatchSpotOrderTPSL; + stop_profit?: PatchSpotOrderTPSL; } ⋮---- -export interface SubmitOTCBankPersonalSupplementReq { - bank_id: string; - id_document_front: GateMultipartFile; - id_document_back: GateMultipartFile; - address_proof: GateMultipartFile; +/** GET /spot/pov_orders */ +export interface GetSpotPovOrdersReq { + status: 'open' | 'finished'; + currency_pair?: string; + side?: 'buy' | 'sell'; + page?: number; + limit?: number; } ⋮---- -export interface SubmitOTCBankEnterpriseSupplementReq { - bank_id: string; - certificate: GateMultipartFile; - share_holders: GateMultipartFile; - passport: GateMultipartFile; - share_holding_structure: GateMultipartFile; - uid?: string; - funds_statement?: GateMultipartFile; - additional?: GateMultipartFile; +/** POST /spot/pov_orders */ +export interface CreateSpotPovOrderReq { + currency_pair: string; + side: 'buy' | 'sell'; + amount: string; + participation_rate: 5 | 10 | 20 | 40; + ttl: '1h' | '6h' | '12h' | '1d' | '2d' | '3d' | '4d' | '5d' | '6d' | '7d'; + limit_price?: string; + trigger_price?: string; + text?: string; +} +⋮---- +/** POST /spot/pov_orders/cancel */ +export interface CancelSpotPovOrdersReq { + currency_pair?: string; } ================ @@ -6607,6 +9084,12 @@ export interface TradFiGetPositionHistoryParams { page?: number; page_size?: number; } +⋮---- +/** GET /tradfi/symbols/commissions */ +export interface TradFiGetSymbolCommissionsParams { + symbols?: string; + category_code?: string; +} ================ File: src/types/request/unified.ts @@ -6712,6 +9195,11 @@ export interface CreateQuickRepaymentReq { export interface SetUnifiedDeltaNeutralReq { enabled: boolean; } +⋮---- +/** POST /unified/leverage/user_setting — set leverage for all borrowed currencies */ +export interface SetUserLeverageReq { + leverage?: string; +} ================ File: src/types/request/wallet.ts @@ -6794,2502 +9282,3046 @@ export interface SubmitMainSubTransferReq { client_order_id?: string; sub_account_type?: 'spot' | 'futures' | 'cross_margin' | 'delivery'; } +⋮---- +/** GET /wallet/transfers */ +export interface GetTransferReq { + tx_id: string; +} ================ -File: src/types/response/otc.ts +File: src/types/response/p2pMerchant.ts ================ -/**========================================================================================================================== - * OTC - * ========================================================================================================================== - */ +/** P2P Merchant API response types */ ⋮---- -export interface OTCActionResp { +export interface P2PMerchantApiResp { + timestamp: number; + method: string; code: number; message: string; - timestamp: number; + data: T; + version: string; } ⋮---- -export interface CreateOTCQuoteResp { - code: number; - message: string; - data: { - type: string; // BUY (on-ramp) or SELL (off-ramp) - pay_coin: string; - get_coin: string; - pay_amount: string; - get_amount: string; - rate: string; - rate_reci: string; // Reciprocal of the exchange rate - promotion_code: string; - side: string; - order_type: string; // FIAT or STABLE - quote_token: string; // Quote token required when placing an order - url?: string; - memo?: string; - has_signature?: string; - validity_period?: string; - ex_rate?: string; - usdc_rate?: string; - is_need_file?: string; - gate_bank_id?: string; - gate_bank_name?: string; - refresh_limit?: number; - refresh_limit_msg?: string; - }; - timestamp: number; +export interface P2PMerchantUserInfo { + is_self?: boolean; + user_timest?: string; + counterparties_num?: number; + email_verified?: string; + verified?: string; + has_phone?: string; + user_name?: string; + user_note?: string; + complete_transactions?: string; + paid_transactions?: string; + accepted_transactions?: string; + transactions_used_time?: string; + cancelled_used_time_month?: string; + complete_transactions_month?: string; + complete_rate_month?: number; + orders_buy_rate_month?: number; + is_black?: number; + is_follow?: number; + have_traded?: number; + biz_uid?: string; + blue_vip?: number; + work_status?: number; + registration_days?: number; + first_trade_days?: number; + need_replenish?: number; + merchant_info?: { type?: string; market?: string }; + online_status?: number; + work_hours?: Record | null; + transactions_month?: number; + transactions_all?: number; + trade_versatile?: boolean; + [key: string]: unknown; +} +⋮---- +export interface P2PMerchantCounterpartyUserInfo { + user_timest?: string; + email_verified?: string; + verified?: string; + has_phone?: string; + user_name?: string; + user_note?: string; + complete_transactions?: string; + paid_transactions?: string; + accepted_transactions?: string; + transactions_used_time?: string; + cancelled_used_time_month?: string; + complete_transactions_month?: string; + complete_rate_month?: number; + is_follow?: number; + have_traded?: number; + biz_uid?: string; + registration_days?: number; + first_trade_days?: number; + trade_versatile?: boolean; + [key: string]: unknown; +} +⋮---- +export interface P2PMerchantPaymentMethod { + pay_type: string; + pay_name: string; + ids: number[]; + list: Record[]; +} +⋮---- +export interface P2PMerchantTransactionListItem { + type_buy?: number; + timest?: string; + timest_expire?: string; + type?: string; + trade_type?: string; + timestamp?: number; + rate?: string; + amount?: string; + total?: string; + txid?: number; + status?: string; + order_status?: string; + [key: string]: unknown; +} +⋮---- +export interface P2PMerchantTransactionListData { + list: P2PMerchantTransactionListItem[]; + trans_time?: { od_time?: number }[]; + count: number; + exported_num: number; +} +⋮---- +export interface P2PMerchantTransactionDetails { + is_sell?: number; + txid?: number; + orderid?: number; + timest?: number; + last_pay_time?: number; + remain_pay_time?: number; + currencyType?: string; + want_type?: string; + rate?: string; + amount?: string; + total?: string; + status?: string; + state?: string; + its_uid?: string; + its_nickname?: string; + its_realname?: string; + [key: string]: unknown; +} +⋮---- +export interface P2PMerchantAdsDetail { + rate?: string; + type?: string; + amount?: string; + min_amount?: string; + max_amount?: string; + fiat_min_amount?: string; // v4.106.102: Min fiat amount per order + fiat_max_amount?: string; // v4.106.102: Max fiat amount per order + minFiatAmount?: string; // v4.106.102 + maxFiatAmount?: string; // v4.106.102 + limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount + limitBasisText?: string; // v4.106.102 + polymarket_limit?: string; // v4.106.102 + total?: string; + orderid?: number; + timestamp?: number; + currencyType?: string; + want_type?: string; + status?: string; + [key: string]: unknown; +} +⋮---- +fiat_min_amount?: string; // v4.106.102: Min fiat amount per order +fiat_max_amount?: string; // v4.106.102: Max fiat amount per order +minFiatAmount?: string; // v4.106.102 +maxFiatAmount?: string; // v4.106.102 +limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount +limitBasisText?: string; // v4.106.102 +polymarket_limit?: string; // v4.106.102 +⋮---- +export interface P2PMerchantMyAdsListItem { + type?: string; + rate?: string; + amount?: string; + total?: string; + id?: string; + status?: string; + currencyType?: string; + want_type?: string; + fiat_min_amount?: string; // v4.106.102 + fiat_max_amount?: string; // v4.106.102 + limit_basis?: string; // v4.106.103 + limit_basis_text?: string; // v4.106.103 + [key: string]: unknown; +} +⋮---- +fiat_min_amount?: string; // v4.106.102 +fiat_max_amount?: string; // v4.106.102 +limit_basis?: string; // v4.106.103 +limit_basis_text?: string; // v4.106.103 +⋮---- +export interface P2PMerchantMyAdsListData { + lists: P2PMerchantMyAdsListItem[]; +} +⋮---- +export interface P2PMerchantAdsListItem { + index?: number; + asset?: string; + fiat_unit?: string; + adv_no?: number; + price?: string; + max_single_trans_amount?: string; + min_single_trans_amount?: string; + nick_name?: string; + surplus_amount?: string; // v4.106.103: Remaining tradable crypto quantity + trade_methods?: string[]; // v4.106.103: Supported payment methods list + fiat_min_amount?: string; // v4.106.103 + fiat_max_amount?: string; // v4.106.103 + limit_basis?: string; // v4.106.103 + limit_basis_text?: string; // v4.106.103 } ⋮---- -type: string; // BUY (on-ramp) or SELL (off-ramp) +surplus_amount?: string; // v4.106.103: Remaining tradable crypto quantity +trade_methods?: string[]; // v4.106.103: Supported payment methods list +fiat_min_amount?: string; // v4.106.103 +fiat_max_amount?: string; // v4.106.103 +limit_basis?: string; // v4.106.103 +limit_basis_text?: string; // v4.106.103 ⋮---- -rate_reci: string; // Reciprocal of the exchange rate +export interface P2PMerchantChatMessage { + is_sell?: number; + msg_type?: number; + msg?: string; + username?: string; + uid?: string; + timest?: number; + type?: number; + pic?: string; + file_key?: string; + file_type?: string; + width?: string; + height?: string; + msg_obj?: Record; + risk_type?: number; // v4.106.96: 1 off-platform traffic diversion risk + toast_msg?: string; // v4.106.96 + [key: string]: unknown; +} ⋮---- -order_type: string; // FIAT or STABLE -quote_token: string; // Quote token required when placing an order +risk_type?: number; // v4.106.96: 1 off-platform traffic diversion risk +toast_msg?: string; // v4.106.96 ⋮---- -export type CreateOTCFiatOrderResp = OTCActionResp; +/** v4.106.96: Risk control response when place_biz_push_order hits off-platform diversion check */ +export interface P2PMerchantPlaceOrderRiskData { + risk_code?: string; + risk_event?: { + type?: string; + title?: string; + msg?: string; + action?: string; + content_risk_type?: string; + trade_tips?: string; + auto_reply?: string; + }; +} ⋮---- -export interface CreateOTCStablecoinOrderResp { - code: number; - message: string; +/** v4.106.96: send_chat_message risk fields in data */ +export interface P2PMerchantSendChatMessageData { + risk_type?: number; + toast_msg?: string; + [key: string]: unknown; } ⋮---- -export interface OTCBankListItem { - id: string; // Bank ID (required for order placement) - bank_account_name: string; - bank_name: string; - bank_country?: string; - bank_address?: string; - bank_code?: string; - branch_code?: string; - iban?: string; - swift?: string; - remittance_line_number?: string; - agent_bank_name?: string; - agent_bank_swift?: string; - submit_time?: string; - update_time?: string; - status?: string; - documentation_file_type?: string; +export interface P2PMerchantChatsListData { + messages: P2PMerchantChatMessage[]; + has_history?: boolean; + txid?: number; + SRVTM?: number; + order_status?: string; memo?: string; - /** 1 = default bank card, 0 = not default */ - is_default?: 0 | 1; - bank_id?: string; - documentation_file_key_url?: string; } -⋮---- -id: string; // Bank ID (required for order placement) -⋮---- -/** 1 = default bank card, 0 = not default */ -⋮---- -export interface GetOTCBankListResp { - code: number; - message: string; - data: { - lists: OTCBankListItem[]; - }; - timestamp: number; + +================ +File: src/types/response/withdrawal.ts +================ +export interface WithdrawalRecord { + id: string; + txid: string; + block_number: string; + withdraw_order_id: string; + /** When `status` is DONE, withdrawal success time (not conditioned on `block_number`). */ + timestamp: string; + amount: string; + currency: string; + address: string; + memo?: string; + status: + | 'BCODE' // Deposit Code Operation + | 'CANCEL' // Cancelled + | 'CANCELPEND' // Withdrawal Cancellation Pending + | 'DMOVE' // Pending Manual Review + | 'DONE' // Completed + | 'EXTPEND' // Sent and Waiting for Confirmation + | 'FAIL' // On-Chain Failure Pending Confirmation + | 'FVERIFY' // Facial Verification in Progress + | 'INVALID' // Invalid Transaction + | 'LOCKED' // Wallet-Side Order Locked + | 'MANUAL' // Pending Manual Review + | 'PEND' // Processing + | 'PROCES' // Processing + | 'REJECT' // Rejected + | 'REQUEST' // Request in Progress + | 'REVIEW' // Under Review + | 'SPLITPEND' // Split Pending + | 'VERIFY'; // Verification in Progress + chain: string; } ⋮---- -export interface CreateOTCBankResp { - code: number; - message: string; - data: { - bank_id: number; - status: number; - }; - timestamp?: number; -} +/** When `status` is DONE, withdrawal success time (not conditioned on `block_number`). */ ⋮---- -export interface OTCBankSupplementChecklistItem { - code: string; - zh?: string; - en?: string; - required: boolean; -} +| 'BCODE' // Deposit Code Operation +| 'CANCEL' // Cancelled +| 'CANCELPEND' // Withdrawal Cancellation Pending +| 'DMOVE' // Pending Manual Review +| 'DONE' // Completed +| 'EXTPEND' // Sent and Waiting for Confirmation +| 'FAIL' // On-Chain Failure Pending Confirmation +| 'FVERIFY' // Facial Verification in Progress +| 'INVALID' // Invalid Transaction +| 'LOCKED' // Wallet-Side Order Locked +| 'MANUAL' // Pending Manual Review +| 'PEND' // Processing +| 'PROCES' // Processing +| 'REJECT' // Rejected +| 'REQUEST' // Request in Progress +| 'REVIEW' // Under Review +| 'SPLITPEND' // Split Pending +| 'VERIFY'; // Verification in Progress + +================ +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 +bundleReport.html +.history/ +dist +coverage +localtest.sh +repomix.sh +doc +examples/ignored/ + +ws-private-spot-wsapi-performance.ts +ws-private-perp-futures-wsapi-readonly.ts +privatetest.ts + +privaterepotracker +restClientRegex.ts + +testfile.ts + +================ +File: src/types/request/crossex.ts +================ +/**========================================================================================================================== + * CROSSEX + * ========================================================================================================================== + */ ⋮---- -export interface GetOTCBankSupplementChecklistResp { - code: number; - message: string; - data: { - user_type: 'personal' | 'enterprise'; - items: OTCBankSupplementChecklistItem[]; - }; - timestamp?: number; +export interface GetCrossExSymbolsReq { + symbols?: string; // Trading Pair List, multiple separated by commas } ⋮---- -export type MarkOTCOrderAsPaidResp = OTCActionResp; -⋮---- -export type CancelOTCOrderResp = OTCActionResp; +symbols?: string; // Trading Pair List, multiple separated by commas ⋮---- -export interface OTCFiatOrderListItem { - time: string; // Current time - timestamp: number; // Current timestamp - order_id: string; - trade_no: string; // Trade number - type: string; // Quote direction buy/sell/all - status: string; // Order Status - db_status: string; - fiat_currency: string; // Fiat type - fiat_currency_info: { - name: string; - icon: string; - }; - fiat_amount: string; // Fiat amount - crypto_currency: string; // Stablecoin - crypto_currency_info: { - name: string; - icon: string; - }; - crypto_amount: string; // Stablecoin amount - rate: string; // Exchange rate - transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) - reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders - gate_bank_account_iban: string; // Bank account - promotion_code: string; // Promotion code +export interface GetCrossExRiskLimitsReq { + symbols: string; // Trading Pair List, multiple separated by commas } ⋮---- -time: string; // Current time -timestamp: number; // Current timestamp +symbols: string; // Trading Pair List, multiple separated by commas +⋮---- +export interface GetCrossExTransferCoinsReq { + coin?: string; // Currency +} ⋮---- -trade_no: string; // Trade number -type: string; // Quote direction buy/sell/all -status: string; // Order Status +coin?: string; // Currency ⋮---- -fiat_currency: string; // Fiat type +export interface CreateCrossExTransferReq { + coin: string; // Currency + amount: string; // Transfer amount + from: string; // CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX_KRAKEN, CROSSEX, SPOT, etc. + to: string; + text?: string; // User-defined ID +} ⋮---- -fiat_amount: string; // Fiat amount -crypto_currency: string; // Stablecoin +coin: string; // Currency +amount: string; // Transfer amount +from: string; // CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX_KRAKEN, CROSSEX, SPOT, etc. ⋮---- -crypto_amount: string; // Stablecoin amount -rate: string; // Exchange rate -transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) -reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders -gate_bank_account_iban: string; // Bank account -promotion_code: string; // Promotion code +text?: string; // User-defined ID ⋮---- -export interface GetOTCFiatOrderListResp { - code: number; - message: string; - data: { - pn: number; - ps: number; - total_pn: number; - count: number; - list: OTCFiatOrderListItem[]; - }; +export interface GetCrossExTransferHistoryReq { + coin?: string; // Query by specified currency name + order_id?: string; // Supports querying by the order ID returned when creating an order (tx_id), as well as a user-defined custom ID specified at creation (text) + from?: number; // Start timestamp for the query + to?: number; // End timestamp for the query, defaults to current time if not specified + page?: number; // Page number + limit?: number; // Maximum number returned by list, max 1000 } ⋮---- -export interface OTCStablecoinOrderListItem { - id: number; // Order ID - trade_no: string; // Transaction reference number - pay_coin: string; // Payment currency - pay_amount: string; // Payment amount - get_coin: string; // Received currency - get_amount: string; // Received amount - rate: string; // Exchange rate - rate_reci: string; // Reciprocal of the exchange rate - status: string; // PROCESSING: in progress / DONE: completed / FAILED: failed - create_timest: number; // Timestamp - create_time: string; // Created time - pay_icon?: string; - get_icon?: string; +coin?: string; // Query by specified currency name +order_id?: string; // Supports querying by the order ID returned when creating an order (tx_id), as well as a user-defined custom ID specified at creation (text) +from?: number; // Start timestamp for the query +to?: number; // End timestamp for the query, defaults to current time if not specified +page?: number; // Page number +limit?: number; // Maximum number returned by list, max 1000 +⋮---- +export interface CreateCrossExOrderReq { + text?: string; // Client-defined Order ID, supports letters (a-z), numbers (0-9), symbols (-, _) only + symbol: string; // Unique identifier Exchange_Business_Base_Counter + side: 'BUY' | 'SELL'; + type?: 'LIMIT' | 'MARKET'; // Order type (default: LIMIT) + time_in_force?: 'GTC' | 'IOC' | 'FOK' | 'POC' | 'RPI'; // Default GTC; RPI = Retail Price Improvement + qty?: string; // Order quantity (required unless spot market buy) + price?: string; // Limit Order Price (Required for Limit Orders) + quote_qty?: string; // Order quote quantity; required for spot and margin market buy orders + reduce_only?: 'true' | 'false'; // Reduce-only + position_side?: 'LONG' | 'SHORT' | 'NONE'; // Position side, defaults to NONE (single position mode) if not specified } ⋮---- -id: number; // Order ID -trade_no: string; // Transaction reference number -pay_coin: string; // Payment currency -pay_amount: string; // Payment amount -get_coin: string; // Received currency -get_amount: string; // Received amount -rate: string; // Exchange rate -rate_reci: string; // Reciprocal of the exchange rate -status: string; // PROCESSING: in progress / DONE: completed / FAILED: failed -create_timest: number; // Timestamp -create_time: string; // Created time +text?: string; // Client-defined Order ID, supports letters (a-z), numbers (0-9), symbols (-, _) only +symbol: string; // Unique identifier Exchange_Business_Base_Counter ⋮---- -export interface GetOTCStablecoinOrderListResp { - code: number; - message: string; - data: { - total: number; - page_size: number; - page_number: number; - total_page: number; - list: OTCStablecoinOrderListItem[]; - }; +type?: 'LIMIT' | 'MARKET'; // Order type (default: LIMIT) +time_in_force?: 'GTC' | 'IOC' | 'FOK' | 'POC' | 'RPI'; // Default GTC; RPI = Retail Price Improvement +qty?: string; // Order quantity (required unless spot market buy) +price?: string; // Limit Order Price (Required for Limit Orders) +quote_qty?: string; // Order quote quantity; required for spot and margin market buy orders +reduce_only?: 'true' | 'false'; // Reduce-only +position_side?: 'LONG' | 'SHORT' | 'NONE'; // Position side, defaults to NONE (single position mode) if not specified +⋮---- +export interface GetCrossExMarketTickersReq { + symbols?: string; } ⋮---- -export interface OTCFiatOrderDetail { - order_id: string; // Order ID - uid: string; // User ID - type: string; // Order Type - fiat_currency: string; // Fiat type - fiat_amount: string; // Fiat amount - crypto_currency: string; // Stablecoin - crypto_amount: string; // Stablecoin amount - rate: string; // Exchange rate - transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) - reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders - status: string; // Status - db_status: string; - create_time: string; // Created time - memo: string; // Cancellation or rejection reason - side: string; // Quote direction - promotion_code: string; // Promotion code - trade_no: string; // Trade number +export interface GetCrossExMarketFundingInfoReq { + symbols?: string; } ⋮---- -order_id: string; // Order ID -uid: string; // User ID -type: string; // Order Type -fiat_currency: string; // Fiat type -fiat_amount: string; // Fiat amount -crypto_currency: string; // Stablecoin -crypto_amount: string; // Stablecoin amount -rate: string; // Exchange rate -transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) -reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders -status: string; // Status +/** Either order_id or text required; order_id wins if both set */ +export interface CancelBatchCrossExOrdersReq { + order_id?: string; + text?: string; +} ⋮---- -create_time: string; // Created time -memo: string; // Cancellation or rejection reason -side: string; // Quote direction -promotion_code: string; // Promotion code -trade_no: string; // Trade number +export interface ModifyCrossExOrderReq { + qty?: string; // modify amount + price?: string; // modify price +} ⋮---- -export interface GetOTCFiatOrderDetailResp { - message: string; - code: number; - data: OTCFiatOrderDetail; +qty?: string; // modify amount +price?: string; // modify price +⋮---- +export interface CreateCrossExConvertQuoteReq { + exchange_type: string; // Exchange Type + from_coin: string; // Asset Sold + to_coin: string; // Asset name to buy (OKX and GATE only allow BTC, ETH, USDT; BN only allows USDT) + from_amount: string; // Amount to sell } - -================ -File: src/types/response/tradfi.ts -================ -/** TradFi API response types */ ⋮---- -export interface TradFiApiResp { - timestamp?: number; - data?: T; - code?: number; - message?: string; - label?: string; +exchange_type: string; // Exchange Type +from_coin: string; // Asset Sold +to_coin: string; // Asset name to buy (OKX and GATE only allow BTC, ETH, USDT; BN only allows USDT) +from_amount: string; // Amount to sell +⋮---- +export interface CreateCrossExConvertOrderReq { + quote_id: string; // Inquiry ID } ⋮---- -export interface TradFiListData { - list?: T[]; - total?: number; - total_page?: number; +quote_id: string; // Inquiry ID +⋮---- +export interface UpdateCrossExAccountReq { + position_mode?: string; // Futures position mode (SINGLE/DUAL) + account_mode?: string; // Account mode (CROSS_EXCHANGE/ISOLATED_EXCHANGE, default: CROSS_EXCHANGE) + exchange_type?: string; // Exchange (BINANCE/OKX/GATE/BYBIT/CROSSEX) } ⋮---- -export interface TradFiMT5Account { - mt5_uid?: number; - leverage?: number; - stop_out_level?: string; - status?: number; +position_mode?: string; // Futures position mode (SINGLE/DUAL) +account_mode?: string; // Account mode (CROSS_EXCHANGE/ISOLATED_EXCHANGE, default: CROSS_EXCHANGE) +exchange_type?: string; // Exchange (BINANCE/OKX/GATE/BYBIT/CROSSEX) +⋮---- +export interface GetCrossExAccountsReq { + exchange_type?: string; // Exchange. Not required in cross-exchange mode; required in single-exchange mode (BINANCE/OKX/GATE/BYBIT) } ⋮---- -export interface TradFiCategoryItem { - category_id?: number; - is_favorite?: boolean; - category_name?: string; +exchange_type?: string; // Exchange. Not required in cross-exchange mode; required in single-exchange mode (BINANCE/OKX/GATE/BYBIT) +⋮---- +export interface SetCrossExPositionLeverageReq { + symbol: string; // Currency pair + leverage: string; // leverage } ⋮---- -export interface TradFiSymbolItem { - symbol?: string; - symbol_desc?: string; - category_id?: number; - status?: string; - trade_mode?: string; - icon_link?: string; - close_time?: number; - open_time?: number; - next_open_time?: number; - settlement_currency?: string; - settlement_currency_symbol?: string; - price_precision?: number; +symbol: string; // Currency pair +leverage: string; // leverage +⋮---- +export interface GetCrossExPositionLeverageReq { + symbols?: string; // Trading Pair List, multiple separated by commas } ⋮---- -export interface TradFiSymbolDetailItem { - symbol?: string; - symbol_desc?: string; - category_name?: string; - contract_volume?: string; - settlement_currency?: string; - max_order_volume?: string; - min_order_volume?: string; - leverage?: string; - price_precision?: number; - price_sl_level?: string; - swap_cost_type?: string; - buy_swap_cost_rate?: string; - sell_swap_cost_rate?: string; - swap_cost_3day?: string; - trade_timezone?: string; - trade_mode?: string; - icon_link?: string; - [key: string]: unknown; +symbols?: string; // Trading Pair List, multiple separated by commas +⋮---- +export interface SetCrossExMarginPositionLeverageReq { + symbol: string; // Currency pair + leverage: string; // leverage } ⋮---- -export interface TradFiKlineItem { - o?: string; - c?: string; - h?: string; - l?: string; - t?: number; +symbol: string; // Currency pair +leverage: string; // leverage +⋮---- +export interface GetCrossExMarginPositionLeverageReq { + symbols?: string; // Trading Pair List, multiple separated by commas } ⋮---- -export interface TradFiTicker { - highest_price?: string; - lowest_price?: string; - price_change?: string; - price_change_amount?: string; - today_open_price?: string; - last_today_close_price?: string; - last_price?: string; - bid_price?: string; - ask_price?: string; - favorite?: boolean; - status?: string; - close_time?: number; - open_time?: number; - next_open_time?: number; - trade_mode?: string; - category_name?: string; +symbols?: string; // Trading Pair List, multiple separated by commas +⋮---- +export interface CloseCrossExPositionReq { + symbol: string; // Trading Pair + position_side?: string; // Position Direction } ⋮---- -export interface TradFiCreateUserResult { - status?: number; - leverage?: number; - mt5_uid?: string; +symbol: string; // Trading Pair +position_side?: string; // Position Direction +⋮---- +export interface GetCrossExInterestRateReq { + coin?: string; // Currency + exchange_type?: string; // Exchange } ⋮---- -export interface TradFiAssets { - equity?: string; - margin_level?: string; - balance?: string; - margin?: string; - margin_free?: string; - unrealized_pnl?: string; - mt5_uid?: string; +coin?: string; // Currency +exchange_type?: string; // Exchange +⋮---- +export interface GetCrossExPositionsReq { + symbol?: string; // Trading Pair + exchange_type?: string; // Exchange } ⋮---- -export interface TradFiTransactionRecord { - asset?: string; - type?: string; - type_desc?: string; - change?: string; - balance?: string; - time?: number; +symbol?: string; // Trading Pair +exchange_type?: string; // Exchange +⋮---- +export interface GetCrossExMarginPositionsReq { + symbol?: string; // Currency pair + exchange_type?: string; // Exchange } ⋮---- -export interface TradFiTransactionListData { - total?: number; - total_page?: number; - list?: TradFiTransactionRecord[]; +symbol?: string; // Currency pair +exchange_type?: string; // Exchange +⋮---- +export interface GetCrossExAdlRankReq { + symbol: string; // Trading Pair } ⋮---- -export interface TradFiCreateOrderResult { - id?: string; +symbol: string; // Trading Pair +⋮---- +export interface GetCrossExOpenOrdersReq { + symbol?: string; // Trading Pair + exchange_type?: string; // Exchange + business_type?: string; // Business Type } ⋮---- -export interface TradFiOrderItem { - order_id?: number; +symbol?: string; // Trading Pair +exchange_type?: string; // Exchange +business_type?: string; // Business Type +⋮---- +export interface GetCrossExHistoryOrdersReq { + page?: number; // Page number + limit?: number; // Maximum number of records returned in a single list symbol?: string; - symbol_desc?: string; - price_type?: string; - state?: number; - state_desc?: string; - finished?: number; - side?: number; - volume?: string; - price?: string; - price_tp?: string; - price_sl?: string; - time_setup?: number; + from?: number; // Start Millisecond Timestamp + to?: number; // End Millisecond Timestamp + /** Comma-separated: COMMON, LIQ, REDUCE, ADL, SETTLEMENT */ + attributes?: string; } ⋮---- -export interface TradFiOrderListData { - list?: TradFiOrderItem[]; - timestamp?: number; +page?: number; // Page number +limit?: number; // Maximum number of records returned in a single list +⋮---- +from?: number; // Start Millisecond Timestamp +to?: number; // End Millisecond Timestamp +/** Comma-separated: COMMON, LIQ, REDUCE, ADL, SETTLEMENT */ +⋮---- +export interface GetCrossExHistoryPositionsReq { + page?: number; // Page number + limit?: number; // Maximum number returned by list, max 1000 + symbol?: string; + from?: number; // Start Millisecond Timestamp + to?: number; // End Millisecond Timestamp } ⋮---- -export interface TradFiModifyOrderResult { - order_id?: number; +page?: number; // Page number +limit?: number; // Maximum number returned by list, max 1000 +⋮---- +from?: number; // Start Millisecond Timestamp +to?: number; // End Millisecond Timestamp +⋮---- +export interface GetCrossExHistoryMarginPositionsReq { + page?: number; // Page number + limit?: number; // Maximum number returned by list, max 1000 symbol?: string; - state?: string; - volume?: string; - price?: string; - price_tp?: string; - price_sl?: string; + from?: number; // Start Millisecond Timestamp + to?: number; // End Millisecond Timestamp } ⋮---- -export interface TradFiOrderHistoryItem { - order_id?: number; +page?: number; // Page number +limit?: number; // Maximum number returned by list, max 1000 +⋮---- +from?: number; // Start Millisecond Timestamp +to?: number; // End Millisecond Timestamp +⋮---- +export interface GetCrossExHistoryMarginInterestsReq { symbol?: string; - symbol_desc?: string; - price_type?: string; - order_opt_type?: number; - state?: number; - state_desc?: string; - side?: number; - volume?: string; - fill_volume?: string; - close_pnl?: string; - price?: string; - trigger_price?: string; - price_tp?: string; - price_sl?: string; - time_setup?: number; - time_done?: number; + from?: number; + to?: number; + page?: number; + limit?: number; + exchange_type?: string; } ⋮---- -export interface TradFiPositionItem { - position_id?: number; +export interface GetCrossExHistoryTradesReq { + page?: number; // Page number + limit?: number; // Maximum number returned by list, max 1000 symbol?: string; - symbol_desc?: string; - margin?: string; - unrealized_pnl?: string; - unrealized_pnl_rate?: string; - volume?: string; - price_open?: string; - position_dir?: string; - price_tp?: string; - price_sl?: string; - counterparty_price?: string; - time_create?: number; + from?: number; // Start Millisecond Timestamp + to?: number; // End Millisecond Timestamp } ⋮---- -export interface TradFiPositionListData { - list?: TradFiPositionItem[]; - timestamp?: number; +page?: number; // Page number +limit?: number; // Maximum number returned by list, max 1000 +⋮---- +from?: number; // Start Millisecond Timestamp +to?: number; // End Millisecond Timestamp +⋮---- +export interface GetCrossExAccountBookReq { + page?: number; // Page number + limit?: number; // Maximum number returned by list, max 1000 + coin?: string; + from?: number; // Start Millisecond Timestamp + to?: number; // End Millisecond Timestamp } ⋮---- -export interface TradFiPositionHistoryItem { - position_id?: number; - symbol?: string; - realized_pnl?: string; - realized_pnl_rate?: string; - volume?: string; - volume_closed?: string; - price_open?: string; - position_dir?: string; - price_tp?: string; - price_sl?: string; - counterparty_price?: string; - close_price?: string; - time_create?: string; - time_close?: string; - position_status?: string; - close_detail?: Record | null; - realized_pnl_detail?: { - closed_pnl?: string; - swap?: string; - fee?: string; - }; +page?: number; // Page number +limit?: number; // Maximum number returned by list, max 1000 +⋮---- +from?: number; // Start Millisecond Timestamp +to?: number; // End Millisecond Timestamp +⋮---- +export interface GetCrossExCoinDiscountRateReq { + coin?: string; + exchange_type?: string; // OKX/GATE/BINANCE/BYBIT +} +⋮---- +exchange_type?: string; // OKX/GATE/BINANCE/BYBIT + +================ +File: src/types/request/earn.ts +================ +/**========================================================================================================================== + * EARN + * ========================================================================================================================== + */ +⋮---- +/** GET /earn/dual/investment_plan */ +export interface GetDualInvestmentPlansReq { + plan_id?: number | string; + coin?: string; + type?: string; + quote_currency?: string; + /** `apy` | `short-period` | `multiple` */ + sort?: string; + page?: number; + page_size?: number; +} +⋮---- +/** `apy` | `short-period` | `multiple` */ +⋮---- +/** GET /earn/dual/orders */ +export interface GetDualInvestmentOrdersReq { + from?: number; + to?: number; + type?: string; + status?: string; + coin?: string; + page?: number; + limit?: number; } ⋮---- -/** GET /tradfi/orders/log/{log_id} — v4.106.94 */ -export interface TradFiOrderLog { - order_id?: number; - log_id?: number; - symbol?: string; - price_type?: 'market' | 'trigger'; - state?: number; - side?: number; - volume?: string; - price?: string; - [key: string]: unknown; +/** GET /earn/dual/order-refund-preview */ +export interface GetDualOrderRefundPreviewReq { + order_id: string; } - -================ -File: src/types/response/wallet.ts -================ -export interface CurrencyChain { - chain: string; - name_cn: string; - name_en: string; - contract_address: string; - is_disabled: number; - is_deposit_disabled: number; - is_withdraw_disabled: number; - decimal: string; +⋮---- +/** POST /earn/dual/order-refund */ +export interface SubmitDualOrderRefundParams { + order_id: string; + /** From order-refund-preview */ + req_id: string; } ⋮---- -/** GET /wallet/sub_account_balances item */ -export interface SubAccountBalance { - uid: string; - available: { [key: string]: string }; - /** Locked amount per currency */ - locking?: { [key: string]: string }; +/** From order-refund-preview */ +⋮---- +/** POST /earn/dual/modify-order-reinvest */ +export interface UpdateDualOrderReinvestParams { + order_id?: number; + /** 0 off, 1 on */ + status?: number; + /** Effective duration in seconds; default 86400 */ + effective_time_duration?: number; } ⋮---- -/** Locked amount per currency */ +/** 0 off, 1 on */ ⋮---- -export interface DepositRecord { - id: string; - txid: string; - timestamp: string; +/** Effective duration in seconds; default 86400 */ +⋮---- +/** GET /earn/dual/project-recommend */ +export interface GetDualProjectRecommendReq { + mode?: string; + coin?: string; + type?: string; + /** Comma-separated project IDs to exclude */ + history_pids?: string; +} +⋮---- +/** Comma-separated project IDs to exclude */ +⋮---- +/** Request params for POST /earn/dual/orders */ +export interface PlaceDualInvestmentOrderParams { + plan_id: string; + /** Subscription amount. Mutually exclusive with copies. */ amount: string; - currency: string; - address: string; - memo?: string; - status: - | 'BLOCKED' // Deposit Blocked - | 'DEP_CREDITED' // Deposit Credited, Withdrawal Pending Unlock - | 'DONE' // Funds Credited to Spot Account - | 'INVALID' // Invalid Transaction - | 'MANUAL' // Manual Review Required - | 'PEND' // Processing - | 'REVIEW' // Under Compliance Review - | 'TRACK'; // Tracking Block Confirmations, Pending Spot Account Credit - chain: string; - refund_status?: // v4.106.95: Blocked deposit refund status - 'REFUNDING' | 'REFUNDED' | 'REFUND_FAILED' | 'REJECTED'; + /** Units. Mutually exclusive with amount. */ + copies?: string; + /** Custom order info, must start with t- */ + text?: string; } ⋮---- -| 'BLOCKED' // Deposit Blocked -| 'DEP_CREDITED' // Deposit Credited, Withdrawal Pending Unlock -| 'DONE' // Funds Credited to Spot Account -| 'INVALID' // Invalid Transaction -| 'MANUAL' // Manual Review Required -| 'PEND' // Processing -| 'REVIEW' // Under Compliance Review -| 'TRACK'; // Tracking Block Confirmations, Pending Spot Account Credit +/** Subscription amount. Mutually exclusive with copies. */ ⋮---- -refund_status?: // v4.106.95: Blocked deposit refund status +/** Units. Mutually exclusive with amount. */ ⋮---- -export interface CreateDepositAddressResp { - currency: string; - address: string; - multichain_addresses: { - chain: string; - address: string; - payment_id: string; - payment_name: string; - obtain_failed: number; - }[]; +/** Custom order info, must start with t- */ +⋮---- +/**========================================================================================================================== + * EARN FIXED-TERM + * ========================================================================================================================== + */ +⋮---- +export interface GetEarnFixedTermProductsReq { + asset?: string; + type?: number; // 1 regular, 2 VIP + page: number; + limit: number; } ⋮---- -export interface SubAccountTransferRecord { - currency: string; - sub_account: string; - direction: 'to' | 'from'; +type?: number; // 1 regular, 2 VIP +⋮---- +export interface GetEarnFixedTermProductsByAssetReq { + /** Product type: "" or 1 regular, 2 VIP, 0 all */ + type?: string; +} +⋮---- +/** Product type: "" or 1 regular, 2 VIP, 0 all */ +⋮---- +export interface CreateEarnFixedTermLendReq { + product_id: number; amount: string; - uid: string; - client_order_id: string; - timest: string; - source: string; - sub_account_type: 'spot' | 'futures' | 'cross_margin' | 'delivery'; + year_rate?: string; + reinvest_status?: number; // 0 off, 1 on + redeem_account_type?: number; // 1 spot + financial_rate_id?: number; // interest boost coupon id, 0 = none + sub_business?: number; } ⋮---- -export interface WithdrawalStatus { - currency: string; - name: string; - name_cn: string; - deposit: string; - withdraw_percent: string; - withdraw_fix: string; - withdraw_day_limit: string; - withdraw_amount_mini: string; - withdraw_day_limit_remain: string; - withdraw_eachtime_limit: string; - withdraw_fix_on_chains: { [key: string]: string }; - withdraw_percent_on_chains: { [key: string]: string }; +reinvest_status?: number; // 0 off, 1 on +redeem_account_type?: number; // 1 spot +financial_rate_id?: number; // interest boost coupon id, 0 = none +⋮---- +export interface GetEarnFixedTermLendsReq { + product_id?: number; + order_id?: number; + asset?: string; + order_type: '1' | '2'; // 1 current, 2 historical + page: number; + limit: number; + sub_business?: number; + business_filter?: string; } ⋮---- -export interface SubAccountMarginBalance { - currency_pair: string; - locked: boolean; - risk: string; - base: { - currency: string; - available: string; - locked: string; - borrowed: string; - interest: string; - }; - quote: { - currency: string; - available: string; - locked: string; - borrowed: string; - interest: string; - }; +order_type: '1' | '2'; // 1 current, 2 historical +⋮---- +export interface EarnFixedTermPreRedeemReq { + order_id: string; } ⋮---- -export interface SubAccountFuturesBalancesResp { - uid: string; - available: { - [key: string]: { - total: string; - unrealised_pnl: string; - position_margin: string; - order_margin: string; - available: string; - point: string; - currency: string; - in_dual_mode: boolean; - enable_credit: boolean; - position_initial_margin: string; - maintenance_margin: string; - bonus: string; - enable_evolved_classic: boolean; - cross_order_margin: string; - cross_initial_margin: string; - cross_maintenance_margin: string; - cross_unrealised_pnl: string; - cross_available: string; - isolated_position_margin: string; - history: { - dnw: string; - pnl: string; - fee: string; - refr: string; - fund: string; - point_dnw: string; - point_fee: string; - point_refr: string; - bonus_dnw: string; - bonus_offset: string; - }; - }; - }; +export interface GetEarnFixedTermHistoryReq { + product_id?: number; + order_id?: string; + asset?: string; + type: '1' | '2' | '3' | '4'; // 1 subscribe, 2 redeem, 3 interest, 4 bonus + page: number; + limit: number; + start_at?: number; + end_at?: number; + sub_business?: number; + business_filter?: string; } ⋮---- -export interface SubAccountCrossMarginBalancesResp { - uid: string; - available: { - user_id: number; - locked: boolean; - balances: { - [key: string]: { - available: string; - freeze: string; - borrowed: string; - interest: string; - }; - }; - total: string; - borrowed: string; - borrowed_net: string; - net: string; - leverage: string; - interest: string; - risk: string; - total_initial_margin: string; - total_margin_balance: string; - total_maintenance_margin: string; - total_initial_margin_rate: string; - total_maintenance_margin_rate: string; - total_available_margin: string; - }; +type: '1' | '2' | '3' | '4'; // 1 subscribe, 2 redeem, 3 interest, 4 bonus + +================ +File: src/types/response/crossex.ts +================ +/**========================================================================================================================== + * CROSSEX + * ========================================================================================================================== + */ +⋮---- +export interface CrossExSymbol { + symbol: string; + exchange_type: string; + business_type: string; + state: string; + min_size: string; + min_notional: string; + lot_size: string; + tick_size: string; + max_num_orders: string; + max_market_size: string; + max_limit_size: string; + contract_size: string; + liquidation_fee: string; + delist_time: string; + support_rpi?: string; // true/false whether RPI orders are supported } ⋮---- -export interface SavedAddress { - currency: string; - chain: string; - address: string; - name: string; - tag: string; - verified: string; +support_rpi?: string; // true/false whether RPI orders are supported +⋮---- +export interface CrossExRiskLimitTier { + min_risk_limit_value: string; // Minimum risk limit value + max_risk_limit_value: string; // Maximum risk limit value + leverage_max: string; // Maximum leverage + maintenance_rate: string; // Maintenance margin rate + tier: string; // Tier + quick_cal_amount: string; // Quick-calculation amount for this risk tier } ⋮---- -export interface TradingFees { - user_id: number; - taker_fee: string; - maker_fee: string; - gt_discount: boolean; - gt_taker_fee: string; - gt_maker_fee: string; - loan_fee: string; - point_type: string; - futures_taker_fee: string; - futures_maker_fee: string; - delivery_taker_fee: string; - delivery_maker_fee: string; - debit_fee: number; +min_risk_limit_value: string; // Minimum risk limit value +max_risk_limit_value: string; // Maximum risk limit value +leverage_max: string; // Maximum leverage +maintenance_rate: string; // Maintenance margin rate +tier: string; // Tier +quick_cal_amount: string; // Quick-calculation amount for this risk tier +⋮---- +export interface CrossExRiskLimit { + symbol: string; + tiers: CrossExRiskLimitTier[]; } ⋮---- -export interface GetBalancesResp { - total: { - amount: string; - currency: string; - unrealised_pnl?: string; - borrowed?: string; - }; - details: { - [key: string]: { - amount: string; - currency: string; - unrealised_pnl?: string; - borrowed?: string; - }; - }; +export interface CrossExTransferCoin { + coin: string; // Currency + min_trans_amount: number; // Minimum Transfer Quantity (including estimated fees) + est_fee: number; // Estimated Fee + precision: number; // Precision + is_disabled: number; // If it is disabled. 0 means NOT being disabled } ⋮---- -export interface SmallBalanceRecord { - currency: string; - available_balance: string; - estimated_as_btc: string; - convertible_to_gt: string; +coin: string; // Currency +min_trans_amount: number; // Minimum Transfer Quantity (including estimated fees) +est_fee: number; // Estimated Fee +precision: number; // Precision +is_disabled: number; // If it is disabled. 0 means NOT being disabled +⋮---- +export interface CreateCrossExTransferResp { + tx_id: string; // Order ID + text: string; // User-defined Order ID } ⋮---- -export interface SmallBalanceHistoryRecord { - id: string; - currency: string; - amount: string; - gt_amount: string; - create_time: number; +tx_id: string; // Order ID +text: string; // User-defined Order ID +⋮---- +export interface CrossExTransferHistory { + id: string; // Order ID + text: string; // Client Custom ID + from_account_type: string; // Source from account (CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX, SPOT) + to_account_type: string; + coin: string; // Currency + amount: string; // Transfer amount, the amount requested for the transfer + actual_receive: string; // Actual credited amount (has a value when status = SUCCESS; empty for other statuses) + status: string; // Transfer Status - FAIL: Failed, SUCCESS: Successful, PENDING: Transfer in Progress + fail_reason: string; // Failure reason (has a value when status = FAIL; empty for other statuses) + create_time: number; // Creation time of order + update_time: number; // Order Update Time } ⋮---- -export interface PushOrder { - id: string; - push_uid: number; - receive_uid: number; - currency: string; - amount: string; - create_time: number; - status: - | 'CREATING' - | 'PENDING' - | 'CANCELLING' - | 'CANCELLED' - | 'REFUSING' - | 'REFUSED' - | 'RECEIVING' - | 'RECEIVED'; - message: string; +id: string; // Order ID +text: string; // Client Custom ID +from_account_type: string; // Source from account (CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX, SPOT) +⋮---- +coin: string; // Currency +amount: string; // Transfer amount, the amount requested for the transfer +actual_receive: string; // Actual credited amount (has a value when status = SUCCESS; empty for other statuses) +status: string; // Transfer Status - FAIL: Failed, SUCCESS: Successful, PENDING: Transfer in Progress +fail_reason: string; // Failure reason (has a value when status = FAIL; empty for other statuses) +create_time: number; // Creation time of order +update_time: number; // Order Update Time +⋮---- +export interface CreateCrossExOrderResp { + order_id: number | string; + text: string; // User-defined Order ID } - -================ -File: src/types/response/withdrawal.ts -================ -export interface WithdrawalRecord { - id: string; - txid: string; - block_number: string; - withdraw_order_id: string; - /** When `status` is DONE, withdrawal success time (not conditioned on `block_number`). */ - timestamp: string; - amount: string; - currency: string; - address: string; - memo?: string; - status: - | 'BCODE' // Deposit Code Operation - | 'CANCEL' // Cancelled - | 'CANCELPEND' // Withdrawal Cancellation Pending - | 'DMOVE' // Pending Manual Review - | 'DONE' // Completed - | 'EXTPEND' // Sent and Waiting for Confirmation - | 'FAIL' // On-Chain Failure Pending Confirmation - | 'FVERIFY' // Facial Verification in Progress - | 'INVALID' // Invalid Transaction - | 'LOCKED' // Wallet-Side Order Locked - | 'MANUAL' // Pending Manual Review - | 'PEND' // Processing - | 'PROCES' // Processing - | 'REJECT' // Rejected - | 'REQUEST' // Request in Progress - | 'REVIEW' // Under Review - | 'SPLITPEND' // Split Pending - | 'VERIFY'; // Verification in Progress - chain: string; +⋮---- +text: string; // User-defined Order ID +⋮---- +export interface CancelCrossExOrderResp { + order_id: number; + text: string; } ⋮---- -/** When `status` is DONE, withdrawal success time (not conditioned on `block_number`). */ +export interface ModifyCrossExOrderResp { + order_id: number; + text: string; +} ⋮---- -| 'BCODE' // Deposit Code Operation -| 'CANCEL' // Cancelled -| 'CANCELPEND' // Withdrawal Cancellation Pending -| 'DMOVE' // Pending Manual Review -| 'DONE' // Completed -| 'EXTPEND' // Sent and Waiting for Confirmation -| 'FAIL' // On-Chain Failure Pending Confirmation -| 'FVERIFY' // Facial Verification in Progress -| 'INVALID' // Invalid Transaction -| 'LOCKED' // Wallet-Side Order Locked -| 'MANUAL' // Pending Manual Review -| 'PEND' // Processing -| 'PROCES' // Processing -| 'REJECT' // Rejected -| 'REQUEST' // Request in Progress -| 'REVIEW' // Under Review -| 'SPLITPEND' // Split Pending -| 'VERIFY'; // Verification in Progress - -================ -File: src/types/websockets/client.ts -================ -import type { ClientRequestArgs } from 'http'; -import WebSocket from 'isomorphic-ws'; +export interface CrossExOrder { + user_id: string; // User ID + order_id: string; // Order ID + text: string; // Client Order ID + state: string; // Order Status + symbol: string; // Currency pair + side: string; // direction + type: string; // type + attribute: string; // COMMON, LIQ, REDUCE, ADL, SETTLEMENT + exchange_type: string; // Exchange + business_type: string; // Business Type + qty: string; // Base Currency Quantity + quote_qty: string; // Quote Currency Quantity + price: string; // Price + time_in_force: string; // Time in Force Strategy + executed_qty: string; // Filled Quantity + executed_amount: string; // Filled Amount + executed_avg_price: string; // Average Filled Price + fee_coin: string; // Fee currency + fee: string; // fee + reduce_only: string; // Reduce Position Only + leverage: string; // leverage + reason: string; // Reason + last_executed_qty: string; // Latest Filled Quantity + last_executed_price: string; // Latest Filled Price + last_executed_amount: string; // Latest Filled Amount + position_side: string; // Position Direction + create_time: string; // Created time + update_time: string; // Update time +} ⋮---- -/** - * Event args for subscribing/unsubscribing - */ +user_id: string; // User ID +order_id: string; // Order ID +text: string; // Client Order ID +state: string; // Order Status +symbol: string; // Currency pair +side: string; // direction +type: string; // type +attribute: string; // COMMON, LIQ, REDUCE, ADL, SETTLEMENT +exchange_type: string; // Exchange +business_type: string; // Business Type +qty: string; // Base Currency Quantity +quote_qty: string; // Quote Currency Quantity +price: string; // Price +time_in_force: string; // Time in Force Strategy +executed_qty: string; // Filled Quantity +executed_amount: string; // Filled Amount +executed_avg_price: string; // Average Filled Price +fee_coin: string; // Fee currency +fee: string; // fee +reduce_only: string; // Reduce Position Only +leverage: string; // leverage +reason: string; // Reason +last_executed_qty: string; // Latest Filled Quantity +last_executed_price: string; // Latest Filled Price +last_executed_amount: string; // Latest Filled Amount +position_side: string; // Position Direction +create_time: string; // Created time +update_time: string; // Update time ⋮---- -// export type WsTopicSubscribePrivateArgsV2 = -// | WsTopicSubscribePrivateInstIdArgsV2 -// | WsTopicSubscribePrivateCoinArgsV2; +export interface CreateCrossExConvertQuoteResp { + quote_id: string; // Quote ID + valid_ms: string; // Valid time (milliseconds timestamp) + from_coin: string; // Asset Sold + to_coin: string; // Asset Bought + from_amount: string; // Amount to sell + to_amount: string; // Amount to buy + price: string; // Price +} ⋮---- -// export type WsTopicSubscribeEventArgsV2 = -// | WsTopicSubscribePublicArgsV2 -// | WsTopicSubscribePrivateArgsV2; +quote_id: string; // Quote ID +valid_ms: string; // Valid time (milliseconds timestamp) +from_coin: string; // Asset Sold +to_coin: string; // Asset Bought +from_amount: string; // Amount to sell +to_amount: string; // Amount to buy +price: string; // Price ⋮---- -/** General configuration for the WebsocketClient */ -export interface WSClientConfigurableOptions { - /** Your API key */ - apiKey?: string; - - /** Your API secret */ - apiSecret?: string; - - useTestnet?: boolean; - - /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ - recvWindow?: number; - - /** How often to check if the connection is alive */ - pingInterval?: number; - - /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ - pongTimeout?: number; - - /** Delay in milliseconds before respawning the connection */ - reconnectTimeout?: number; - - requestOptions?: {}; - - wsUrl?: string; - - wsOptions?: { - protocols?: string[]; - agent?: any; - } & Partial; - - /** - * 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; - - /** - * If you authenticated the WS API before, automatically try to re-authenticate the WS API if you're disconnected/reconnected for any reason. - */ - reauthWSAPIOnReconnect?: boolean; +export interface CreateCrossExConvertOrderResp { + order_id: string; // Order ID + text: string; // User-defined order ID text } ⋮---- -/** Your API key */ -⋮---- -/** Your API secret */ +order_id: string; // Order ID +text: string; // User-defined order ID text ⋮---- -/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ +export interface UpdateCrossExAccountResp { + position_mode: string; // Requested futures position mode to modify (SINGLE/DUAL) + account_mode: string; // Requested account mode to modify (CROSS_EXCHANGE/ISOLATED_EXCHANGE, default: CROSS_EXCHANGE) + exchange_type: string; // Requested exchange to modify (BINANCE/OKX/GATE/BYBIT/CROSSEX) +} ⋮---- -/** How often to check if the connection is alive */ +position_mode: string; // Requested futures position mode to modify (SINGLE/DUAL) +account_mode: string; // Requested account mode to modify (CROSS_EXCHANGE/ISOLATED_EXCHANGE, default: CROSS_EXCHANGE) +exchange_type: string; // Requested exchange to modify (BINANCE/OKX/GATE/BYBIT/CROSSEX) ⋮---- -/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ +export interface CrossExAccountAsset { + user_id: string; // User ID + coin: string; // Currency + exchange_type: string; // Exchange + balance: string; // Balance + upnl: string; // Unrealized P&L + equity: string; // Equity (only USDT has a value; other assets are 0) + futures_initial_margin: string; // Futures initial margin (only USDT has a value; other assets are 0) + futures_maintenance_margin: string; // Futures maintenance margin (only USDT has a value; other assets are 0) + borrowing_initial_margin: string; // Margin trading initial margin (only USDT has a value; other assets are 0) + borrowing_maintenance_margin: string; // Margin trading maintenance margin (only USDT has a value; other assets are 0) + available_balance: string; // Available Balance + liability: string; // Liabilities (only meaningful in isolated exchange mode; always 0 in cross-exchange mode) +} ⋮---- -/** Delay in milliseconds before respawning the connection */ +user_id: string; // User ID +coin: string; // Currency +exchange_type: string; // Exchange +balance: string; // Balance +upnl: string; // Unrealized P&L +equity: string; // Equity (only USDT has a value; other assets are 0) +futures_initial_margin: string; // Futures initial margin (only USDT has a value; other assets are 0) +futures_maintenance_margin: string; // Futures maintenance margin (only USDT has a value; other assets are 0) +borrowing_initial_margin: string; // Margin trading initial margin (only USDT has a value; other assets are 0) +borrowing_maintenance_margin: string; // Margin trading maintenance margin (only USDT has a value; other assets are 0) +available_balance: string; // Available Balance +liability: string; // Liabilities (only meaningful in isolated exchange mode; always 0 in cross-exchange mode) ⋮---- -/** - * 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 CrossExAccount { + user_id: string; // User ID + available_margin: string; // Available Margin + margin_balance: string; // margin balance + initial_margin: string; // Initial Margin + maintenance_margin: string; // Maintenance margin + initial_margin_rate: string; // Initial margin rate + maintenance_margin_rate: string; // Maintenance margin rate + position_mode: string; // Contract Position Mode + account_limit: string; // Account limit + create_time: string; // Created time + update_time: string; // Update time + account_mode: string; // Account mode. CROSS_EXCHANGE: cross-exchange mode. ISOLATED_EXCHANGE: isolated exchange mode + exchange_type: string; // Exchange type. When account_mode is CROSS_EXCHANGE, this must be CROSSEX; otherwise, it represents a specific exchange + assets: CrossExAccountAsset[]; +} ⋮---- -/** - * If you authenticated the WS API before, automatically try to re-authenticate the WS API if you're disconnected/reconnected for any reason. - */ +user_id: string; // User ID +available_margin: string; // Available Margin +margin_balance: string; // margin balance +initial_margin: string; // Initial Margin +maintenance_margin: string; // Maintenance margin +initial_margin_rate: string; // Initial margin rate +maintenance_margin_rate: string; // Maintenance margin rate +position_mode: string; // Contract Position Mode +account_limit: string; // Account limit +create_time: string; // Created time +update_time: string; // Update time +account_mode: string; // Account mode. CROSS_EXCHANGE: cross-exchange mode. ISOLATED_EXCHANGE: isolated exchange mode +exchange_type: string; // Exchange type. When account_mode is CROSS_EXCHANGE, this must be CROSSEX; otherwise, it represents a specific exchange ⋮---- -/** - * WS configuration that's always defined, regardless of user configuration - * (usually comes from defaults if there's no user-provided values) - */ -export interface WebsocketClientOptions extends WSClientConfigurableOptions { - pingInterval: number; - pongTimeout: number; - reconnectTimeout: number; - recvWindow: number; - authPrivateConnectionsOnConnect: boolean; - authPrivateRequests: boolean; - reauthWSAPIOnReconnect: boolean; +export interface SetCrossExPositionLeverageResp { + symbol: string; // Currency pair + leverage: string; // Requested Modified Leverage } - -================ -File: webpack/webpack.config.cjs -================ -function generateConfig(name) ⋮---- -// Add '.ts' and '.tsx' as resolvable extensions. +symbol: string; // Currency pair +leverage: string; // Requested Modified Leverage ⋮---- -// 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 CrossExPositionLeverage { + symbol: string; // Currency pair + leverage: number | string; +} ⋮---- -// Code is already transpiled from TypeScript, no additional loaders needed - -================ -File: src/types/request/crossex.ts -================ -/**========================================================================================================================== - * CROSSEX - * ========================================================================================================================== - */ +symbol: string; // Currency pair ⋮---- -export interface GetCrossExSymbolsReq { - symbols?: string; // Trading Pair List, multiple separated by commas +export interface SetCrossExMarginPositionLeverageResp { + symbol: string; // Currency pair + leverage: string; // Requested Modified Leverage } ⋮---- -symbols?: string; // Trading Pair List, multiple separated by commas +symbol: string; // Currency pair +leverage: string; // Requested Modified Leverage ⋮---- -export interface GetCrossExRiskLimitsReq { - symbols: string; // Trading Pair List, multiple separated by commas +export interface CrossExMarginPositionLeverage { + symbol: string; // Currency pair + leverage: number | string; } ⋮---- -symbols: string; // Trading Pair List, multiple separated by commas +symbol: string; // Currency pair ⋮---- -export interface GetCrossExTransferCoinsReq { - coin?: string; // Currency +export interface CloseCrossExPositionResp { + order_id: string; // Order ID + text: string; // User-defined Order ID } ⋮---- -coin?: string; // Currency +order_id: string; // Order ID +text: string; // User-defined Order ID ⋮---- -export interface CreateCrossExTransferReq { +export interface CrossExInterestRate { coin: string; // Currency - amount: string; // Transfer amount - from: string; // CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX_KRAKEN, CROSSEX, SPOT, etc. - to: string; - text?: string; // User-defined ID + exchange_type: string; // Exchange + hour_interest_rate: string; // Hourly Interest Rate + time: string; // Millisecond Timestamp } ⋮---- coin: string; // Currency -amount: string; // Transfer amount -from: string; // CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX_KRAKEN, CROSSEX, SPOT, etc. -⋮---- -text?: string; // User-defined ID +exchange_type: string; // Exchange +hour_interest_rate: string; // Hourly Interest Rate +time: string; // Millisecond Timestamp ⋮---- -export interface GetCrossExTransferHistoryReq { - coin?: string; // Query by specified currency name - order_id?: string; // Supports querying by the order ID returned when creating an order (tx_id), as well as a user-defined custom ID specified at creation (text) - from?: number; // Start timestamp for the query - to?: number; // End timestamp for the query, defaults to current time if not specified - page?: number; // Page number - limit?: number; // Maximum number returned by list, max 1000 +export interface CrossExSpecialFee { + symbol: string; // Currency pair + taker_fee_rate: string; // Taker fee rate + maker_fee_rate: string; // Maker fee rate + rpi_fee_rate?: string; // RPI order maker fee rate } ⋮---- -coin?: string; // Query by specified currency name -order_id?: string; // Supports querying by the order ID returned when creating an order (tx_id), as well as a user-defined custom ID specified at creation (text) -from?: number; // Start timestamp for the query -to?: number; // End timestamp for the query, defaults to current time if not specified -page?: number; // Page number -limit?: number; // Maximum number returned by list, max 1000 +symbol: string; // Currency pair +taker_fee_rate: string; // Taker fee rate +maker_fee_rate: string; // Maker fee rate +rpi_fee_rate?: string; // RPI order maker fee rate ⋮---- -export interface CreateCrossExOrderReq { - text?: string; // Client-defined Order ID, supports letters (a-z), numbers (0-9), symbols (-, _) only - symbol: string; // Unique identifier Exchange_Business_Base_Counter - side: 'BUY' | 'SELL'; - type?: 'LIMIT' | 'MARKET'; // Order type (default: LIMIT) - time_in_force?: 'GTC' | 'IOC' | 'FOK' | 'POC'; // Default GTC - qty?: string; // Order quantity (required unless spot market buy) - price?: string; // Limit Order Price (Required for Limit Orders) - quote_qty?: string; // Order quote quantity; required for spot and margin market buy orders - reduce_only?: 'true' | 'false'; // Reduce-only - position_side?: 'LONG' | 'SHORT' | 'NONE'; // Position side, defaults to NONE (single position mode) if not specified +export interface CrossExFeeRate { + exchange_type: string; // Exchange (e.g. BINANCE, OKX, GATE, BYBIT) + spot_maker_fee: string; // spot Maker fee rate + spot_taker_fee: string; // spot Taker fee rate + spot_rpi_maker_fee?: string; // Spot RPI order maker fee rate + future_maker_fee: string; // contract Maker fee rate + future_taker_fee: string; // contract Taker fee rate + future_rpi_maker_fee?: string; // Futures RPI order maker fee rate + special_fee_list: CrossExSpecialFee[]; } ⋮---- -text?: string; // Client-defined Order ID, supports letters (a-z), numbers (0-9), symbols (-, _) only -symbol: string; // Unique identifier Exchange_Business_Base_Counter -⋮---- -type?: 'LIMIT' | 'MARKET'; // Order type (default: LIMIT) -time_in_force?: 'GTC' | 'IOC' | 'FOK' | 'POC'; // Default GTC -qty?: string; // Order quantity (required unless spot market buy) -price?: string; // Limit Order Price (Required for Limit Orders) -quote_qty?: string; // Order quote quantity; required for spot and margin market buy orders -reduce_only?: 'true' | 'false'; // Reduce-only -position_side?: 'LONG' | 'SHORT' | 'NONE'; // Position side, defaults to NONE (single position mode) if not specified +exchange_type: string; // Exchange (e.g. BINANCE, OKX, GATE, BYBIT) +spot_maker_fee: string; // spot Maker fee rate +spot_taker_fee: string; // spot Taker fee rate +spot_rpi_maker_fee?: string; // Spot RPI order maker fee rate +future_maker_fee: string; // contract Maker fee rate +future_taker_fee: string; // contract Taker fee rate +future_rpi_maker_fee?: string; // Futures RPI order maker fee rate ⋮---- -export interface ModifyCrossExOrderReq { - qty?: string; // modify amount - price?: string; // modify price +export interface CrossExMarketTicker { + symbol: string; + last_price: string; + open_24h: string; + low_24h: string; + high_24h: string; + volume_24h_base: string; + volume_24h_quote: string; + mark_price: string; + index_price: string; + open_interest: string; + open_interest_quote: string; + timestamp: string; } ⋮---- -qty?: string; // modify amount -price?: string; // modify price -⋮---- -export interface CreateCrossExConvertQuoteReq { - exchange_type: string; // Exchange Type - from_coin: string; // Asset Sold - to_coin: string; // Asset name to buy (OKX and GATE only allow BTC, ETH, USDT; BN only allows USDT) - from_amount: string; // Amount to sell +export interface CrossExMarketFundingInfo { + symbol: string; + funding_rate: string; + funding_interval: string; + funding_time: string; // Next funding time } ⋮---- -exchange_type: string; // Exchange Type -from_coin: string; // Asset Sold -to_coin: string; // Asset name to buy (OKX and GATE only allow BTC, ETH, USDT; BN only allows USDT) -from_amount: string; // Amount to sell +funding_time: string; // Next funding time ⋮---- -export interface CreateCrossExConvertOrderReq { - quote_id: string; // Inquiry ID +export interface CancelBatchCrossExOrdersResp { + order_id: string; + text: string; + accepted: string; // "true" | "false" + label: string; + message: string; } ⋮---- -quote_id: string; // Inquiry ID +accepted: string; // "true" | "false" ⋮---- -export interface UpdateCrossExAccountReq { - position_mode?: string; // Futures position mode (SINGLE/DUAL) - account_mode?: string; // Account mode (CROSS_EXCHANGE/ISOLATED_EXCHANGE, default: CROSS_EXCHANGE) - exchange_type?: string; // Exchange (BINANCE/OKX/GATE/BYBIT/CROSSEX) +export interface CrossExPosition { + user_id: string; // User ID + position_id: string; // Position ID + symbol: string; // Currency pair + position_side: string; // Position Direction + initial_margin: string; // Initial Margin + maintenance_margin: string; // Maintenance margin + position_qty: string; // Position Quantity + position_value: string; // Position Value + upnl: string; // Unrealized P&L + upnl_rate: string; // Unrealized P&L Ratio + entry_price: string; // Position Average Entry Price + mark_price: string; // Mark price + leverage: string; // Position Leverage + max_leverage: string; // Maximum leverage + risk_limit: string; // Position risk limit + fee: string; // Position Fee + funding_fee: string; // Position Funding Fee + funding_time: string; // Position funding fee collection time (0 indicates it has not been collected yet) + create_time: string; // Position Creation Time + update_time: string; // Position Update Time + closed_pnl: string; // Realized PnL } ⋮---- -position_mode?: string; // Futures position mode (SINGLE/DUAL) -account_mode?: string; // Account mode (CROSS_EXCHANGE/ISOLATED_EXCHANGE, default: CROSS_EXCHANGE) -exchange_type?: string; // Exchange (BINANCE/OKX/GATE/BYBIT/CROSSEX) +user_id: string; // User ID +position_id: string; // Position ID +symbol: string; // Currency pair +position_side: string; // Position Direction +initial_margin: string; // Initial Margin +maintenance_margin: string; // Maintenance margin +position_qty: string; // Position Quantity +position_value: string; // Position Value +upnl: string; // Unrealized P&L +upnl_rate: string; // Unrealized P&L Ratio +entry_price: string; // Position Average Entry Price +mark_price: string; // Mark price +leverage: string; // Position Leverage +max_leverage: string; // Maximum leverage +risk_limit: string; // Position risk limit +fee: string; // Position Fee +funding_fee: string; // Position Funding Fee +funding_time: string; // Position funding fee collection time (0 indicates it has not been collected yet) +create_time: string; // Position Creation Time +update_time: string; // Position Update Time +closed_pnl: string; // Realized PnL ⋮---- -export interface GetCrossExAccountsReq { - exchange_type?: string; // Exchange. Not required in cross-exchange mode; required in single-exchange mode (BINANCE/OKX/GATE/BYBIT) +export interface CrossExMarginPosition { + user_id: string; // User ID + position_id: string; // Leveraged Position ID + symbol: string; // Trading Pair + position_side: string; // Position Direction + initial_margin: string; // Initial position margin + maintenance_margin: string; // Position maintenance margin + asset_qty: string; // Position Asset Quantity + asset_coin: string; // Position Asset Currency + position_value: string; // Position Value + liability: string; // Debt Quantity + liability_coin: string; // Debt Currency + interest: string; // Deducted Interest + max_position_qty: string; // Max Trade Size + entry_price: string; // Position Cost Price (Average Opening Price) + index_price: string; // Index price + upnl: string; // Unrealized P&L + upnl_rate: string; // Unrealized P&L Ratio + leverage: string; // Opening Leverage + max_leverage: string; // Maximum leverage + create_time: string; // Created time + update_time: string; // Update time } ⋮---- -exchange_type?: string; // Exchange. Not required in cross-exchange mode; required in single-exchange mode (BINANCE/OKX/GATE/BYBIT) +user_id: string; // User ID +position_id: string; // Leveraged Position ID +symbol: string; // Trading Pair +position_side: string; // Position Direction +initial_margin: string; // Initial position margin +maintenance_margin: string; // Position maintenance margin +asset_qty: string; // Position Asset Quantity +asset_coin: string; // Position Asset Currency +position_value: string; // Position Value +liability: string; // Debt Quantity +liability_coin: string; // Debt Currency +interest: string; // Deducted Interest +max_position_qty: string; // Max Trade Size +entry_price: string; // Position Cost Price (Average Opening Price) +index_price: string; // Index price +upnl: string; // Unrealized P&L +upnl_rate: string; // Unrealized P&L Ratio +leverage: string; // Opening Leverage +max_leverage: string; // Maximum leverage +create_time: string; // Created time +update_time: string; // Update time ⋮---- -export interface SetCrossExPositionLeverageReq { +export interface CrossExAdlRank { + user_id: string; // User ID symbol: string; // Currency pair - leverage: string; // leverage + crossex_adl_rank: string; // CROSSEX position-reduction indicator ranking (1–5, higher value ranks higher) + exchange_adl_rank: string; // Original exchange information (Binance: 0–4, higher value ranks higher; OKX: 0–5, higher value ranks higher; Gate: 1–5, lower value ranks higher) } ⋮---- +user_id: string; // User ID symbol: string; // Currency pair -leverage: string; // leverage +crossex_adl_rank: string; // CROSSEX position-reduction indicator ranking (1–5, higher value ranks higher) +exchange_adl_rank: string; // Original exchange information (Binance: 0–4, higher value ranks higher; OKX: 0–5, higher value ranks higher; Gate: 1–5, lower value ranks higher) ⋮---- -export interface GetCrossExPositionLeverageReq { - symbols?: string; // Trading Pair List, multiple separated by commas +export interface CrossExHistoryPosition { + position_id: string; // Position ID + user_id: string; // User ID + symbol: string; // Currency pair + closed_type: string; // Position close type (PARTIAL_CLOSED: partially closed; COMPLETE_CLOSED: fully closed) + closed_pnl: string; // Close Position P&L + closed_pnl_rate: string; // Close Position P&L Ratio + open_avg_price: string; // Average Opening Price + closed_avg_price: string; // Average Close Price + max_position_qty: string; // Max Trade Size + closed_qty: string; // Close Position Quantity + closed_value: string; // Close Position Value + fee: string; // Position Accumulated Fees + liq_fee: string; // Liquidation Fee + funding_fee: string; // Funding Fee + position_side: string; // Position Direction Before Close + position_mode: string; // Position Mode at Close + leverage: string; // Leverage at Close + business_type: string; // Business Type + create_time: string; // Created time + update_time: string; // Update time } ⋮---- -symbols?: string; // Trading Pair List, multiple separated by commas +position_id: string; // Position ID +user_id: string; // User ID +symbol: string; // Currency pair +closed_type: string; // Position close type (PARTIAL_CLOSED: partially closed; COMPLETE_CLOSED: fully closed) +closed_pnl: string; // Close Position P&L +closed_pnl_rate: string; // Close Position P&L Ratio +open_avg_price: string; // Average Opening Price +closed_avg_price: string; // Average Close Price +max_position_qty: string; // Max Trade Size +closed_qty: string; // Close Position Quantity +closed_value: string; // Close Position Value +fee: string; // Position Accumulated Fees +liq_fee: string; // Liquidation Fee +funding_fee: string; // Funding Fee +position_side: string; // Position Direction Before Close +position_mode: string; // Position Mode at Close +leverage: string; // Leverage at Close +business_type: string; // Business Type +create_time: string; // Created time +update_time: string; // Update time ⋮---- -export interface SetCrossExMarginPositionLeverageReq { +export interface CrossExHistoryMarginPosition { + position_id: string; // Position ID + user_id: string; // User ID symbol: string; // Currency pair - leverage: string; // leverage + closed_type: string; // Position close type (PARTIAL_CLOSED: partially closed; COMPLETE_CLOSED: fully closed) + closed_pnl: string; // Close Position P&L + closed_pnl_rate: string; // Close Position P&L Ratio + open_avg_price: string; // Average Opening Price + closed_avg_price: string; // Average Close Price + max_position_qty: string; // Max Trade Size + closed_qty: string; // Close Position Quantity + closed_value: string; // Close Position Value + liq_fee: string; // Liquidation Fee + position_side: string; // Position Direction Before Close + leverage: string; // Leverage at Close + interest: string; // Total Deducted Interest + business_type: string; // Position Business Type + create_time: string; // Created time + update_time: string; // Update time } ⋮---- +position_id: string; // Position ID +user_id: string; // User ID symbol: string; // Currency pair -leverage: string; // leverage -⋮---- -export interface GetCrossExMarginPositionLeverageReq { - symbols?: string; // Trading Pair List, multiple separated by commas -} -⋮---- -symbols?: string; // Trading Pair List, multiple separated by commas +closed_type: string; // Position close type (PARTIAL_CLOSED: partially closed; COMPLETE_CLOSED: fully closed) +closed_pnl: string; // Close Position P&L +closed_pnl_rate: string; // Close Position P&L Ratio +open_avg_price: string; // Average Opening Price +closed_avg_price: string; // Average Close Price +max_position_qty: string; // Max Trade Size +closed_qty: string; // Close Position Quantity +closed_value: string; // Close Position Value +liq_fee: string; // Liquidation Fee +position_side: string; // Position Direction Before Close +leverage: string; // Leverage at Close +interest: string; // Total Deducted Interest +business_type: string; // Position Business Type +create_time: string; // Created time +update_time: string; // Update time ⋮---- -export interface CloseCrossExPositionReq { +export interface CrossExHistoryMarginInterest { + userId: string; // User ID symbol: string; // Trading Pair - position_side?: string; // Position Direction + interest_id: string; // Interest Deduction ID + liability_id: string; // Debt Source ID, can be Order ID or Position ID + liability: string; // Debt Quantity + liability_coin: string; // Debt Currency + interest: string; // Interest + interest_rate: string; // interest rate + interest_type: string; // Interest deduction type (PERIODIC_POSITION: periodic position interest; PERIODIC_OPEN_ORDER: periodic open-order interest; PERIODIC_ISOLATED: hourly isolated debt interest; IMMEDIATE_OPEN_ORDER: interest charged on order opening) + create_time: string; // Created time + exchange_type: string; // Exchange } ⋮---- +userId: string; // User ID symbol: string; // Trading Pair -position_side?: string; // Position Direction -⋮---- -export interface GetCrossExInterestRateReq { - coin?: string; // Currency - exchange_type?: string; // Exchange -} -⋮---- -coin?: string; // Currency -exchange_type?: string; // Exchange -⋮---- -export interface GetCrossExPositionsReq { - symbol?: string; // Trading Pair - exchange_type?: string; // Exchange -} -⋮---- -symbol?: string; // Trading Pair -exchange_type?: string; // Exchange +interest_id: string; // Interest Deduction ID +liability_id: string; // Debt Source ID, can be Order ID or Position ID +liability: string; // Debt Quantity +liability_coin: string; // Debt Currency +interest: string; // Interest +interest_rate: string; // interest rate +interest_type: string; // Interest deduction type (PERIODIC_POSITION: periodic position interest; PERIODIC_OPEN_ORDER: periodic open-order interest; PERIODIC_ISOLATED: hourly isolated debt interest; IMMEDIATE_OPEN_ORDER: interest charged on order opening) +create_time: string; // Created time +exchange_type: string; // Exchange ⋮---- -export interface GetCrossExMarginPositionsReq { - symbol?: string; // Currency pair - exchange_type?: string; // Exchange +export interface CrossExHistoryTrade { + user_id: string; // User ID + transaction_id: string; // filled records ID + order_id: string; // Order ID + text: string; // User Order ID + symbol: string; // Currency pair + exchange_type: string; // Exchange + business_type: string; // Business Type + side: string; // Buy/Sell Direction + qty: string; // Trading size + price: string; // Fill Price + fee: string; // fee + fee_coin: string; // Fee currency + fee_rate: string; // Fee Rate + match_role: string; // Filled Role + rpnl: string; // Realized P&L + position_mode: string; // Position Mode + position_side: string; // Position Direction + create_time: string; // Created time } ⋮---- -symbol?: string; // Currency pair -exchange_type?: string; // Exchange +user_id: string; // User ID +transaction_id: string; // filled records ID +order_id: string; // Order ID +text: string; // User Order ID +symbol: string; // Currency pair +exchange_type: string; // Exchange +business_type: string; // Business Type +side: string; // Buy/Sell Direction +qty: string; // Trading size +price: string; // Fill Price +fee: string; // fee +fee_coin: string; // Fee currency +fee_rate: string; // Fee Rate +match_role: string; // Filled Role +rpnl: string; // Realized P&L +position_mode: string; // Position Mode +position_side: string; // Position Direction +create_time: string; // Created time ⋮---- -export interface GetCrossExAdlRankReq { - symbol: string; // Trading Pair +export interface CrossExAccountBook { + id: string; // Account Change Record ID + user_id: string; // User ID + business_id: string; // Business ID + type: string; // TRANSACTION, TRADING_FEE, FUNDING_FEE, LIQUIDATION_FEE, TRANSFER_IN, TRANSFER_OUT, BANKRUPT_COMPENSATION, AUTO_REPAY + exchange_type: string; // Exchange + coin: string; // Currency + change: string; // Change amount (positive indicates transfer in; negative indicates transfer out) + balance: string; // Balance after change + create_time: string; // Created time } ⋮---- -symbol: string; // Trading Pair +id: string; // Account Change Record ID +user_id: string; // User ID +business_id: string; // Business ID +type: string; // TRANSACTION, TRADING_FEE, FUNDING_FEE, LIQUIDATION_FEE, TRANSFER_IN, TRANSFER_OUT, BANKRUPT_COMPENSATION, AUTO_REPAY +exchange_type: string; // Exchange +coin: string; // Currency +change: string; // Change amount (positive indicates transfer in; negative indicates transfer out) +balance: string; // Balance after change +create_time: string; // Created time ⋮---- -export interface GetCrossExOpenOrdersReq { - symbol?: string; // Trading Pair - exchange_type?: string; // Exchange - business_type?: string; // Business Type +export interface CrossExCoinDiscountRate { + coin: string; // Currency + exchange_type: string; // Exchange + tier: string; // Tier + min_value: string; // Minimum value + max_value: string; // Maximum value + discount_rate: string; // Discount rate } ⋮---- -symbol?: string; // Trading Pair -exchange_type?: string; // Exchange -business_type?: string; // Business Type +coin: string; // Currency +exchange_type: string; // Exchange +tier: string; // Tier +min_value: string; // Minimum value +max_value: string; // Maximum value +discount_rate: string; // Discount rate + +================ +File: src/types/response/otc.ts +================ +/**========================================================================================================================== + * OTC + * ========================================================================================================================== + */ ⋮---- -export interface GetCrossExHistoryOrdersReq { - page?: number; // Page number - limit?: number; // Maximum number of records returned in a single list - symbol?: string; - from?: number; // Start Millisecond Timestamp - to?: number; // End Millisecond Timestamp - /** Comma-separated: COMMON, LIQ, REDUCE, ADL, SETTLEMENT */ - attributes?: string; +export interface OTCActionResp { + code: number; + message: string; + timestamp: number; } ⋮---- -page?: number; // Page number -limit?: number; // Maximum number of records returned in a single list -⋮---- -from?: number; // Start Millisecond Timestamp -to?: number; // End Millisecond Timestamp -/** Comma-separated: COMMON, LIQ, REDUCE, ADL, SETTLEMENT */ -⋮---- -export interface GetCrossExHistoryPositionsReq { - page?: number; // Page number - limit?: number; // Maximum number returned by list, max 1000 - symbol?: string; - from?: number; // Start Millisecond Timestamp - to?: number; // End Millisecond Timestamp +export interface CreateOTCQuoteResp { + code: number; + message: string; + data: { + type: string; // BUY (on-ramp) or SELL (off-ramp) + pay_coin: string; + get_coin: string; + pay_amount: string; + get_amount: string; + rate: string; + rate_reci: string; // Reciprocal of the exchange rate + promotion_code: string; + side: string; + order_type: string; // FIAT or STABLE + quote_token: string; // Quote token required when placing an order + url?: string; + memo?: string; + has_signature?: string; + validity_period?: string; + ex_rate?: string; + usdc_rate?: string; + is_need_file?: string; + gate_bank_id?: string; + gate_bank_name?: string; + refresh_limit?: number; + refresh_limit_msg?: string; + }; + timestamp: number; } ⋮---- -page?: number; // Page number -limit?: number; // Maximum number returned by list, max 1000 -⋮---- -from?: number; // Start Millisecond Timestamp -to?: number; // End Millisecond Timestamp +type: string; // BUY (on-ramp) or SELL (off-ramp) ⋮---- -export interface GetCrossExHistoryMarginPositionsReq { - page?: number; // Page number - limit?: number; // Maximum number returned by list, max 1000 - symbol?: string; - from?: number; // Start Millisecond Timestamp - to?: number; // End Millisecond Timestamp -} +rate_reci: string; // Reciprocal of the exchange rate ⋮---- -page?: number; // Page number -limit?: number; // Maximum number returned by list, max 1000 +order_type: string; // FIAT or STABLE +quote_token: string; // Quote token required when placing an order ⋮---- -from?: number; // Start Millisecond Timestamp -to?: number; // End Millisecond Timestamp +export type CreateOTCFiatOrderResp = OTCActionResp; ⋮---- -export interface GetCrossExHistoryMarginInterestsReq { - symbol?: string; - from?: number; - to?: number; - page?: number; - limit?: number; - exchange_type?: string; +export interface CreateOTCStablecoinOrderResp { + code: number; + message: string; + timestamp: number; } ⋮---- -export interface GetCrossExHistoryTradesReq { - page?: number; // Page number - limit?: number; // Maximum number returned by list, max 1000 - symbol?: string; - from?: number; // Start Millisecond Timestamp - to?: number; // End Millisecond Timestamp +export interface OTCBankListItem { + id: string; // Bank ID (required for order placement) + bank_account_name: string; + bank_name: string; + bank_country?: string; + bank_address?: string; + bank_code?: string; + branch_code?: string; + iban?: string; + swift?: string; + remittance_line_number?: string; + agent_bank_name?: string; + agent_bank_swift?: string; + submit_time?: string; + update_time?: string; + status?: string; + documentation_file_type?: string; + memo?: string; + /** 1 = default bank card, 0 = not default */ + is_default?: 0 | 1; + bank_id?: string; + documentation_file_key_url?: string; } ⋮---- -page?: number; // Page number -limit?: number; // Maximum number returned by list, max 1000 +id: string; // Bank ID (required for order placement) ⋮---- -from?: number; // Start Millisecond Timestamp -to?: number; // End Millisecond Timestamp +/** 1 = default bank card, 0 = not default */ ⋮---- -export interface GetCrossExAccountBookReq { - page?: number; // Page number - limit?: number; // Maximum number returned by list, max 1000 - coin?: string; - from?: number; // Start Millisecond Timestamp - to?: number; // End Millisecond Timestamp +export interface GetOTCBankListResp { + code: number; + message: string; + data: { + lists: OTCBankListItem[]; + }; + timestamp: number; } ⋮---- -page?: number; // Page number -limit?: number; // Maximum number returned by list, max 1000 -⋮---- -from?: number; // Start Millisecond Timestamp -to?: number; // End Millisecond Timestamp -⋮---- -export interface GetCrossExCoinDiscountRateReq { - coin?: string; - exchange_type?: string; // OKX/GATE/BINANCE/BYBIT +export interface CreateOTCBankResp { + code: number; + message: string; + data: { + bank_id: number; + status: number; + }; + timestamp?: number; } ⋮---- -exchange_type?: string; // OKX/GATE/BINANCE/BYBIT - -================ -File: src/types/request/earn.ts -================ -/**========================================================================================================================== - * EARN - * ========================================================================================================================== - */ +export interface OTCBankSupplementChecklistItem { + description: string; + code?: string; + zh?: string; + en?: string; + required?: boolean; +} ⋮---- -/** GET /earn/dual/investment_plan */ -export interface GetDualInvestmentPlansReq { - plan_id?: number | string; - coin?: string; - type?: string; - quote_currency?: string; - /** `apy` | `short-period` | `multiple` */ - sort?: string; - page?: number; - page_size?: number; +export interface GetOTCBankSupplementChecklistResp { + code: number; + message: string; + data: { + user_type: 'personal' | 'enterprise'; + items: OTCBankSupplementChecklistItem[]; + }; + timestamp?: number; } ⋮---- -/** `apy` | `short-period` | `multiple` */ +export type MarkOTCOrderAsPaidResp = OTCActionResp; ⋮---- -/** GET /earn/dual/orders */ -export interface GetDualInvestmentOrdersReq { - from?: number; - to?: number; - type?: string; - status?: string; - coin?: string; - page?: number; - limit?: number; -} +export type CancelOTCOrderResp = OTCActionResp; ⋮---- -/** GET /earn/dual/order-refund-preview */ -export interface GetDualOrderRefundPreviewReq { +export interface OTCFiatOrderListItem { + time: string; // Current time + timestamp: number; // Current timestamp order_id: string; + trade_no: string; // Trade number + type: string; // Quote direction buy/sell/all + status: string; // Order Status (includes DISBURSED) + db_status: string; + fiat_currency: string; // Fiat type + fiat_currency_info: { + name: string; + icon: string; + }; + fiat_amount: string; // Fiat amount + crypto_currency: string; // Stablecoin + crypto_currency_info: { + name: string; + icon: string; + }; + crypto_amount: string; // Stablecoin amount + rate: string; // Exchange rate + transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) + reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders + gate_bank_account_iban: string; // Bank account + promotion_code: string; // Promotion code } ⋮---- -/** POST /earn/dual/order-refund */ -export interface SubmitDualOrderRefundParams { - order_id: string; - /** From order-refund-preview */ - req_id: string; -} +time: string; // Current time +timestamp: number; // Current timestamp ⋮---- -/** From order-refund-preview */ +trade_no: string; // Trade number +type: string; // Quote direction buy/sell/all +status: string; // Order Status (includes DISBURSED) ⋮---- -/** POST /earn/dual/modify-order-reinvest */ -export interface UpdateDualOrderReinvestParams { - order_id?: number; - /** 0 off, 1 on */ - status?: number; - /** Effective duration in seconds; default 86400 */ - effective_time_duration?: number; -} +fiat_currency: string; // Fiat type ⋮---- -/** 0 off, 1 on */ +fiat_amount: string; // Fiat amount +crypto_currency: string; // Stablecoin ⋮---- -/** Effective duration in seconds; default 86400 */ +crypto_amount: string; // Stablecoin amount +rate: string; // Exchange rate +transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) +reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders +gate_bank_account_iban: string; // Bank account +promotion_code: string; // Promotion code ⋮---- -/** GET /earn/dual/project-recommend */ -export interface GetDualProjectRecommendReq { - mode?: string; - coin?: string; - type?: string; - /** Comma-separated project IDs to exclude */ - history_pids?: string; +export interface GetOTCFiatOrderListResp { + code: number; + message: string; + data: { + pn: number; + ps: number; + total_pn: number; + count: number; + list: OTCFiatOrderListItem[]; + }; } ⋮---- -/** Comma-separated project IDs to exclude */ -⋮---- -/** Request params for POST /earn/dual/orders */ -export interface PlaceDualInvestmentOrderParams { - plan_id: string; - /** Subscription amount. Mutually exclusive with copies. */ - amount: string; - /** Units. Mutually exclusive with amount. */ - copies?: string; - /** Custom order info, must start with t- */ - text?: string; +export interface OTCStablecoinOrderListItem { + id: number; // Order ID + trade_no: string; // Transaction reference number + pay_coin: string; // Payment currency + pay_amount: string; // Payment amount + get_coin: string; // Received currency + get_amount: string; // Received amount + rate: string; // Exchange rate + rate_reci: string; // Reciprocal of the exchange rate + status: string; // PROCESSING: in progress / DONE: completed / FAILED: failed + create_timest: number; // Timestamp + create_time: string; // Created time + pay_icon?: string; + get_icon?: string; } ⋮---- -/** Subscription amount. Mutually exclusive with copies. */ -⋮---- -/** Units. Mutually exclusive with amount. */ -⋮---- -/** Custom order info, must start with t- */ +id: number; // Order ID +trade_no: string; // Transaction reference number +pay_coin: string; // Payment currency +pay_amount: string; // Payment amount +get_coin: string; // Received currency +get_amount: string; // Received amount +rate: string; // Exchange rate +rate_reci: string; // Reciprocal of the exchange rate +status: string; // PROCESSING: in progress / DONE: completed / FAILED: failed +create_timest: number; // Timestamp +create_time: string; // Created time ⋮---- -/**========================================================================================================================== - * EARN FIXED-TERM - * ========================================================================================================================== - */ +export interface GetOTCStablecoinOrderListResp { + code: number; + message: string; + data: { + total: number; + page_size: number; + page_number: number; + total_page: number; + list: OTCStablecoinOrderListItem[]; + }; +} ⋮---- -export interface GetEarnFixedTermProductsReq { - asset?: string; - type?: number; // 1 regular, 2 VIP - page: number; - limit: number; +export interface OTCFiatOrderDetail { + order_id: string; // Order ID + uid: string; // User ID + type: string; // Order Type + fiat_currency: string; // Fiat type + fiat_amount: string; // Fiat amount + crypto_currency: string; // Stablecoin + crypto_amount: string; // Stablecoin amount + rate: string; // Exchange rate + transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) + reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders + status: string; // Status + db_status: string; + create_time: string; // Created time + memo: string; // Cancellation or rejection reason + side: string; // Quote direction + promotion_code: string; // Promotion code + trade_no: string; // Trade number } ⋮---- -type?: number; // 1 regular, 2 VIP -⋮---- -export interface GetEarnFixedTermProductsByAssetReq { - /** Product type: "" or 1 regular, 2 VIP, 0 all */ - type?: string; -} +order_id: string; // Order ID +uid: string; // User ID +type: string; // Order Type +fiat_currency: string; // Fiat type +fiat_amount: string; // Fiat amount +crypto_currency: string; // Stablecoin +crypto_amount: string; // Stablecoin amount +rate: string; // Exchange rate +transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) +reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders +status: string; // Status ⋮---- -/** Product type: "" or 1 regular, 2 VIP, 0 all */ +create_time: string; // Created time +memo: string; // Cancellation or rejection reason +side: string; // Quote direction +promotion_code: string; // Promotion code +trade_no: string; // Trade number ⋮---- -export interface CreateEarnFixedTermLendReq { - product_id: number; - amount: string; - year_rate?: string; - reinvest_status?: number; // 0 off, 1 on - redeem_account_type?: number; // 1 spot - financial_rate_id?: number; // interest boost coupon id, 0 = none - sub_business?: number; +export interface GetOTCFiatOrderDetailResp { + message: string; + code: number; + data: OTCFiatOrderDetail; } + +================ +File: src/types/response/tradfi.ts +================ +/** TradFi API response types */ ⋮---- -reinvest_status?: number; // 0 off, 1 on -redeem_account_type?: number; // 1 spot -financial_rate_id?: number; // interest boost coupon id, 0 = none -⋮---- -export interface GetEarnFixedTermLendsReq { - product_id?: number; - order_id?: number; - asset?: string; - order_type: '1' | '2'; // 1 current, 2 historical - page: number; - limit: number; - sub_business?: number; - business_filter?: string; +export interface TradFiApiResp { + timestamp?: number; + data?: T; + code?: number; + message?: string; + label?: string; } ⋮---- -order_type: '1' | '2'; // 1 current, 2 historical -⋮---- -export interface EarnFixedTermPreRedeemReq { - order_id: string; +export interface TradFiListData { + list?: T[]; + total?: number; + total_page?: number; } ⋮---- -export interface GetEarnFixedTermHistoryReq { - product_id?: number; - order_id?: string; - asset?: string; - type: '1' | '2' | '3' | '4'; // 1 subscribe, 2 redeem, 3 interest, 4 bonus - page: number; - limit: number; - start_at?: number; - end_at?: number; - sub_business?: number; - business_filter?: string; +export interface TradFiMT5Account { + mt5_uid?: number; + leverage?: number; + stop_out_level?: string; + status?: number; } ⋮---- -type: '1' | '2' | '3' | '4'; // 1 subscribe, 2 redeem, 3 interest, 4 bonus - -================ -File: src/types/request/spot.ts -================ -/**========================================================================================================================== - * SPOT - * ========================================================================================================================== - */ -⋮---- -/** Limit-order take-profit / stop-loss on create */ -export interface SpotOrderTPSL { - trigger_price: string; - order_price: string; +export interface TradFiCategoryItem { + category_id?: number; + is_favorite?: boolean; + category_name?: string; } ⋮---- -/** Limit-order take-profit / stop-loss on amend; `{}` cancels, `null` leaves unchanged */ -export type PatchSpotOrderTPSL = SpotOrderTPSL | {} | null; +export interface TradFiSymbolItem { + symbol?: string; + symbol_desc?: string; + category_id?: number; + status?: string; + trade_mode?: string; + icon_link?: string; + close_time?: number; + open_time?: number; + next_open_time?: number; + settlement_currency?: string; + settlement_currency_symbol?: string; + price_precision?: number; +} ⋮---- -export interface GetSpotOrderBookReq { - currency_pair: string; - interval?: string; - limit?: number; - with_id?: boolean; +export interface TradFiSymbolDetailItem { + symbol?: string; + symbol_desc?: string; + category_name?: string; + contract_volume?: string; + settlement_currency?: string; + max_order_volume?: string; + min_order_volume?: string; + leverage?: string; + price_precision?: number; + price_sl_level?: string; + swap_cost_type?: string; + buy_swap_cost_rate?: string; + sell_swap_cost_rate?: string; + swap_cost_3day?: string; + trade_timezone?: string; + trade_mode?: string; + icon_link?: string; + [key: string]: unknown; } ⋮---- -export interface GetSpotTradesReq { - currency_pair: string; - limit?: number; - last_id?: string; - reverse?: boolean; - from?: number; - to?: number; - page?: number; +export interface TradFiKlineItem { + o?: string; + c?: string; + h?: string; + l?: string; + t?: number; } ⋮---- -export interface GetSpotCandlesReq { - currency_pair: string; - limit?: number; - from?: number; - to?: number; - interval?: - | '1s' - | '10s' - | '1m' - | '5m' - | '15m' - | '30m' - | '1h' - | '4h' - | '8h' - | '1d' - | '7d' - | '30d'; +export interface TradFiTicker { + highest_price?: string; + lowest_price?: string; + price_change?: string; + price_change_amount?: string; + today_open_price?: string; + last_today_close_price?: string; + last_price?: string; + bid_price?: string; + ask_price?: string; + favorite?: boolean; + status?: string; + close_time?: number; + open_time?: number; + next_open_time?: number; + trade_mode?: string; + category_name?: string; } ⋮---- -export interface GetSpotAccountBookReq { - currency?: string; - from?: number; - to?: number; - page?: number; - limit?: number; - /** - * BizType / business type filter. Sub-account transfer internal BizType values include - * 150215, 150216, 150217, 150218, 150219 (Subaccount Transfer); see Gate BizType reference. - */ - type?: string; - code?: string; +export interface TradFiCreateUserResult { + status?: number; + leverage?: number; + mt5_uid?: string; } ⋮---- -/** - * BizType / business type filter. Sub-account transfer internal BizType values include - * 150215, 150216, 150217, 150218, 150219 (Subaccount Transfer); see Gate BizType reference. - */ +export interface TradFiAssets { + equity?: string; + margin_level?: string; + balance?: string; + margin?: string; + margin_free?: string; + unrealized_pnl?: string; + mt5_uid?: string; +} ⋮---- -export interface SubmitSpotClosePosCrossDisabledReq { - text?: string; - currency_pair: string; - amount: string; - price: string; - action_mode?: 'ACK' | 'RESULT' | 'FULL'; +export interface TradFiTransactionRecord { + asset?: string; + type?: string; + type_desc?: string; + change?: string; + balance?: string; + time?: number; } ⋮---- -export interface GetSpotOrdersReq { - currency_pair: string; - status: 'open' | 'finished'; - page?: number; - limit?: number; - account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; - from?: number; - to?: number; - side?: 'buy' | 'sell'; +export interface TradFiTransactionListData { + total?: number; + total_page?: number; + list?: TradFiTransactionRecord[]; } ⋮---- -export interface CancelSpotBatchOrdersReq { - currency_pair: string; - id: string; - account?: 'cross_margin'; - action_mode?: 'ACK' | 'RESULT' | 'FULL'; +export interface TradFiCreateOrderResult { + id?: string; } ⋮---- -export interface DeleteSpotOrderReq { - order_id: string; - currency_pair: string; - account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; - action_mode?: 'ACK' | 'RESULT' | 'FULL'; - xGateExptime?: number; +export interface TradFiOrderItem { + order_id?: number; + symbol?: string; + symbol_desc?: string; + price_type?: string; + state?: number; + state_desc?: string; + finished?: number; + side?: number; + volume?: string; + price?: string; + price_tp?: string; + price_sl?: string; + time_setup?: number; } ⋮---- -export interface GetSpotOrderReq { - order_id: string; - currency_pair: string; - account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; +export interface TradFiOrderListData { + list?: TradFiOrderItem[]; + timestamp?: number; } ⋮---- -export interface GetSpotTradingHistoryReq { - currency_pair?: string; - limit?: number; - page?: number; - order_id?: string; - account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; - from?: number; - to?: number; +export interface TradFiModifyOrderResult { + order_id?: number; + symbol?: string; + state?: string; + volume?: string; + price?: string; + price_tp?: string; + price_sl?: string; } ⋮---- -export interface UpdateSpotBatchOrdersReq { - order_id?: string; - currency_pair?: string; - amount?: string; +export interface TradFiOrderHistoryItem { + order_id?: number; + symbol?: string; + symbol_desc?: string; + price_type?: string; + order_opt_type?: number; + state?: number; + state_desc?: string; + side?: number; + volume?: string; + fill_volume?: string; + close_pnl?: string; price?: string; - amend_text?: string; - stop_loss?: PatchSpotOrderTPSL; - stop_profit?: PatchSpotOrderTPSL; + trigger_price?: string; + price_tp?: string; + price_sl?: string; + time_setup?: number; + time_done?: number; } ⋮---- -export interface GetSpotInsuranceHistoryReq { - business: 'margin' | 'unified'; - currency: string; - from: number; - to: number; - page?: number; - limit?: number; +export interface TradFiPositionItem { + position_id?: number; + symbol?: string; + symbol_desc?: string; + margin?: string; + unrealized_pnl?: string; + unrealized_pnl_rate?: string; + volume?: string; + price_open?: string; + position_dir?: string; + price_tp?: string; + price_sl?: string; + counterparty_price?: string; + time_create?: number; } ⋮---- -export interface GetSpotAutoOrdersReq { - status: 'open' | 'finished'; - market?: string; - account?: 'normal' | 'margin' | 'cross_margin' | 'unified'; - limit?: number; - offset?: number; +export interface TradFiPositionListData { + list?: TradFiPositionItem[]; + timestamp?: number; } ⋮---- -export interface SubmitSpotOrderReq { - xGateExptime?: number; - side: 'buy' | 'sell'; - amount: string; - text?: string; - currency_pair: string; - type?: 'limit' | 'market'; - account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; - price?: string; - time_in_force?: 'gtc' | 'ioc' | 'poc' | 'fok'; - iceberg?: string; - auto_borrow?: boolean; - auto_repay?: boolean; - stp_act?: string; - action_mode?: string; - stop_loss?: PatchSpotOrderTPSL; - stop_profit?: PatchSpotOrderTPSL; - post_only?: boolean; +export interface TradFiPositionHistoryItem { + position_id?: number; + symbol?: string; + realized_pnl?: string; + realized_pnl_rate?: string; + volume?: string; + volume_closed?: string; + price_open?: string; + position_dir?: string; + price_tp?: string; + price_sl?: string; + counterparty_price?: string; + close_price?: string; + time_create?: string; + time_close?: string; + position_status?: string; + close_detail?: Record | null; + realized_pnl_detail?: { + closed_pnl?: string; + swap?: string; + fee?: string; + }; } ⋮---- -export interface UpdateSpotOrderReq { - xGateExptime?: number; - order_id: string; - currency_pair: string; - account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; - amount?: string; +/** GET /tradfi/orders/log/{log_id} — v4.106.94 */ +export interface TradFiOrderLog { + order_id?: number; + log_id?: number; + symbol?: string; + price_type?: 'market' | 'trigger'; + state?: number; + side?: number; + volume?: string; price?: string; - amend_text?: string; - action_mode?: 'ACK' | 'RESULT' | 'FULL'; - stop_loss?: PatchSpotOrderTPSL; - stop_profit?: PatchSpotOrderTPSL; + [key: string]: unknown; +} +⋮---- +export interface TradFiSymbolCommissionItem { + category_code?: string; + symbol?: string; + fee_per_lot?: string; } ================ -File: src/types/response/crossex.ts +File: src/types/response/wallet.ts ================ -/**========================================================================================================================== - * CROSSEX - * ========================================================================================================================== - */ -⋮---- -export interface CrossExSymbol { - symbol: string; - exchange_type: string; - business_type: string; - state: string; - min_size: string; - min_notional: string; - lot_size: string; - tick_size: string; - max_num_orders: string; - max_market_size: string; - max_limit_size: string; - contract_size: string; - liquidation_fee: string; - delist_time: string; +export interface CurrencyChain { + chain: string; + name_cn: string; + name_en: string; + contract_address: string; + is_disabled: number; + is_deposit_disabled: number; + is_withdraw_disabled: number; + decimal: string; } ⋮---- -export interface CrossExRiskLimitTier { - min_risk_limit_value: string; // Minimum risk limit value - max_risk_limit_value: string; // Maximum risk limit value - leverage_max: string; // Maximum leverage - maintenance_rate: string; // Maintenance margin rate - tier: string; // Tier - quick_cal_amount: string; // Quick-calculation amount for this risk tier +/** GET /wallet/sub_account_balances item */ +export interface SubAccountBalance { + uid: string; + available: { [key: string]: string }; + /** Locked amount per currency */ + locking?: { [key: string]: string }; } ⋮---- -min_risk_limit_value: string; // Minimum risk limit value -max_risk_limit_value: string; // Maximum risk limit value -leverage_max: string; // Maximum leverage -maintenance_rate: string; // Maintenance margin rate -tier: string; // Tier -quick_cal_amount: string; // Quick-calculation amount for this risk tier -⋮---- -export interface CrossExRiskLimit { - symbol: string; - tiers: CrossExRiskLimitTier[]; -} +/** Locked amount per currency */ ⋮---- -export interface CrossExTransferCoin { - coin: string; // Currency - min_trans_amount: number; // Minimum Transfer Quantity (including estimated fees) - est_fee: number; // Estimated Fee - precision: number; // Precision - is_disabled: number; // If it is disabled. 0 means NOT being disabled +export interface DepositRecord { + id: string; + txid: string; + timestamp: string; + amount: string; + currency: string; + address: string; + memo?: string; + status: + | 'BLOCKED' // Deposit Blocked + | 'DEP_CREDITED' // Deposit Credited, Withdrawal Pending Unlock + | 'DONE' // Funds Credited to Spot Account + | 'INVALID' // Invalid Transaction + | 'MANUAL' // Manual Review Required + | 'PEND' // Processing + | 'REVIEW' // Under Compliance Review + | 'TRACK'; // Tracking Block Confirmations, Pending Spot Account Credit + chain: string; + refund_status?: // v4.106.95: Blocked deposit refund status + 'REFUNDING' | 'REFUNDED' | 'REFUND_FAILED' | 'REJECTED'; } ⋮---- -coin: string; // Currency -min_trans_amount: number; // Minimum Transfer Quantity (including estimated fees) -est_fee: number; // Estimated Fee -precision: number; // Precision -is_disabled: number; // If it is disabled. 0 means NOT being disabled -⋮---- -export interface CreateCrossExTransferResp { - tx_id: string; // Order ID - text: string; // User-defined Order ID -} +| 'BLOCKED' // Deposit Blocked +| 'DEP_CREDITED' // Deposit Credited, Withdrawal Pending Unlock +| 'DONE' // Funds Credited to Spot Account +| 'INVALID' // Invalid Transaction +| 'MANUAL' // Manual Review Required +| 'PEND' // Processing +| 'REVIEW' // Under Compliance Review +| 'TRACK'; // Tracking Block Confirmations, Pending Spot Account Credit ⋮---- -tx_id: string; // Order ID -text: string; // User-defined Order ID +refund_status?: // v4.106.95: Blocked deposit refund status ⋮---- -export interface CrossExTransferHistory { - id: string; // Order ID - text: string; // Client Custom ID - from_account_type: string; // Source from account (CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX, SPOT) - to_account_type: string; - coin: string; // Currency - amount: string; // Transfer amount, the amount requested for the transfer - actual_receive: string; // Actual credited amount (has a value when status = SUCCESS; empty for other statuses) - status: string; // Transfer Status - FAIL: Failed, SUCCESS: Successful, PENDING: Transfer in Progress - fail_reason: string; // Failure reason (has a value when status = FAIL; empty for other statuses) - create_time: number; // Creation time of order - update_time: number; // Order Update Time +export interface CreateDepositAddressResp { + currency: string; + address: string; + multichain_addresses: { + chain: string; + address: string; + payment_id: string; + payment_name: string; + obtain_failed: number; + }[]; } ⋮---- -id: string; // Order ID -text: string; // Client Custom ID -from_account_type: string; // Source from account (CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX, SPOT) -⋮---- -coin: string; // Currency -amount: string; // Transfer amount, the amount requested for the transfer -actual_receive: string; // Actual credited amount (has a value when status = SUCCESS; empty for other statuses) -status: string; // Transfer Status - FAIL: Failed, SUCCESS: Successful, PENDING: Transfer in Progress -fail_reason: string; // Failure reason (has a value when status = FAIL; empty for other statuses) -create_time: number; // Creation time of order -update_time: number; // Order Update Time +export interface SubAccountTransferRecord { + currency: string; + sub_account: string; + direction: 'to' | 'from'; + amount: string; + uid: string; + client_order_id: string; + timest: string; + source: string; + sub_account_type: 'spot' | 'futures' | 'cross_margin' | 'delivery'; +} ⋮---- -export interface CreateCrossExOrderResp { - order_id: number | string; - text: string; // User-defined Order ID +export interface WithdrawalStatus { + currency: string; + name: string; + name_cn: string; + deposit: string; + withdraw_percent: string; + withdraw_fix: string; + withdraw_day_limit: string; + withdraw_amount_mini: string; + withdraw_day_limit_remain: string; + withdraw_eachtime_limit: string; + withdraw_fix_on_chains: { [key: string]: string }; + withdraw_percent_on_chains: { [key: string]: string }; } ⋮---- -text: string; // User-defined Order ID +export interface SubAccountMarginBalance { + currency_pair: string; + locked: boolean; + risk: string; + base: { + currency: string; + available: string; + locked: string; + borrowed: string; + interest: string; + }; + quote: { + currency: string; + available: string; + locked: string; + borrowed: string; + interest: string; + }; +} ⋮---- -export interface CancelCrossExOrderResp { - order_id: number; - text: string; +export interface SubAccountFuturesBalancesResp { + uid: string; + available: { + [key: string]: { + total: string; + unrealised_pnl: string; + position_margin: string; + order_margin: string; + available: string; + point: string; + currency: string; + in_dual_mode: boolean; + enable_credit: boolean; + position_initial_margin: string; + maintenance_margin: string; + bonus: string; + enable_evolved_classic: boolean; + cross_order_margin: string; + cross_initial_margin: string; + cross_maintenance_margin: string; + cross_unrealised_pnl: string; + cross_available: string; + isolated_position_margin: string; + history: { + dnw: string; + pnl: string; + fee: string; + refr: string; + fund: string; + point_dnw: string; + point_fee: string; + point_refr: string; + bonus_dnw: string; + bonus_offset: string; + }; + }; + }; } ⋮---- -export interface ModifyCrossExOrderResp { - order_id: number; - text: string; +export interface SubAccountCrossMarginBalancesResp { + uid: string; + available: { + user_id: number; + locked: boolean; + balances: { + [key: string]: { + available: string; + freeze: string; + borrowed: string; + interest: string; + }; + }; + total: string; + borrowed: string; + borrowed_net: string; + net: string; + leverage: string; + interest: string; + risk: string; + total_initial_margin: string; + total_margin_balance: string; + total_maintenance_margin: string; + total_initial_margin_rate: string; + total_maintenance_margin_rate: string; + total_available_margin: string; + }; } ⋮---- -export interface CrossExOrder { - user_id: string; // User ID - order_id: string; // Order ID - text: string; // Client Order ID - state: string; // Order Status - symbol: string; // Currency pair - side: string; // direction - type: string; // type - attribute: string; // COMMON, LIQ, REDUCE, ADL, SETTLEMENT - exchange_type: string; // Exchange - business_type: string; // Business Type - qty: string; // Base Currency Quantity - quote_qty: string; // Quote Currency Quantity - price: string; // Price - time_in_force: string; // Time in Force Strategy - executed_qty: string; // Filled Quantity - executed_amount: string; // Filled Amount - executed_avg_price: string; // Average Filled Price - fee_coin: string; // Fee currency - fee: string; // fee - reduce_only: string; // Reduce Position Only - leverage: string; // leverage - reason: string; // Reason - last_executed_qty: string; // Latest Filled Quantity - last_executed_price: string; // Latest Filled Price - last_executed_amount: string; // Latest Filled Amount - position_side: string; // Position Direction - create_time: string; // Created time - update_time: string; // Update time +export interface SavedAddress { + currency: string; + chain: string; + address: string; + name: string; + tag: string; + verified: string; } ⋮---- -user_id: string; // User ID -order_id: string; // Order ID -text: string; // Client Order ID -state: string; // Order Status -symbol: string; // Currency pair -side: string; // direction -type: string; // type -attribute: string; // COMMON, LIQ, REDUCE, ADL, SETTLEMENT -exchange_type: string; // Exchange -business_type: string; // Business Type -qty: string; // Base Currency Quantity -quote_qty: string; // Quote Currency Quantity -price: string; // Price -time_in_force: string; // Time in Force Strategy -executed_qty: string; // Filled Quantity -executed_amount: string; // Filled Amount -executed_avg_price: string; // Average Filled Price -fee_coin: string; // Fee currency -fee: string; // fee -reduce_only: string; // Reduce Position Only -leverage: string; // leverage -reason: string; // Reason -last_executed_qty: string; // Latest Filled Quantity -last_executed_price: string; // Latest Filled Price -last_executed_amount: string; // Latest Filled Amount -position_side: string; // Position Direction -create_time: string; // Created time -update_time: string; // Update time +export interface TradingFees { + user_id: number; + taker_fee: string; + maker_fee: string; + gt_discount: boolean; + gt_taker_fee: string; + gt_maker_fee: string; + loan_fee: string; + point_type: string; + futures_taker_fee: string; + futures_maker_fee: string; + delivery_taker_fee: string; + delivery_maker_fee: string; + debit_fee: number; +} ⋮---- -export interface CreateCrossExConvertQuoteResp { - quote_id: string; // Quote ID - valid_ms: string; // Valid time (milliseconds timestamp) - from_coin: string; // Asset Sold - to_coin: string; // Asset Bought - from_amount: string; // Amount to sell - to_amount: string; // Amount to buy - price: string; // Price +export interface GetBalancesResp { + total: { + amount: string; + currency: string; + unrealised_pnl?: string; + borrowed?: string; + }; + details: { + [key: string]: { + amount: string; + currency: string; + unrealised_pnl?: string; + borrowed?: string; + }; + }; } ⋮---- -quote_id: string; // Quote ID -valid_ms: string; // Valid time (milliseconds timestamp) -from_coin: string; // Asset Sold -to_coin: string; // Asset Bought -from_amount: string; // Amount to sell -to_amount: string; // Amount to buy -price: string; // Price -⋮---- -export interface CreateCrossExConvertOrderResp { - order_id: string; // Order ID - text: string; // User-defined order ID text +export interface SmallBalanceRecord { + currency: string; + available_balance: string; + estimated_as_btc: string; + convertible_to_gt: string; } ⋮---- -order_id: string; // Order ID -text: string; // User-defined order ID text -⋮---- -export interface UpdateCrossExAccountResp { - position_mode: string; // Requested futures position mode to modify (SINGLE/DUAL) - account_mode: string; // Requested account mode to modify (CROSS_EXCHANGE/ISOLATED_EXCHANGE, default: CROSS_EXCHANGE) - exchange_type: string; // Requested exchange to modify (BINANCE/OKX/GATE/BYBIT/CROSSEX) +export interface SmallBalanceHistoryRecord { + id: string; + currency: string; + amount: string; + gt_amount: string; + create_time: number; } ⋮---- -position_mode: string; // Requested futures position mode to modify (SINGLE/DUAL) -account_mode: string; // Requested account mode to modify (CROSS_EXCHANGE/ISOLATED_EXCHANGE, default: CROSS_EXCHANGE) -exchange_type: string; // Requested exchange to modify (BINANCE/OKX/GATE/BYBIT/CROSSEX) -⋮---- -export interface CrossExAccountAsset { - user_id: string; // User ID - coin: string; // Currency - exchange_type: string; // Exchange - balance: string; // Balance - upnl: string; // Unrealized P&L - equity: string; // Equity (only USDT has a value; other assets are 0) - futures_initial_margin: string; // Futures initial margin (only USDT has a value; other assets are 0) - futures_maintenance_margin: string; // Futures maintenance margin (only USDT has a value; other assets are 0) - borrowing_initial_margin: string; // Margin trading initial margin (only USDT has a value; other assets are 0) - borrowing_maintenance_margin: string; // Margin trading maintenance margin (only USDT has a value; other assets are 0) - available_balance: string; // Available Balance - liability: string; // Liabilities (only meaningful in isolated exchange mode; always 0 in cross-exchange mode) +export interface PushOrder { + id: string; + push_uid: number; + receive_uid: number; + currency: string; + amount: string; + create_time: number; + status: + | 'CREATING' + | 'PENDING' + | 'CANCELLING' + | 'CANCELLED' + | 'REFUSING' + | 'REFUSED' + | 'RECEIVING' + | 'RECEIVED'; + message: string; } ⋮---- -user_id: string; // User ID -coin: string; // Currency -exchange_type: string; // Exchange -balance: string; // Balance -upnl: string; // Unrealized P&L -equity: string; // Equity (only USDT has a value; other assets are 0) -futures_initial_margin: string; // Futures initial margin (only USDT has a value; other assets are 0) -futures_maintenance_margin: string; // Futures maintenance margin (only USDT has a value; other assets are 0) -borrowing_initial_margin: string; // Margin trading initial margin (only USDT has a value; other assets are 0) -borrowing_maintenance_margin: string; // Margin trading maintenance margin (only USDT has a value; other assets are 0) -available_balance: string; // Available Balance -liability: string; // Liabilities (only meaningful in isolated exchange mode; always 0 in cross-exchange mode) -⋮---- -export interface CrossExAccount { - user_id: string; // User ID - available_margin: string; // Available Margin - margin_balance: string; // margin balance - initial_margin: string; // Initial Margin - maintenance_margin: string; // Maintenance margin - initial_margin_rate: string; // Initial margin rate - maintenance_margin_rate: string; // Maintenance margin rate - position_mode: string; // Contract Position Mode - account_limit: string; // Account limit - create_time: string; // Created time - update_time: string; // Update time - account_mode: string; // Account mode. CROSS_EXCHANGE: cross-exchange mode. ISOLATED_EXCHANGE: isolated exchange mode - exchange_type: string; // Exchange type. When account_mode is CROSS_EXCHANGE, this must be CROSSEX; otherwise, it represents a specific exchange - assets: CrossExAccountAsset[]; +/** GET /wallet/transfers — AccountTransferDetail */ +export interface AccountTransferDetail { + tx_id: string; + status: 'pending' | 'success' | 'fail'; + currency: string; + amount: string; + from_account: + | 'spot' + | 'margin' + | 'futures' + | 'delivery' + | 'options' + | 'unknown'; + to_account: + | 'spot' + | 'margin' + | 'futures' + | 'delivery' + | 'options' + | 'unknown'; + settle?: string | null; + currency_pair?: string | null; } + +================ +File: src/types/websockets/client.ts +================ +import type { ClientRequestArgs } from 'http'; +import WebSocket from 'isomorphic-ws'; ⋮---- -user_id: string; // User ID -available_margin: string; // Available Margin -margin_balance: string; // margin balance -initial_margin: string; // Initial Margin -maintenance_margin: string; // Maintenance margin -initial_margin_rate: string; // Initial margin rate -maintenance_margin_rate: string; // Maintenance margin rate -position_mode: string; // Contract Position Mode -account_limit: string; // Account limit -create_time: string; // Created time -update_time: string; // Update time -account_mode: string; // Account mode. CROSS_EXCHANGE: cross-exchange mode. ISOLATED_EXCHANGE: isolated exchange mode -exchange_type: string; // Exchange type. When account_mode is CROSS_EXCHANGE, this must be CROSSEX; otherwise, it represents a specific exchange +/** + * Event args for subscribing/unsubscribing + */ ⋮---- -export interface SetCrossExPositionLeverageResp { - symbol: string; // Currency pair - leverage: string; // Requested Modified Leverage -} +// export type WsTopicSubscribePrivateArgsV2 = +// | WsTopicSubscribePrivateInstIdArgsV2 +// | WsTopicSubscribePrivateCoinArgsV2; ⋮---- -symbol: string; // Currency pair -leverage: string; // Requested Modified Leverage +// export type WsTopicSubscribeEventArgsV2 = +// | WsTopicSubscribePublicArgsV2 +// | WsTopicSubscribePrivateArgsV2; ⋮---- -export interface CrossExPositionLeverage { - symbol: string; // Currency pair - leverage: number | string; +/** General configuration for the WebsocketClient */ +export interface WSClientConfigurableOptions { + /** Your API key */ + apiKey?: string; + + /** Your API secret */ + apiSecret?: string; + + useTestnet?: boolean; + + /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ + recvWindow?: number; + + /** How often to check if the connection is alive */ + pingInterval?: number; + + /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ + pongTimeout?: number; + + /** Delay in milliseconds before respawning the connection */ + reconnectTimeout?: number; + + requestOptions?: {}; + + wsUrl?: string; + + wsOptions?: { + protocols?: string[]; + agent?: any; + } & ( + | Omit, 'agent'> + | Omit, 'agent'> + ); + + /** + * 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; + + /** + * If you authenticated the WS API before, automatically try to re-authenticate the WS API if you're disconnected/reconnected for any reason. + */ + reauthWSAPIOnReconnect?: boolean; } ⋮---- -symbol: string; // Currency pair -⋮---- -export interface SetCrossExMarginPositionLeverageResp { - symbol: string; // Currency pair - leverage: string; // Requested Modified Leverage -} +/** Your API key */ ⋮---- -symbol: string; // Currency pair -leverage: string; // Requested Modified Leverage +/** Your API secret */ ⋮---- -export interface CrossExMarginPositionLeverage { - symbol: string; // Currency pair - leverage: number | string; -} +/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ ⋮---- -symbol: string; // Currency pair +/** How often to check if the connection is alive */ ⋮---- -export interface CloseCrossExPositionResp { - order_id: string; // Order ID - text: string; // User-defined Order ID -} +/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ ⋮---- -order_id: string; // Order ID -text: string; // User-defined Order ID +/** Delay in milliseconds before respawning the connection */ ⋮---- -export interface CrossExInterestRate { - coin: string; // Currency - exchange_type: string; // Exchange - hour_interest_rate: string; // Hourly Interest Rate - time: string; // Millisecond Timestamp -} +/** + * 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. + */ ⋮---- -coin: string; // Currency -exchange_type: string; // Exchange -hour_interest_rate: string; // Hourly Interest Rate -time: string; // Millisecond Timestamp +/** + * If you authenticated the WS API before, automatically try to re-authenticate the WS API if you're disconnected/reconnected for any reason. + */ ⋮---- -export interface CrossExSpecialFee { - symbol: string; // Currency pair - taker_fee_rate: string; // Taker fee rate - maker_fee_rate: string; // Maker fee rate +/** + * WS configuration that's always defined, regardless of user configuration + * (usually comes from defaults if there's no user-provided values) + */ +export interface WebsocketClientOptions extends WSClientConfigurableOptions { + pingInterval: number; + pongTimeout: number; + reconnectTimeout: number; + recvWindow: number; + authPrivateConnectionsOnConnect: boolean; + authPrivateRequests: boolean; + reauthWSAPIOnReconnect: boolean; } + +================ +File: src/index.ts +================ +// Request Types ⋮---- -symbol: string; // Currency pair -taker_fee_rate: string; // Taker fee rate -maker_fee_rate: string; // Maker fee rate +// Response Types ⋮---- -export interface CrossExFeeRate { - exchange_type: string; // Exchange (e.g. BINANCE, OKX, GATE, BYBIT) - spot_maker_fee: string; // spot Maker fee rate - spot_taker_fee: string; // spot Taker fee rate - future_maker_fee: string; // contract Maker fee rate - future_taker_fee: string; // contract Taker fee rate - special_fee_list: CrossExSpecialFee[]; -} +// Websockets Types +⋮---- +// Shared Types + +================ +File: webpack/webpack.config.cjs +================ +function generateConfig(name) ⋮---- -exchange_type: string; // Exchange (e.g. BINANCE, OKX, GATE, BYBIT) -spot_maker_fee: string; // spot Maker fee rate -spot_taker_fee: string; // spot Taker fee rate -future_maker_fee: string; // contract Maker fee rate -future_taker_fee: string; // contract Taker fee rate +// Add '.ts' and '.tsx' as resolvable extensions. ⋮---- -export interface CrossExPosition { - user_id: string; // User ID - position_id: string; // Position ID - symbol: string; // Currency pair - position_side: string; // Position Direction - initial_margin: string; // Initial Margin - maintenance_margin: string; // Maintenance margin - position_qty: string; // Position Quantity - position_value: string; // Position Value - upnl: string; // Unrealized P&L - upnl_rate: string; // Unrealized P&L Ratio - entry_price: string; // Position Average Entry Price - mark_price: string; // Mark price - leverage: string; // Position Leverage - max_leverage: string; // Maximum leverage - risk_limit: string; // Position risk limit - fee: string; // Position Fee - funding_fee: string; // Position Funding Fee - funding_time: string; // Position funding fee collection time (0 indicates it has not been collected yet) - create_time: string; // Position Creation Time - update_time: string; // Position Update Time - closed_pnl: string; // Realized PnL -} +// 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 ⋮---- -user_id: string; // User ID -position_id: string; // Position ID -symbol: string; // Currency pair -position_side: string; // Position Direction -initial_margin: string; // Initial Margin -maintenance_margin: string; // Maintenance margin -position_qty: string; // Position Quantity -position_value: string; // Position Value -upnl: string; // Unrealized P&L -upnl_rate: string; // Unrealized P&L Ratio -entry_price: string; // Position Average Entry Price -mark_price: string; // Mark price -leverage: string; // Position Leverage -max_leverage: string; // Maximum leverage -risk_limit: string; // Position risk limit -fee: string; // Position Fee -funding_fee: string; // Position Funding Fee -funding_time: string; // Position funding fee collection time (0 indicates it has not been collected yet) -create_time: string; // Position Creation Time -update_time: string; // Position Update Time -closed_pnl: string; // Realized PnL +// Code is already transpiled from TypeScript, no additional loaders needed + +================ +File: src/types/response/earn.ts +================ +/**========================================================================================================================== + * EARN + * ========================================================================================================================== + */ ⋮---- -export interface CrossExMarginPosition { - user_id: string; // User ID - position_id: string; // Leveraged Position ID - symbol: string; // Trading Pair - position_side: string; // Position Direction - initial_margin: string; // Initial position margin - maintenance_margin: string; // Position maintenance margin - asset_qty: string; // Position Asset Quantity - asset_coin: string; // Position Asset Currency - position_value: string; // Position Value - liability: string; // Debt Quantity - liability_coin: string; // Debt Currency - interest: string; // Deducted Interest - max_position_qty: string; // Max Trade Size - entry_price: string; // Position Cost Price (Average Opening Price) - index_price: string; // Index price - upnl: string; // Unrealized P&L - upnl_rate: string; // Unrealized P&L Ratio - leverage: string; // Opening Leverage - max_leverage: string; // Maximum leverage - create_time: string; // Created time - update_time: string; // Update time +export interface DualInvestmentProduct { + id: number; + instrument_name: string; + invest_currency: string; + exercise_currency: string; + exercise_price: number; + delivery_time: number; + min_amount?: string; + min_copies: number; + max_copies: number; + /** @deprecated */ + per_value: string; + apy_display: string; + start_time: number; + end_time: number; + status: 'NOTSTARTED' | 'ONGOING' | 'ENDED'; } ⋮---- -user_id: string; // User ID -position_id: string; // Leveraged Position ID -symbol: string; // Trading Pair -position_side: string; // Position Direction -initial_margin: string; // Initial position margin -maintenance_margin: string; // Position maintenance margin -asset_qty: string; // Position Asset Quantity -asset_coin: string; // Position Asset Currency -position_value: string; // Position Value -liability: string; // Debt Quantity -liability_coin: string; // Debt Currency -interest: string; // Deducted Interest -max_position_qty: string; // Max Trade Size -entry_price: string; // Position Cost Price (Average Opening Price) -index_price: string; // Index price -upnl: string; // Unrealized P&L -upnl_rate: string; // Unrealized P&L Ratio -leverage: string; // Opening Leverage -max_leverage: string; // Maximum leverage -create_time: string; // Created time -update_time: string; // Update time +/** @deprecated */ ⋮---- -export interface CrossExAdlRank { - user_id: string; // User ID - symbol: string; // Currency pair - crossex_adl_rank: string; // CROSSEX position-reduction indicator ranking (1–5, higher value ranks higher) - exchange_adl_rank: string; // Original exchange information (Binance: 0–4, higher value ranks higher; OKX: 0–5, higher value ranks higher; Gate: 1–5, lower value ranks higher) +/** GET /earn/dual/order-refund-preview */ +export interface DualOrderRefundPreview { + create_timest: number; + delivery_timest: number; + exercise_price: string; + invest_amount: string; + invest_currency: string; + name: string; + order_id: number; + req_id: string; + refund_service_charge: number; + settle_price: string; + settlement_amount: string; + settlement_currency: string; + settlement_interest: string; + settlement_principle: string; + type: string; + money_back_timest: number; } ⋮---- -user_id: string; // User ID -symbol: string; // Currency pair -crossex_adl_rank: string; // CROSSEX position-reduction indicator ranking (1–5, higher value ranks higher) -exchange_adl_rank: string; // Original exchange information (Binance: 0–4, higher value ranks higher; OKX: 0–5, higher value ranks higher; Gate: 1–5, lower value ranks higher) +/** GET /earn/dual/project-recommend item */ +export interface DualProjectRecommend { + id: number; + category: number; + type: string; + invest_currency: string; + exercise_currency: string; + apy_display: string; + exercise_price: string; + delivery_timest: number; + min_amount: string; + max_amount: string; + min_copies: number; + max_copies: number; + invest_days: number; + invest_hours: string; +} ⋮---- -export interface CrossExHistoryPosition { - position_id: string; // Position ID - user_id: string; // User ID - symbol: string; // Currency pair - closed_type: string; // Position close type (PARTIAL_CLOSED: partially closed; COMPLETE_CLOSED: fully closed) - closed_pnl: string; // Close Position P&L - closed_pnl_rate: string; // Close Position P&L Ratio - open_avg_price: string; // Average Opening Price - closed_avg_price: string; // Average Close Price - max_position_qty: string; // Max Trade Size - closed_qty: string; // Close Position Quantity - closed_value: string; // Close Position Value - fee: string; // Position Accumulated Fees - liq_fee: string; // Liquidation Fee - funding_fee: string; // Funding Fee - position_side: string; // Position Direction Before Close - position_mode: string; // Position Mode at Close - leverage: string; // Leverage at Close - business_type: string; // Business Type - create_time: string; // Created time - update_time: string; // Update time +export interface DualInvestmentOrder { + id: number; + plan_id: number; + copies: string; + invest_amount: string; + settlement_amount: string; + create_time: number; + complete_time: number; + status: + | 'INIT' + | 'SETTLEMENT_SUCCESS' + | 'SETTLEMENT_PROCESSING' + | 'CANCELED' + | 'FAILED'; + invest_currency: string; + exercise_currency: string; + exercise_price: string; + settlement_price: string; + settlement_currency: string; + apy_display: string; + apy_settlement: string; + delivery_time: number; + text: string; } ⋮---- -position_id: string; // Position ID -user_id: string; // User ID -symbol: string; // Currency pair -closed_type: string; // Position close type (PARTIAL_CLOSED: partially closed; COMPLETE_CLOSED: fully closed) -closed_pnl: string; // Close Position P&L -closed_pnl_rate: string; // Close Position P&L Ratio -open_avg_price: string; // Average Opening Price -closed_avg_price: string; // Average Close Price -max_position_qty: string; // Max Trade Size -closed_qty: string; // Close Position Quantity -closed_value: string; // Close Position Value -fee: string; // Position Accumulated Fees -liq_fee: string; // Liquidation Fee -funding_fee: string; // Funding Fee -position_side: string; // Position Direction Before Close -position_mode: string; // Position Mode at Close -leverage: string; // Leverage at Close -business_type: string; // Business Type -create_time: string; // Created time -update_time: string; // Update time +/**========================================================================================================================== + * EARN FIXED-TERM + * ========================================================================================================================== + */ ⋮---- -export interface CrossExHistoryMarginPosition { - position_id: string; // Position ID - user_id: string; // User ID - symbol: string; // Currency pair - closed_type: string; // Position close type (PARTIAL_CLOSED: partially closed; COMPLETE_CLOSED: fully closed) - closed_pnl: string; // Close Position P&L - closed_pnl_rate: string; // Close Position P&L Ratio - open_avg_price: string; // Average Opening Price - closed_avg_price: string; // Average Close Price - max_position_qty: string; // Max Trade Size - closed_qty: string; // Close Position Quantity - closed_value: string; // Close Position Value - liq_fee: string; // Liquidation Fee - position_side: string; // Position Direction Before Close - leverage: string; // Leverage at Close - interest: string; // Total Deducted Interest - business_type: string; // Position Business Type - create_time: string; // Created time - update_time: string; // Update time +export interface FixedTermLadderApr { + apr: string; + left: string; + right: string; } ⋮---- -position_id: string; // Position ID -user_id: string; // User ID -symbol: string; // Currency pair -closed_type: string; // Position close type (PARTIAL_CLOSED: partially closed; COMPLETE_CLOSED: fully closed) -closed_pnl: string; // Close Position P&L -closed_pnl_rate: string; // Close Position P&L Ratio -open_avg_price: string; // Average Opening Price -closed_avg_price: string; // Average Close Price -max_position_qty: string; // Max Trade Size -closed_qty: string; // Close Position Quantity -closed_value: string; // Close Position Value -liq_fee: string; // Liquidation Fee -position_side: string; // Position Direction Before Close -leverage: string; // Leverage at Close -interest: string; // Total Deducted Interest -business_type: string; // Position Business Type -create_time: string; // Created time -update_time: string; // Update time +export interface FixedTermProductInfo { + pre_redeem: number; + reinvest: number; + redeem_account: number; + min_vip: number; + max_vip: number; +} ⋮---- -export interface CrossExHistoryMarginInterest { - userId: string; // User ID - symbol: string; // Trading Pair - interest_id: string; // Interest Deduction ID - liability_id: string; // Debt Source ID, can be Order ID or Position ID - liability: string; // Debt Quantity - liability_coin: string; // Debt Currency - interest: string; // Interest - interest_rate: string; // interest rate - interest_type: string; // Interest deduction type (PERIODIC_POSITION: periodic position interest; PERIODIC_OPEN_ORDER: periodic open-order interest; PERIODIC_ISOLATED: hourly isolated debt interest; IMMEDIATE_OPEN_ORDER: interest charged on order opening) - create_time: string; // Created time - exchange_type: string; // Exchange +export interface FixedTermBonusInfo { + id?: number; + product_id?: number; + asset?: string; + bonus_asset?: string; + kyc_limit?: string; + ladder_apr?: FixedTermLadderApr[]; + total_bonus_amount?: string; + user_total_bonus_amount?: string; + status?: number; + start_time?: string; + end_time?: string; + create_time?: string; + start_at?: number; + end_at?: number; + total_issued_amount?: string; + user_total_issued_amount?: string; + bonus_asset_price?: string; + product_asset_price?: string; + product_year_rate?: string; } ⋮---- -userId: string; // User ID -symbol: string; // Trading Pair -interest_id: string; // Interest Deduction ID -liability_id: string; // Debt Source ID, can be Order ID or Position ID -liability: string; // Debt Quantity -liability_coin: string; // Debt Currency -interest: string; // Interest -interest_rate: string; // interest rate -interest_type: string; // Interest deduction type (PERIODIC_POSITION: periodic position interest; PERIODIC_OPEN_ORDER: periodic open-order interest; PERIODIC_ISOLATED: hourly isolated debt interest; IMMEDIATE_OPEN_ORDER: interest charged on order opening) -create_time: string; // Created time -exchange_type: string; // Exchange +export interface FixedTermCouponInfo { + id?: number; + business?: number; + user_id?: number; + asset?: string; + order_id?: number; + financial_rate_id?: number; + buy_limit_low?: string; + buy_limit_high?: string; + rate_day?: number; + rate_ratio?: string; + coupon_days?: number; + coupon_principal?: string; + coupon_year_rate?: string; + coupon_interest?: string; + status?: number; + finish_time?: string; + create_time?: string; +} ⋮---- -export interface CrossExHistoryTrade { - user_id: string; // User ID - transaction_id: string; // filled records ID - order_id: string; // Order ID - text: string; // User Order ID - symbol: string; // Currency pair - exchange_type: string; // Exchange - business_type: string; // Business Type - side: string; // Buy/Sell Direction - qty: string; // Trading size - price: string; // Fill Price - fee: string; // fee - fee_coin: string; // Fee currency - fee_rate: string; // Fee Rate - match_role: string; // Filled Role - rpnl: string; // Realized P&L - position_mode: string; // Position Mode - position_side: string; // Position Direction - create_time: string; // Created time +export interface FixedTermLendOrder { + id?: number; + business?: number; + order_id?: number; + user_id?: number; + asset?: string; + product_id?: number; + lock_up_period?: number; + principal?: string; + year_rate?: string; + product_type?: number; + interest?: string; + status?: number; + reinvest_status?: number; + redeem_account_type?: number; + origin_order?: string; + redeem_type?: number; + redeem_time?: string; + finish_time?: string; + create_time?: string; + year_rate_perent?: string; + total_year_rate_percent?: string; + total_interest?: string; + product_info?: FixedTermProductInfo; + bonus_info?: FixedTermBonusInfo; + coupon_info?: FixedTermCouponInfo; + redeem_at?: number; + finish_at?: number; + create_at?: number; + icon?: string; } ⋮---- -user_id: string; // User ID -transaction_id: string; // filled records ID -order_id: string; // Order ID -text: string; // User Order ID -symbol: string; // Currency pair -exchange_type: string; // Exchange -business_type: string; // Business Type -side: string; // Buy/Sell Direction -qty: string; // Trading size -price: string; // Fill Price -fee: string; // fee -fee_coin: string; // Fee currency -fee_rate: string; // Fee Rate -match_role: string; // Filled Role -rpnl: string; // Realized P&L -position_mode: string; // Position Mode -position_side: string; // Position Direction -create_time: string; // Created time +export interface FixedTermProduct { + id?: number; + name?: string; + asset?: string; + lock_up_period?: number; + min_lend_amount?: string; + user_max_lend_amount?: string; + total_lend_amount?: string; + year_rate?: string; + type?: number; + pre_redeem?: number; + reinvest?: number; + redeem_account?: number; + min_vip?: number; + max_vip?: number; + status?: number; + create_time?: string; + user_max_lend_volume?: string; + user_total_amount?: string; + sale_status?: number; +} ⋮---- -export interface CrossExAccountBook { - id: string; // Account Change Record ID - user_id: string; // User ID - business_id: string; // Business ID - type: string; // TRANSACTION, TRADING_FEE, FUNDING_FEE, LIQUIDATION_FEE, TRANSFER_IN, TRANSFER_OUT, BANKRUPT_COMPENSATION, AUTO_REPAY - exchange_type: string; // Exchange - coin: string; // Currency - change: string; // Change amount (positive indicates transfer in; negative indicates transfer out) - balance: string; // Balance after change - create_time: string; // Created time +export interface FixedTermProductSimple { + id?: number; + asset?: string; + lock_up_period?: number; + year_rate?: string; + type?: number; + pre_redeem?: number; + reinvest?: number; + simple_earn?: number; + min_vip?: number; + max_vip?: number; + sale_status?: number; } ⋮---- -id: string; // Account Change Record ID -user_id: string; // User ID -business_id: string; // Business ID -type: string; // TRANSACTION, TRADING_FEE, FUNDING_FEE, LIQUIDATION_FEE, TRANSFER_IN, TRANSFER_OUT, BANKRUPT_COMPENSATION, AUTO_REPAY -exchange_type: string; // Exchange -coin: string; // Currency -change: string; // Change amount (positive indicates transfer in; negative indicates transfer out) -balance: string; // Balance after change -create_time: string; // Created time +export interface GetEarnFixedTermProductsResponse { + code: number; + message: string; + data: { + list: FixedTermProduct[]; + total: number; + }; + timestamp: number; +} ⋮---- -export interface CrossExCoinDiscountRate { - coin: string; // Currency - exchange_type: string; // Exchange - tier: string; // Tier - min_value: string; // Minimum value - max_value: string; // Maximum value - discount_rate: string; // Discount rate +export interface GetEarnFixedTermProductsByAssetResponse { + code: number; + message: string; + data: { + list: FixedTermProductSimple[]; + }; + timestamp: number; } ⋮---- -coin: string; // Currency -exchange_type: string; // Exchange -tier: string; // Tier -min_value: string; // Minimum value -max_value: string; // Maximum value -discount_rate: string; // Discount rate - -================ -File: src/index.ts -================ -// Request Types +export interface CreateEarnFixedTermLendResponse { + code?: number; + message?: string; + data?: { + order_id?: number; + }; + timestamp?: number; +} +⋮---- +export interface GetEarnFixedTermLendsResponse { + code: number; + message: string; + data: { + list: FixedTermLendOrder[]; + total: number; + }; + timestamp: number; +} ⋮---- -// Response Types +export interface CreateEarnFixedTermPreRedeemResponse { + code?: number; + message?: string; + data?: Record; + timestamp?: number; +} ⋮---- -// Websockets Types +export interface FixedTermHistoryRecord { + id?: number; + order_id?: number; + user_id?: number; + asset?: string; + uniq_time?: string; + bonus_id?: number; + product_id?: number; + bonus_asset?: string; + total_principal?: string; + amount?: string; + asset_price?: string; + status?: number; + detail?: string; + create_time?: string; + create_at?: number; + lock_up_period?: number; +} ⋮---- -// Shared Types +export interface GetEarnFixedTermHistoryResponse { + code?: number; + message?: string; + data?: { + list?: FixedTermHistoryRecord[]; + total?: number; + }; + timestamp?: number; +} ================ -File: src/types/response/earn.ts +File: src/types/response/spot.ts ================ /**========================================================================================================================== - * EARN + * SPOT * ========================================================================================================================== */ ⋮---- -export interface DualInvestmentProduct { - id: number; - instrument_name: string; - invest_currency: string; - exercise_currency: string; - exercise_price: number; - delivery_time: number; - min_amount?: string; - min_copies: number; - max_copies: number; - /** @deprecated */ - per_value: string; - apy_display: string; - start_time: number; - end_time: number; - status: 'NOTSTARTED' | 'ONGOING' | 'ENDED'; +/** Limit-order take-profit / stop-loss on order responses (not re-exported; use request types for submits) */ +interface SpotOrderTPSL { + trigger_price: string; + order_price: string; } ⋮---- -/** @deprecated */ +/** `{}` cancels TP/SL; `null` leaves unchanged */ +type PatchSpotOrderTPSL = SpotOrderTPSL | {} | null; ⋮---- -/** GET /earn/dual/order-refund-preview */ -export interface DualOrderRefundPreview { - create_timest: number; - delivery_timest: number; - exercise_price: string; - invest_amount: string; - invest_currency: string; +export interface SpotCurrencyChain { name: string; - order_id: number; - req_id: string; - refund_service_charge: number; - settle_price: string; - settlement_amount: string; - settlement_currency: string; - settlement_interest: string; - settlement_principle: string; - type: string; - money_back_timest: number; + addr?: string; + withdraw_disabled: boolean; + withdraw_delayed: boolean; + deposit_disabled: boolean; } ⋮---- -/** GET /earn/dual/project-recommend item */ -export interface DualProjectRecommend { - id: number; - category: number; - type: string; - invest_currency: string; - exercise_currency: string; - apy_display: string; - exercise_price: string; - delivery_timest: number; - min_amount: string; - max_amount: string; - min_copies: number; - max_copies: number; - invest_days: number; - invest_hours: string; +export interface SpotCurrency { + currency: string; + name: string; + delisted: boolean; + withdraw_disabled: boolean; + withdraw_delayed: boolean; + deposit_disabled: boolean; + trade_disabled: boolean; + chain: string; + chains: SpotCurrencyChain[]; + /** Asset categories (e.g. stocks, metals, indices, forex, commodities). */ + category?: string[]; } ⋮---- -export interface DualInvestmentOrder { - id: number; - plan_id: number; - copies: string; - invest_amount: string; - settlement_amount: string; - create_time: number; - complete_time: number; - status: - | 'INIT' - | 'SETTLEMENT_SUCCESS' - | 'SETTLEMENT_PROCESSING' - | 'CANCELED' - | 'FAILED'; - invest_currency: string; - exercise_currency: string; - exercise_price: string; - settlement_price: string; - settlement_currency: string; - apy_display: string; - apy_settlement: string; - delivery_time: number; +/** Asset categories (e.g. stocks, metals, indices, forex, commodities). */ +⋮---- +export interface SpotTicker { + currency_pair: string; + last: string; + lowest_ask: string; + lowest_size: string; + highest_bid: string; + highest_size: string; + change_percentage: string; + change_utc0: string; + change_utc8: string; + base_volume: string; + quote_volume: string; + high_24h: string; + low_24h: string; + etf_net_value: string; + etf_pre_net_value: string | null; + etf_pre_timestamp: number | null; + etf_leverage: string | null; +} +⋮---- +export interface SpotOrderBook { + id?: number; + current: number; + update: number; + asks: [string, string][]; + bids: [string, string][]; +} +⋮---- +export interface SpotTrade { + id: string; + create_time: string; + create_time_ms: string; + currency_pair: string; + side: 'buy' | 'sell'; + role: 'taker' | 'maker'; + amount: string; + price: string; + order_id: string; + fee: string; + fee_currency: string; + point_fee: string; + gt_fee: string; + amend_text: string; + sequence_id: string; text: string; } ⋮---- -/**========================================================================================================================== - * EARN FIXED-TERM - * ========================================================================================================================== - */ +export type SpotCandle = [ + string, // Unix timestamp with second precision + string, // Trading volume in quote currency + string, // Closing price + string, // Highest price + string, // Lowest price + string, // Opening price + string, // Trading volume in base currency + boolean, // Whether the window is closed +]; ⋮---- -export interface FixedTermLadderApr { - apr: string; +string, // Unix timestamp with second precision +string, // Trading volume in quote currency +string, // Closing price +string, // Highest price +string, // Lowest price +string, // Opening price +string, // Trading volume in base currency +boolean, // Whether the window is closed +⋮---- +export interface SpotFeeRates { + user_id: number; + taker_fee: string; // For spot trading + maker_fee: string; // For spot trading + gt_discount: boolean; + gt_taker_fee: string; + gt_maker_fee: string; + loan_fee: string; + point_type: string; + currency_pair: string; + debit_fee: number; +} +⋮---- +taker_fee: string; // For spot trading +maker_fee: string; // For spot trading +⋮---- +export interface SpotAccount { + currency: string; + available: string; + locked: string; + update_id: number; + refresh_time: number; + last_update_time?: number; + trading_fee_rate?: string; +} +⋮---- +export interface SpotAccountBook { + id: string; + time: number; + currency: string; + change: string; + balance: string; + type: string; + code: string; + text: string; +} +⋮---- +export interface SubmitSpotBatchOrdersResp { + order_id: string; + amend_text: string; + text: string; + succeeded: boolean; + label: string; + message: string; + id: string; + create_time: string; + update_time: string; + create_time_ms: number; + update_time_ms: number; + status: 'open' | 'closed' | 'cancelled'; + currency_pair: string; + type: 'limit' | 'market'; + account: 'spot' | 'margin' | 'cross_margin' | 'unified'; + side: 'buy' | 'sell'; + amount: string; + price: string; + time_in_force: 'gtc' | 'ioc' | 'poc' | 'fok'; + iceberg: string; + auto_repay: boolean; left: string; - right: string; -} -⋮---- -export interface FixedTermProductInfo { - pre_redeem: number; - reinvest: number; - redeem_account: number; - min_vip: number; - max_vip: number; + filled_amount: string; + fill_price: string; + filled_total: string; + avg_deal_price: string; + fee: string; + fee_currency: string; + point_fee: string; + gt_fee: string; + gt_discount: boolean; + rebated_fee: string; + rebated_fee_currency: string; + stp_id: number; + stp_act: 'cn' | 'co' | 'cb' | '-'; + /** + * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). + */ + finish_as: 'open' | 'filled' | 'cancelled' | 'ioc' | 'poc' | 'stp'; } ⋮---- -export interface FixedTermBonusInfo { - id?: number; - product_id?: number; - asset?: string; - bonus_asset?: string; - kyc_limit?: string; - ladder_apr?: FixedTermLadderApr[]; - total_bonus_amount?: string; - user_total_bonus_amount?: string; - status?: number; - start_time?: string; - end_time?: string; - create_time?: string; - start_at?: number; - end_at?: number; - total_issued_amount?: string; - user_total_issued_amount?: string; - bonus_asset_price?: string; - product_asset_price?: string; - product_year_rate?: string; -} +/** + * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). + */ ⋮---- -export interface FixedTermCouponInfo { - id?: number; - business?: number; - user_id?: number; - asset?: string; - order_id?: number; - financial_rate_id?: number; - buy_limit_low?: string; - buy_limit_high?: string; - rate_day?: number; - rate_ratio?: string; - coupon_days?: number; - coupon_principal?: string; - coupon_year_rate?: string; - coupon_interest?: string; - status?: number; - finish_time?: string; +export interface SpotOrder { + id?: string; + text?: string; + amend_text?: string; create_time?: string; + update_time?: string; + create_time_ms?: number; + update_time_ms?: number; + status?: 'open' | 'closed' | 'cancelled'; + currency_pair: string; + type?: 'limit' | 'market'; + account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; + side: 'buy' | 'sell'; + amount: string; + price?: string; + time_in_force?: 'gtc' | 'ioc' | 'poc' | 'fok'; + iceberg?: string; + auto_borrow?: boolean; + auto_repay?: boolean; + left?: string; + filled_amount?: string; + fill_price?: string; + filled_total?: string; + avg_deal_price?: string; + fee?: string; + fee_currency?: string; + point_fee?: string; + gt_fee?: string; + gt_maker_fee?: string; + gt_taker_fee?: string; + gt_discount?: boolean; + rebated_fee?: string; + rebated_fee_currency?: string; + stp_id?: number; + stp_act?: 'cn' | 'co' | 'cb' | '-'; + /** + * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). + */ + finish_as?: 'open' | 'filled' | 'cancelled' | 'ioc' | 'poc' | 'stp'; + action_mode?: 'ACK' | 'RESULT' | 'FULL'; + stop_loss?: PatchSpotOrderTPSL; + stop_profit?: PatchSpotOrderTPSL; } ⋮---- -export interface FixedTermLendOrder { - id?: number; - business?: number; - order_id?: number; - user_id?: number; - asset?: string; - product_id?: number; - lock_up_period?: number; - principal?: string; - year_rate?: string; - product_type?: number; - interest?: string; - status?: number; - reinvest_status?: number; - redeem_account_type?: number; - origin_order?: string; - redeem_type?: number; - redeem_time?: string; - finish_time?: string; - create_time?: string; - year_rate_perent?: string; - total_year_rate_percent?: string; - total_interest?: string; - product_info?: FixedTermProductInfo; - bonus_info?: FixedTermBonusInfo; - coupon_info?: FixedTermCouponInfo; - redeem_at?: number; - finish_at?: number; - create_at?: number; - icon?: string; -} +/** + * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). + */ ⋮---- -export interface FixedTermProduct { - id?: number; - name?: string; - asset?: string; - lock_up_period?: number; - min_lend_amount?: string; - user_max_lend_amount?: string; - total_lend_amount?: string; - year_rate?: string; - type?: number; - pre_redeem?: number; - reinvest?: number; - redeem_account?: number; - min_vip?: number; - max_vip?: number; - status?: number; - create_time?: string; - user_max_lend_volume?: string; - user_total_amount?: string; - sale_status?: number; +export interface SpotInsuranceHistory { + currency: string; + balance: string; + time: number; } ⋮---- -export interface FixedTermProductSimple { +export interface SpotPriceTriggeredOrder { + trigger: { + price: string; + rule: '>=' | '<='; + expiration?: number; + }; + put: { + type?: 'limit' | 'market'; + side: 'buy' | 'sell'; + price: string; + amount: string; + account: 'normal' | 'margin' | 'cross_margin'; + time_in_force: 'gtc' | 'ioc'; + text?: string; + }; id?: number; - asset?: string; - lock_up_period?: number; - year_rate?: string; - type?: number; - pre_redeem?: number; - reinvest?: number; - simple_earn?: number; - min_vip?: number; - max_vip?: number; - sale_status?: number; + user?: number; + market: string; + ctime?: number; + ftime?: number; + fired_order_id?: number; + status?: 'open' | 'cancelled' | 'finish' | 'failed' | 'expired'; + reason?: string; } ⋮---- -export interface GetEarnFixedTermProductsResponse { - code: number; - message: string; - data: { - list: FixedTermProduct[]; - total: number; - }; - timestamp: number; +export interface GetSpotOpenOrdersResp { + currency_pair: string; + total: number; + orders: SpotOrder[]; } ⋮---- -export interface GetEarnFixedTermProductsByAssetResponse { - code: number; +export interface DeleteSpotBatchOrdersResp { + currency_pair: string; + id: string; + succeeded: boolean; + label: string; message: string; - data: { - list: FixedTermProductSimple[]; - }; - timestamp: number; + account: string; + text: string; } ⋮---- -export interface CreateEarnFixedTermLendResponse { - code?: number; - message?: string; - data?: { - order_id?: number; - }; - timestamp?: number; +export interface SpotHistoricTradeRecord { + id: string; + create_time: string; + create_time_ms: string; + currency_pair: string; + side: 'buy' | 'sell'; + role: 'taker' | 'maker'; + amount: string; + price: string; + order_id: string; + fee: string; + fee_currency: string; + point_fee: string; + gt_fee: string; + amend_text: string; + sequence_id: string; + text: string; + deal?: string; // v4.105.29: Total Executed Value } ⋮---- -export interface GetEarnFixedTermLendsResponse { - code: number; - message: string; - data: { - list: FixedTermLendOrder[]; - total: number; - }; - timestamp: number; -} +deal?: string; // v4.105.29: Total Executed Value ⋮---- -export interface CreateEarnFixedTermPreRedeemResponse { - code?: number; - message?: string; - data?: Record; - timestamp?: number; -} +export type SpotPovOrderStatus = + | 'CREATED' + | 'CANCELING' + | 'RUNNING' + | 'COMPLETED' + | 'EXPIRED' + | 'TERMINATED'; ⋮---- -export interface FixedTermHistoryRecord { - id?: number; - order_id?: number; - user_id?: number; - asset?: string; - uniq_time?: string; - bonus_id?: number; - product_id?: number; - bonus_asset?: string; - total_principal?: string; +export interface SpotPovOrder { + id?: string; + currency_pair?: string; + side?: string; amount?: string; - asset_price?: string; - status?: number; - detail?: string; - create_time?: string; - create_at?: number; - lock_up_period?: number; -} -⋮---- -export interface GetEarnFixedTermHistoryResponse { - code?: number; - message?: string; - data?: { - list?: FixedTermHistoryRecord[]; - total?: number; - }; - timestamp?: number; + participation_rate?: number; + ttl?: string; + limit_price?: string; + trigger_price?: string; + status?: SpotPovOrderStatus | string; + terminated_as?: string; + start_time_ms?: number; + end_time_ms?: number; + expire_time_ms?: number; + create_time_ms?: number; + update_time_ms?: number; + text?: string; } ================ @@ -9568,6 +12600,12 @@ export interface QuickRepaymentResp { export interface DeltaNeutralEnabled { enabled: boolean; } +⋮---- +/** POST /unified/leverage/user_setting failed currency entry */ +export interface LeverageFailedCurrency { + currency: string; + reason: string; +} ================ File: src/types/request/futures.ts @@ -9667,12 +12705,14 @@ export interface GetFuturesAccountBookReq { export interface GetFuturesPositionsReq { settle: 'btc' | 'usdt' | 'usd'; holding?: boolean; + limit?: number; // deprecated, use positions_limit instead positions_limit?: number; // v4.106.104: Replaces limit; omit to return full list, explicit values capped at 1-100 offset?: number; position_side?: string; // v4.105.3: Add position_side parameter for hedge mode support hedge_mode?: boolean; // v4.104.3: Add hedge_mode parameter } ⋮---- +limit?: number; // deprecated, use positions_limit instead positions_limit?: number; // v4.106.104: Replaces limit; omit to return full list, explicit values capped at 1-100 ⋮---- position_side?: string; // v4.105.3: Add position_side parameter for hedge mode support @@ -9929,392 +12969,84 @@ export interface GetTrailOrderListReq { page_size?: number; sort_by?: 1 | 2; hide_cancel?: boolean; - related_position?: 1 | 2; - sort_by_trigger?: boolean; - reduce_only?: 1 | 2; - side?: 1 | 2; -} -⋮---- -export interface GetTrailOrderDetailReq { - settle: 'btc' | 'usdt'; - id: number; -} -⋮---- -export interface UpdateTrailOrderReq { - settle: 'btc' | 'usdt'; - id: number; - amount?: string; - activation_price?: string; - is_gte_str?: string; - price_type?: 0 | 1 | 2 | 3; - price_offset?: string; -} -⋮---- -export interface GetTrailOrderChangeLogReq { - settle: 'btc' | 'usdt'; - id: number; - page_num?: number; - page_size?: number; -} -⋮---- -/** Chase limit order (autoorder/v1/chase) request types */ -export interface CreateChaseOrderReq { - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - amount: string; - price_limit: string; - offset_limit?: string; - reduce_only?: boolean; - text?: string; - is_dual_mode?: boolean; - price_type?: number; - price_gap_type?: number; - price_gap_value?: string; - pos_margin_mode?: 'isolated' | 'cross' | string; - position_mode?: string; -} -⋮---- -export interface StopChaseOrderReq { - settle: 'btc' | 'usdt' | 'usd'; - id?: string; - text?: string; -} -⋮---- -export interface StopAllChaseOrdersReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - pos_margin_mode?: 'isolated' | 'cross' | string; -} -⋮---- -export interface GetChaseOrdersReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - is_finished?: boolean; - start_at?: number; - end_at?: number; - page_num?: number; - page_size?: number; - /** 1 ORDER_SORT_CREATED_AT, 2 ORDER_SORT_FINISHED_AT */ - sort_by: 1 | 2; - hide_cancel?: boolean; - reduce_only?: 0 | 1 | 2; - side?: 0 | 1 | 2; -} -⋮---- -/** 1 ORDER_SORT_CREATED_AT, 2 ORDER_SORT_FINISHED_AT */ -⋮---- -export interface GetChaseOrderDetailReq { - settle: 'btc' | 'usdt' | 'usd'; - id: string; -} - -================ -File: src/types/response/spot.ts -================ -/**========================================================================================================================== - * SPOT - * ========================================================================================================================== - */ -⋮---- -/** Limit-order take-profit / stop-loss on order responses (not re-exported; use request types for submits) */ -interface SpotOrderTPSL { - trigger_price: string; - order_price: string; -} -⋮---- -/** `{}` cancels TP/SL; `null` leaves unchanged */ -type PatchSpotOrderTPSL = SpotOrderTPSL | {} | null; -⋮---- -export interface SpotCurrencyChain { - name: string; - addr?: string; - withdraw_disabled: boolean; - withdraw_delayed: boolean; - deposit_disabled: boolean; -} -⋮---- -export interface SpotCurrency { - currency: string; - name: string; - delisted: boolean; - withdraw_disabled: boolean; - withdraw_delayed: boolean; - deposit_disabled: boolean; - trade_disabled: boolean; - chain: string; - chains: SpotCurrencyChain[]; - /** Asset categories (e.g. stocks, metals, indices, forex, commodities). */ - category?: string[]; -} -⋮---- -/** Asset categories (e.g. stocks, metals, indices, forex, commodities). */ -⋮---- -export interface SpotTicker { - currency_pair: string; - last: string; - lowest_ask: string; - lowest_size: string; - highest_bid: string; - highest_size: string; - change_percentage: string; - change_utc0: string; - change_utc8: string; - base_volume: string; - quote_volume: string; - high_24h: string; - low_24h: string; - etf_net_value: string; - etf_pre_net_value: string | null; - etf_pre_timestamp: number | null; - etf_leverage: string | null; -} -⋮---- -export interface SpotOrderBook { - id?: number; - current: number; - update: number; - asks: [string, string][]; - bids: [string, string][]; -} -⋮---- -export interface SpotTrade { - id: string; - create_time: string; - create_time_ms: string; - currency_pair: string; - side: 'buy' | 'sell'; - role: 'taker' | 'maker'; - amount: string; - price: string; - order_id: string; - fee: string; - fee_currency: string; - point_fee: string; - gt_fee: string; - amend_text: string; - sequence_id: string; - text: string; -} -⋮---- -export type SpotCandle = [ - string, // Unix timestamp with second precision - string, // Trading volume in quote currency - string, // Closing price - string, // Highest price - string, // Lowest price - string, // Opening price - string, // Trading volume in base currency - boolean, // Whether the window is closed -]; -⋮---- -string, // Unix timestamp with second precision -string, // Trading volume in quote currency -string, // Closing price -string, // Highest price -string, // Lowest price -string, // Opening price -string, // Trading volume in base currency -boolean, // Whether the window is closed -⋮---- -export interface SpotFeeRates { - user_id: number; - taker_fee: string; // For spot trading - maker_fee: string; // For spot trading - gt_discount: boolean; - gt_taker_fee: string; - gt_maker_fee: string; - loan_fee: string; - point_type: string; - currency_pair: string; - debit_fee: number; + related_position?: 1 | 2; + sort_by_trigger?: boolean; + reduce_only?: 1 | 2; + side?: 1 | 2; } ⋮---- -taker_fee: string; // For spot trading -maker_fee: string; // For spot trading +export interface GetTrailOrderDetailReq { + settle: 'btc' | 'usdt'; + id: number; +} ⋮---- -export interface SpotAccount { - currency: string; - available: string; - locked: string; - update_id: number; - refresh_time: number; - last_update_time?: number; - trading_fee_rate?: string; +export interface UpdateTrailOrderReq { + settle: 'btc' | 'usdt'; + id: number; + amount?: string; + activation_price?: string; + is_gte_str?: string; + price_type?: 0 | 1 | 2 | 3; + price_offset?: string; } ⋮---- -export interface SpotAccountBook { - id: string; - time: number; - currency: string; - change: string; - balance: string; - type: string; - code: string; - text: string; +export interface GetTrailOrderChangeLogReq { + settle: 'btc' | 'usdt'; + id: number; + page_num?: number; + page_size?: number; } ⋮---- -export interface SubmitSpotBatchOrdersResp { - order_id: string; - amend_text: string; - text: string; - succeeded: boolean; - label: string; - message: string; - id: string; - create_time: string; - update_time: string; - create_time_ms: number; - update_time_ms: number; - status: 'open' | 'closed' | 'cancelled'; - currency_pair: string; - type: 'limit' | 'market'; - account: 'spot' | 'margin' | 'cross_margin' | 'unified'; - side: 'buy' | 'sell'; +/** Chase limit order (autoorder/v1/chase) request types */ +export interface CreateChaseOrderReq { + settle: 'btc' | 'usdt' | 'usd'; + contract: string; amount: string; - price: string; - time_in_force: 'gtc' | 'ioc' | 'poc' | 'fok'; - iceberg: string; - auto_repay: boolean; - left: string; - filled_amount: string; - fill_price: string; - filled_total: string; - avg_deal_price: string; - fee: string; - fee_currency: string; - point_fee: string; - gt_fee: string; - gt_discount: boolean; - rebated_fee: string; - rebated_fee_currency: string; - stp_id: number; - stp_act: 'cn' | 'co' | 'cb' | '-'; - /** - * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). - */ - finish_as: 'open' | 'filled' | 'cancelled' | 'ioc' | 'poc' | 'stp'; + price_limit: string; + offset_limit?: string; + reduce_only?: boolean; + text?: string; + is_dual_mode?: boolean; + price_type?: number; + price_gap_type?: number; + price_gap_value?: string; + pos_margin_mode?: 'isolated' | 'cross' | string; + position_mode?: string; } ⋮---- -/** - * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). - */ -⋮---- -export interface SpotOrder { +export interface StopChaseOrderReq { + settle: 'btc' | 'usdt' | 'usd'; id?: string; text?: string; - amend_text?: string; - create_time?: string; - update_time?: string; - create_time_ms?: number; - update_time_ms?: number; - status?: 'open' | 'closed' | 'cancelled'; - currency_pair: string; - type?: 'limit' | 'market'; - account?: 'spot' | 'margin' | 'cross_margin' | 'unified'; - side: 'buy' | 'sell'; - amount: string; - price?: string; - time_in_force?: 'gtc' | 'ioc' | 'poc' | 'fok'; - iceberg?: string; - auto_borrow?: boolean; - auto_repay?: boolean; - left?: string; - filled_amount?: string; - fill_price?: string; - filled_total?: string; - avg_deal_price?: string; - fee?: string; - fee_currency?: string; - point_fee?: string; - gt_fee?: string; - gt_maker_fee?: string; - gt_taker_fee?: string; - gt_discount?: boolean; - rebated_fee?: string; - rebated_fee_currency?: string; - stp_id?: number; - stp_act?: 'cn' | 'co' | 'cb' | '-'; - /** - * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). - */ - finish_as?: 'open' | 'filled' | 'cancelled' | 'ioc' | 'poc' | 'stp'; - action_mode?: 'ACK' | 'RESULT' | 'FULL'; - stop_loss?: PatchSpotOrderTPSL; - stop_profit?: PatchSpotOrderTPSL; -} -⋮---- -/** - * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). - */ -⋮---- -export interface SpotInsuranceHistory { - currency: string; - balance: string; - time: number; } ⋮---- -export interface SpotPriceTriggeredOrder { - trigger: { - price: string; - rule: '>=' | '<='; - expiration?: number; - }; - put: { - type?: 'limit' | 'market'; - side: 'buy' | 'sell'; - price: string; - amount: string; - account: 'normal' | 'margin' | 'cross_margin'; - time_in_force: 'gtc' | 'ioc'; - text?: string; - }; - id?: number; - user?: number; - market: string; - ctime?: number; - ftime?: number; - fired_order_id?: number; - status?: 'open' | 'cancelled' | 'finish' | 'failed' | 'expired'; - reason?: string; +export interface StopAllChaseOrdersReq { + settle: 'btc' | 'usdt' | 'usd'; + contract?: string; + pos_margin_mode?: 'isolated' | 'cross' | string; } ⋮---- -export interface GetSpotOpenOrdersResp { - currency_pair: string; - total: number; - orders: SpotOrder[]; +export interface GetChaseOrdersReq { + settle: 'btc' | 'usdt' | 'usd'; + contract?: string; + is_finished?: boolean; + start_at?: number; + end_at?: number; + page_num?: number; + page_size?: number; + /** 1 ORDER_SORT_CREATED_AT, 2 ORDER_SORT_FINISHED_AT */ + sort_by: 1 | 2; + hide_cancel?: boolean; + reduce_only?: 0 | 1 | 2; + side?: 0 | 1 | 2; } ⋮---- -export interface DeleteSpotBatchOrdersResp { - currency_pair: string; - id: string; - succeeded: boolean; - label: string; - message: string; - account: string; - text: string; -} +/** 1 ORDER_SORT_CREATED_AT, 2 ORDER_SORT_FINISHED_AT */ ⋮---- -export interface SpotHistoricTradeRecord { +export interface GetChaseOrderDetailReq { + settle: 'btc' | 'usdt' | 'usd'; id: string; - create_time: string; - create_time_ms: string; - currency_pair: string; - side: 'buy' | 'sell'; - role: 'taker' | 'maker'; - amount: string; - price: string; - order_id: string; - fee: string; - fee_currency: string; - point_fee: string; - gt_fee: string; - amend_text: string; - sequence_id: string; - text: string; - deal?: string; // v4.105.29: Total Executed Value } -⋮---- -deal?: string; // v4.105.29: Total Executed Value ================ File: src/types/response/futures.ts @@ -11413,8 +14145,8 @@ File: README.md

- - SDK Logo + + SDK Logo

@@ -11422,15 +14154,15 @@ File: README.md [![npm version](https://img.shields.io/npm/v/gateio-api)][1] [![npm size](https://img.shields.io/bundlephobia/min/gateio-api/latest)][1] [![npm downloads](https://img.shields.io/npm/dt/gateio-api)][1] -[![Build & Test](https://github.com/tiagosiebler/gateio-api/actions/workflows/e2etest.yml/badge.svg?branch=master)](https://github.com/tiagosiebler/gateio-api/actions/workflows/e2etest.yml) -[![last commit](https://img.shields.io/github/last-commit/tiagosiebler/gateio-api)][1] +[![Build & Test](https://github.com/sieblyio/gateio-api/actions/workflows/e2etest.yml/badge.svg?branch=master)](https://github.com/sieblyio/gateio-api/actions/workflows/e2etest.yml) +[![last commit](https://img.shields.io/github/last-commit/sieblyio/gateio-api)][1] [![Telegram](https://img.shields.io/badge/chat-on%20telegram-blue.svg)](https://t.me/nodetraders) -[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/tiagosiebler/gateio-api) +[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/sieblyio/gateio-api) [1]: https://www.npmjs.com/package/gateio-api > [!TIP] -> Upcoming change: As part of the [Siebly.io](https://siebly.io/) brand, this SDK will soon be hosted under the [Siebly.io GitHub organisation](https://github.com/sieblyio). The migration is seamless and requires no user changes. +> Upcoming change: As part of the [Siebly.io](https://siebly.io/) brand, this SDK is now hosted under our [Siebly.io GitHub organisation](https://github.com/sieblyio). The migration is seamless and requires no user changes. Updated & performant JavaScript & Node.js SDK for the Gate.com (gate.io) REST APIs and WebSockets: @@ -11503,7 +14235,7 @@ Refer to the [examples](./examples) folder for implementation demos, including: ## Issues & Discussion -- Issues? Check the [issues tab](https://github.com/tiagosiebler/gateio-api/issues). +- Issues? Check the [issues tab](https://github.com/sieblyio/gateio-api/issues). - Discuss & collaborate with other node devs? Join our [Node.js Algo Traders](https://t.me/nodetraders) engineering community on telegram. - Follow our announcement channel for real-time updates on [X/Twitter](https://x.com/sieblyio) @@ -11515,20 +14247,20 @@ Check out our JavaScript/TypeScript/Node.js SDKs & Projects: - Visit our website: [https://Siebly.io](https://siebly.io/) - Try our REST API & WebSocket SDKs published on npmjs: - - [Bybit Node.js SDK: bybit-api](https://www.npmjs.com/package/bybit-api) - - [Kraken Node.js SDK: @siebly/kraken-api](https://www.npmjs.com/package/@siebly/kraken-api) - - [OKX Node.js SDK: okx-api](https://www.npmjs.com/package/okx-api) - - [Binance Node.js SDK: binance](https://www.npmjs.com/package/binance) - - [Gate (gate.com) Node.js SDK: gateio-api](https://www.npmjs.com/package/gateio-api) - - [Bitget Node.js SDK: bitget-api](https://www.npmjs.com/package/bitget-api) - - [Kucoin Node.js SDK: kucoin-api](https://www.npmjs.com/package/kucoin-api) - - [Coinbase Node.js SDK: coinbase-api](https://www.npmjs.com/package/coinbase-api) - - [Bitmart Node.js SDK: bitmart-api](https://www.npmjs.com/package/bitmart-api) + - [Bybit JavaScript SDK: bybit-api](https://www.npmjs.com/package/bybit-api) + - [Kraken JavaScript SDK: @siebly/kraken-api](https://www.npmjs.com/package/@siebly/kraken-api) + - [OKX JavaScript SDK: okx-api](https://www.npmjs.com/package/okx-api) + - [Binance JavaScript SDK: binance](https://www.npmjs.com/package/binance) + - [Gate (gate.com) JavaScript SDK: gateio-api](https://www.npmjs.com/package/gateio-api) + - [Bitget JavaScript SDK: bitget-api](https://www.npmjs.com/package/bitget-api) + - [Kucoin JavaScript SDK: kucoin-api](https://www.npmjs.com/package/kucoin-api) + - [Coinbase JavaScript SDK: coinbase-api](https://www.npmjs.com/package/coinbase-api) + - [HTX JavaScript SDK: @siebly/htx-api](https://www.npmjs.com/package/@siebly/htx-api) - Try my misc utilities: - [OrderBooks Node.js: orderbooks](https://www.npmjs.com/package/orderbooks) - [Crypto Exchange Account State Cache: accountstate](https://www.npmjs.com/package/accountstate) - Check out my examples: - - [awesome-crypto-examples Node.js](https://github.com/tiagosiebler/awesome-crypto-examples) + - [awesome-crypto-examples Node.js](https://github.com/sieblyio/awesome-crypto-examples) ## Documentation @@ -11916,7 +14648,7 @@ This file contains AI optimised structure of all the functions in this package, ## Used By -[![Repository Users Preview Image](https://dependents.info/tiagosiebler/gateio-api/image)](https://github.com/tiagosiebler/gateio-api/network/dependents) +[![Repository Users Preview Image](https://dependents.info/sieblyio/gateio-api/image)](https://github.com/sieblyio/gateio-api/network/dependents) --- @@ -11934,7 +14666,7 @@ Have my projects helped you? Share the love, there are many ways you can show yo - Sign up with my referral links: - OKX (receive a 20% fee discount!): https://www.okx.com/join/42013004 - Binance (receive a 20% fee discount!): https://accounts.binance.com/register?ref=OKFFGIJJ - - HyperLiquid (receive a 4% fee discount!): https://app.hyperliquid.xyz/join/SDK + - HyperLiquid (receive a 4% fee discount!): https://app.hyperliquid.xyz/join/SIEBLY - Gate: https://www.gate.io/signup/NODESDKS?ref_type=103 @@ -11998,6 +14730,7 @@ import { UpdateAutoInvestPlanReq, } from './types/request/autoinvest.js'; import { + CancelBatchCrossExOrdersReq, CloseCrossExPositionReq, CreateCrossExConvertOrderReq, CreateCrossExConvertQuoteReq, @@ -12015,6 +14748,8 @@ import { GetCrossExInterestRateReq, GetCrossExMarginPositionLeverageReq, GetCrossExMarginPositionsReq, + GetCrossExMarketFundingInfoReq, + GetCrossExMarketTickersReq, GetCrossExOpenOrdersReq, GetCrossExPositionLeverageReq, GetCrossExPositionsReq, @@ -12190,6 +14925,8 @@ import { } from './types/request/rebate.js'; import { CancelSpotBatchOrdersReq, + CancelSpotPovOrdersReq, + CreateSpotPovOrderReq, DeleteSpotOrderReq, GetSpotAccountBookReq, GetSpotAutoOrdersReq, @@ -12198,6 +14935,7 @@ import { GetSpotOrderBookReq, GetSpotOrderReq, GetSpotOrdersReq, + GetSpotPovOrdersReq, GetSpotTradesReq, GetSpotTradingHistoryReq, SubmitSpotClosePosCrossDisabledReq, @@ -12205,6 +14943,19 @@ import { UpdateSpotBatchOrdersReq, UpdateSpotOrderReq, } from './types/request/spot.js'; +import { + CloseStockPositionReq, + CreateStockOrderReq, + CreateStockTransactionReq, + GetStockOrderHistoryReq, + GetStockOrdersReq, + GetStockPositionsReq, + GetStockSymbolDetailReq, + GetStockSymbolsReq, + GetStockTransactionsReq, + GetStockUserAssetsReq, + UpdateStockOrderReq, +} from './types/request/stock.js'; import { CreateSubAccountApiKeyReq, CreateSubAccountReq, @@ -12217,6 +14968,7 @@ import { TradFiGetKlinesParams, TradFiGetOrderHistoryParams, TradFiGetPositionHistoryParams, + TradFiGetSymbolCommissionsParams, TradFiGetSymbolDetailParams, TradFiGetTransactionsParams, TradFiModifyOrderReq, @@ -12231,6 +14983,7 @@ import { PortfolioMarginCalculatorReq, SetUnifiedAccountModeReq, SetUnifiedDeltaNeutralReq, + SetUserLeverageReq, SubmitUnifiedBorrowOrRepayReq, SubmitUnifiedLoanRepayReq, } from './types/request/unified.js'; @@ -12239,6 +14992,7 @@ import { GetSavedAddressReq, GetSmallBalanceHistoryReq, GetSubAccountBalancesReq, + GetTransferReq, GetWithdrawalDepositRecordsReq, ListPushOrdersReq, SubmitMainSubTransferReq, @@ -12273,6 +15027,7 @@ import { CreateAutoInvestPlanResp, } from './types/response/autoinvest.js'; import { + CancelBatchCrossExOrdersResp, CancelCrossExOrderResp, CloseCrossExPositionResp, CreateCrossExConvertOrderResp, @@ -12291,6 +15046,8 @@ import { CrossExInterestRate, CrossExMarginPosition, CrossExMarginPositionLeverage, + CrossExMarketFundingInfo, + CrossExMarketTicker, CrossExOrder, CrossExPosition, CrossExPositionLeverage, @@ -12467,11 +15224,29 @@ import { SpotInsuranceHistory, SpotOrder, SpotOrderBook, + SpotPovOrder, SpotPriceTriggeredOrder, SpotTicker, SpotTrade, SubmitSpotBatchOrdersResp, } from './types/response/spot.js'; +import { + StockApiResp, + StockClosePositionResult, + StockCreateOrderResult, + StockExchangeItem, + StockFeeRateItem, + StockListData, + StockOrderBook, + StockOrderHistoryItem, + StockOrderItem, + StockPositionItem, + StockSymbolDetailItem, + StockSymbolItem, + StockTransactionItem, + StockUpdateOrderResult, + StockUserAssets, +} from './types/response/stock.js'; import { CreatedSubAccountAPIKey, SubAccount, @@ -12493,6 +15268,7 @@ import { TradFiOrderLog, TradFiPositionHistoryItem, TradFiPositionItem, + TradFiSymbolCommissionItem, TradFiSymbolDetailItem, TradFiSymbolItem, TradFiTicker, @@ -12500,6 +15276,7 @@ import { } from './types/response/tradfi.js'; import { DeltaNeutralEnabled, + LeverageFailedCurrency, MarginTier, PortfolioMarginCalculation, QuickEstimatedRepayment, @@ -12515,6 +15292,7 @@ import { UserCurrencyLeverageConfig, } from './types/response/unified.js'; import { + AccountTransferDetail, CreateDepositAddressResp, CurrencyChain, DepositRecord, @@ -12676,6 +15454,8 @@ getDepositRecords( */ submitTransfer(params: SubmitTransferReq): Promise< ⋮---- +getTransfer(params: GetTransferReq): Promise +⋮---- /** * Transfer between main and sub accounts * @@ -13138,6 +15918,10 @@ portfolioMarginCalculate( params: PortfolioMarginCalculatorReq, ): Promise ⋮---- +setUserLeverage( + params: SetUserLeverageReq, +): Promise +⋮---- /** * Query user currency leverage configuration * @@ -13620,6 +16404,18 @@ cancelSpotTriggeredOrder(params: { order_id: string; }): Promise ⋮---- +listSpotPovOrders(params: GetSpotPovOrdersReq): Promise +⋮---- +createSpotPovOrder(params: CreateSpotPovOrderReq): Promise +⋮---- +cancelSpotPovOrders( + params?: CancelSpotPovOrdersReq, +): Promise +⋮---- +getSpotPovOrder(params: +⋮---- +cancelSpotPovOrder(params: +⋮---- /** * Set collateral currency * @@ -16437,6 +19233,10 @@ createCrossExOrder( params: CreateCrossExOrderReq, ): Promise ⋮---- +cancelBatchCrossExOrders( + params: CancelBatchCrossExOrdersReq[], +): Promise +⋮---- /** * Cancel Order * @@ -16728,6 +19528,14 @@ getCrossExCoinDiscountRate( params?: GetCrossExCoinDiscountRateReq, ): Promise ⋮---- +listCrossExMarketTickers( + params?: GetCrossExMarketTickersReq, +): Promise +⋮---- +listCrossExMarketFundingInfo( + params?: GetCrossExMarketFundingInfoReq, +): Promise +⋮---- /**========================================================================================================================== * ALPHA * ========================================================================================================================== @@ -16825,6 +19633,10 @@ getTradFiSymbolCategories(): Promise< ⋮---- getTradFiSymbols(): Promise>> ⋮---- +getTradFiSymbolCommissions( + params?: TradFiGetSymbolCommissionsParams, +): Promise>> +⋮---- getTradFiSymbolDetail( params: TradFiGetSymbolDetailParams, ): Promise>> @@ -16890,13 +19702,72 @@ getTradFiPositionHistory( getTradFiOrderLog(params: { log_id: number | string; }): Promise> +⋮---- +// ============ Stock ============ +⋮---- +getStockUserAssets( + params?: GetStockUserAssetsReq, +): Promise> +⋮---- +getStockSymbols( + params?: GetStockSymbolsReq, +): Promise>> +⋮---- +getStockSymbolDetail( + params?: GetStockSymbolDetailReq, +): Promise>> +⋮---- +getStockOrderBook(symbol: string): Promise> +⋮---- +getStockOrders( + params?: GetStockOrdersReq, +): Promise>> +⋮---- +createStockOrder( + params: CreateStockOrderReq, +): Promise> +⋮---- +cancelAllStockOrders(): Promise>> +⋮---- +getStockOrderHistory( + params?: GetStockOrderHistoryReq, +): Promise>> +⋮---- +updateStockOrder( + orderId: number, + params: UpdateStockOrderReq, +): Promise> +⋮---- +cancelStockOrder( + orderId: number, +): Promise>> +⋮---- +getStockPositions( + params?: GetStockPositionsReq, +): Promise>> +⋮---- +closeStockPosition( + params: CloseStockPositionReq, +): Promise> +⋮---- +getStockTransactions( + params?: GetStockTransactionsReq, +): Promise>> +⋮---- +createStockTransaction( + params: CreateStockTransactionReq, +): Promise>> +⋮---- +getStockExchanges(): Promise>> +⋮---- +getStockFeeRate(): Promise>> ================ File: package.json ================ { "name": "gateio-api", - "version": "1.5.5", + "version": "1.6.2", "description": "Complete & Robust Node.js SDK for Gate.com's REST APIs, WebSockets & WebSocket APIs, with TypeScript declarations.", "scripts": { "clean": "rm -rf dist/*", @@ -16925,14 +19796,14 @@ File: package.json "Jerko J (https://github.com/JJ-Cro)" ], "dependencies": { + "@types/ws": "^8.18.1", "axios": "^1.13.2", "isomorphic-ws": "^4.0.1", - "ws": "^8.18.3" + "ws": "8.21.1" }, "devDependencies": { "@types/jest": "^29.5.12", "@types/node": "^22.10.2", - "@types/ws": "^8.5.10", "@typescript-eslint/eslint-plugin": "^8.18.0", "@typescript-eslint/parser": "^8.18.0", "eslint": "^8.29.0", @@ -16945,7 +19816,6 @@ File: package.json "ts-node": "^10.9.2", "typescript": "^5.7.3", "webpack": "^5.0.0", - "webpack-bundle-analyzer": "^5.1.1", "webpack-cli": "^4.0.0" }, "keywords": [ @@ -16985,12 +19855,12 @@ File: package.json "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/tiagosiebler/gateio-api" + "url": "git+https://github.com/sieblyio/gateio-api.git" }, "bugs": { - "url": "https://github.com/tiagosiebler/gateio-api/issues" + "url": "https://github.com/sieblyio/gateio-api/issues" }, - "homepage": "https://github.com/tiagosiebler/gateio-api#readme" + "homepage": "https://github.com/sieblyio/gateio-api#readme" } diff --git a/package-lock.json b/package-lock.json index 617de21..eaa7c8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gateio-api", - "version": "1.6.1", + "version": "1.6.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gateio-api", - "version": "1.6.1", + "version": "1.6.2", "license": "MIT", "dependencies": { "@types/ws": "^8.18.1", diff --git a/package.json b/package.json index 41858db..81b1bf6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gateio-api", - "version": "1.6.1", + "version": "1.6.2", "description": "Complete & Robust Node.js SDK for Gate.com's REST APIs, WebSockets & WebSocket APIs, with TypeScript declarations.", "scripts": { "clean": "rm -rf dist/*", diff --git a/src/RestClient.ts b/src/RestClient.ts index d49f76d..ddf889f 100644 --- a/src/RestClient.ts +++ b/src/RestClient.ts @@ -33,6 +33,7 @@ import { UpdateAutoInvestPlanReq, } from './types/request/autoinvest.js'; import { + CancelBatchCrossExOrdersReq, CloseCrossExPositionReq, CreateCrossExConvertOrderReq, CreateCrossExConvertQuoteReq, @@ -50,6 +51,8 @@ import { GetCrossExInterestRateReq, GetCrossExMarginPositionLeverageReq, GetCrossExMarginPositionsReq, + GetCrossExMarketFundingInfoReq, + GetCrossExMarketTickersReq, GetCrossExOpenOrdersReq, GetCrossExPositionLeverageReq, GetCrossExPositionsReq, @@ -225,6 +228,8 @@ import { } from './types/request/rebate.js'; import { CancelSpotBatchOrdersReq, + CancelSpotPovOrdersReq, + CreateSpotPovOrderReq, DeleteSpotOrderReq, GetSpotAccountBookReq, GetSpotAutoOrdersReq, @@ -233,6 +238,7 @@ import { GetSpotOrderBookReq, GetSpotOrderReq, GetSpotOrdersReq, + GetSpotPovOrdersReq, GetSpotTradesReq, GetSpotTradingHistoryReq, SubmitSpotClosePosCrossDisabledReq, @@ -240,6 +246,19 @@ import { UpdateSpotBatchOrdersReq, UpdateSpotOrderReq, } from './types/request/spot.js'; +import { + CloseStockPositionReq, + CreateStockOrderReq, + CreateStockTransactionReq, + GetStockOrderHistoryReq, + GetStockOrdersReq, + GetStockPositionsReq, + GetStockSymbolDetailReq, + GetStockSymbolsReq, + GetStockTransactionsReq, + GetStockUserAssetsReq, + UpdateStockOrderReq, +} from './types/request/stock.js'; import { CreateSubAccountApiKeyReq, CreateSubAccountReq, @@ -252,6 +271,7 @@ import { TradFiGetKlinesParams, TradFiGetOrderHistoryParams, TradFiGetPositionHistoryParams, + TradFiGetSymbolCommissionsParams, TradFiGetSymbolDetailParams, TradFiGetTransactionsParams, TradFiModifyOrderReq, @@ -266,6 +286,7 @@ import { PortfolioMarginCalculatorReq, SetUnifiedAccountModeReq, SetUnifiedDeltaNeutralReq, + SetUserLeverageReq, SubmitUnifiedBorrowOrRepayReq, SubmitUnifiedLoanRepayReq, } from './types/request/unified.js'; @@ -274,6 +295,7 @@ import { GetSavedAddressReq, GetSmallBalanceHistoryReq, GetSubAccountBalancesReq, + GetTransferReq, GetWithdrawalDepositRecordsReq, ListPushOrdersReq, SubmitMainSubTransferReq, @@ -308,6 +330,7 @@ import { CreateAutoInvestPlanResp, } from './types/response/autoinvest.js'; import { + CancelBatchCrossExOrdersResp, CancelCrossExOrderResp, CloseCrossExPositionResp, CreateCrossExConvertOrderResp, @@ -326,6 +349,8 @@ import { CrossExInterestRate, CrossExMarginPosition, CrossExMarginPositionLeverage, + CrossExMarketFundingInfo, + CrossExMarketTicker, CrossExOrder, CrossExPosition, CrossExPositionLeverage, @@ -502,11 +527,29 @@ import { SpotInsuranceHistory, SpotOrder, SpotOrderBook, + SpotPovOrder, SpotPriceTriggeredOrder, SpotTicker, SpotTrade, SubmitSpotBatchOrdersResp, } from './types/response/spot.js'; +import { + StockApiResp, + StockClosePositionResult, + StockCreateOrderResult, + StockExchangeItem, + StockFeeRateItem, + StockListData, + StockOrderBook, + StockOrderHistoryItem, + StockOrderItem, + StockPositionItem, + StockSymbolDetailItem, + StockSymbolItem, + StockTransactionItem, + StockUpdateOrderResult, + StockUserAssets, +} from './types/response/stock.js'; import { CreatedSubAccountAPIKey, SubAccount, @@ -528,6 +571,7 @@ import { TradFiOrderLog, TradFiPositionHistoryItem, TradFiPositionItem, + TradFiSymbolCommissionItem, TradFiSymbolDetailItem, TradFiSymbolItem, TradFiTicker, @@ -535,6 +579,7 @@ import { } from './types/response/tradfi.js'; import { DeltaNeutralEnabled, + LeverageFailedCurrency, MarginTier, PortfolioMarginCalculation, QuickEstimatedRepayment, @@ -550,6 +595,7 @@ import { UserCurrencyLeverageConfig, } from './types/response/unified.js'; import { + AccountTransferDetail, CreateDepositAddressResp, CurrencyChain, DepositRecord, @@ -779,6 +825,18 @@ export class RestClient extends BaseRestClient { return this.postPrivate('/wallet/transfers', { body: params }); } + /** + * Get trading account transfer details + * + * Retrieve the current user's trading account transfer details by tx_id. Response includes transfer status, currency, amount, source and destination account types, and applicable settlement currency or margin currency pair. + * + * @param params Parameters containing the transfer transaction ID + * @returns Promise + */ + getTransfer(params: GetTransferReq): Promise { + return this.getPrivate('/wallet/transfers', params); + } + /** * Transfer between main and sub accounts * @@ -1346,6 +1404,20 @@ export class RestClient extends BaseRestClient { return this.post('/unified/portfolio_calculator', { body: params }); } + /** + * Set leverage for all borrowed currencies + * + * Set leverage for all of a user's borrowed currencies. Currencies with outstanding loans cannot be changed. Values above a currency's leverage limit are capped. The response lists currencies whose updates failed together with the failure reason. + * + * @param params Parameters containing the leverage value + * @returns Promise + */ + setUserLeverage( + params: SetUserLeverageReq, + ): Promise { + return this.postPrivate('/unified/leverage/user_setting', { body: params }); + } + /** * Query user currency leverage configuration * @@ -1979,6 +2051,68 @@ export class RestClient extends BaseRestClient { return this.deletePrivate(`/spot/price_orders/${params.order_id}`); } + /** + * List Spot POV orders + * + * List percentage-of-volume strategy orders. Status defaults to open when listing active orders. + * + * @param params Parameters for listing Spot POV orders + * @returns Promise + */ + listSpotPovOrders(params: GetSpotPovOrdersReq): Promise { + return this.getPrivate('/spot/pov_orders', params); + } + + /** + * Create a Spot POV order + * + * Create a percentage-of-volume strategy order with a target participation rate, validity period, and optional limit/trigger prices. + * + * @param params Parameters for creating a Spot POV order + * @returns Promise + */ + createSpotPovOrder(params: CreateSpotPovOrderReq): Promise { + return this.postPrivate('/spot/pov_orders', { body: params }); + } + + /** + * Cancel Spot POV orders + * + * Cancel Spot POV orders in bulk. Optionally filter by currency pair. + * + * @param params Optional parameters for cancelling Spot POV orders + * @returns Promise + */ + cancelSpotPovOrders( + params?: CancelSpotPovOrdersReq, + ): Promise { + return this.postPrivate('/spot/pov_orders/cancel', { query: params }); + } + + /** + * Query Spot POV order details + * + * Supports the order ID returned after creation, or the custom ID specified in the text field. + * + * @param params Parameters containing the order ID + * @returns Promise + */ + getSpotPovOrder(params: { order_id: string }): Promise { + return this.getPrivate(`/spot/pov_orders/${params.order_id}`); + } + + /** + * Cancel a Spot POV order + * + * Supports the order ID returned after creation, or the custom ID specified in the text field. + * + * @param params Parameters containing the order ID + * @returns Promise + */ + cancelSpotPovOrder(params: { order_id: string }): Promise { + return this.postPrivate(`/spot/pov_orders/${params.order_id}/cancel`); + } + /** * Set collateral currency * @@ -5684,6 +5818,20 @@ export class RestClient extends BaseRestClient { return this.postPrivate('/crossex/orders', { body: params }); } + /** + * Batch cancel CrossEx orders + * + * Cancel multiple CrossEx orders by order_id or custom text. When both are provided, order_id takes precedence. Each result reports whether the request was accepted plus any error label and message. Rate Limit: 100 requests per 10 seconds + * + * @param params Array of cancel requests (order_id and/or text) + * @returns Promise with array of batch cancel results + */ + cancelBatchCrossExOrders( + params: CancelBatchCrossExOrdersReq[], + ): Promise { + return this.postPrivate('/crossex/batch_cancel_orders', { body: params }); + } + /** * Cancel Order * @@ -6027,6 +6175,34 @@ export class RestClient extends BaseRestClient { return this.getPrivate('/crossex/coin_discount_rate', params); } + /** + * Query CrossEx market tickers + * + * Query exchange market tickers, optionally filtered by a comma-separated list of symbols. + * + * @param params Optional parameters to filter symbols + * @returns Promise with array of market tickers + */ + listCrossExMarketTickers( + params?: GetCrossExMarketTickersReq, + ): Promise { + return this.get('/crossex/market/tickers', params); + } + + /** + * Query CrossEx market funding info + * + * Query futures funding rates, funding intervals, and next funding timestamps across exchanges. + * + * @param params Optional parameters to filter symbols + * @returns Promise with array of funding info records + */ + listCrossExMarketFundingInfo( + params?: GetCrossExMarketFundingInfoReq, + ): Promise { + return this.get('/crossex/market/funding_info', params); + } + /**========================================================================================================================== * ALPHA * ========================================================================================================================== @@ -6145,6 +6321,20 @@ export class RestClient extends BaseRestClient { return this.get('/tradfi/symbols'); } + /** + * Query CFD symbol commission rates + * + * At least one of symbols or category_code is required. When both are provided, symbols are filtered by category. + * + * @param params Optional filters for symbols and/or category codes + * @returns Promise with list of symbol commission rates + */ + getTradFiSymbolCommissions( + params?: TradFiGetSymbolCommissionsParams, + ): Promise>> { + return this.get('/tradfi/symbols/commissions', params); + } + getTradFiSymbolDetail( params: TradFiGetSymbolDetailParams, ): Promise>> { @@ -6247,4 +6437,195 @@ export class RestClient extends BaseRestClient { }): Promise> { return this.getPrivate(`/tradfi/orders/log/${params.log_id}`); } + + // ============ Stock ============ + + /** + * Query user stock assets + * + * @param params Optional PnL calculation parameters + * @returns Promise with user asset details + */ + getStockUserAssets( + params?: GetStockUserAssetsReq, + ): Promise> { + return this.getPrivate('/stock/users/assets', params); + } + + /** + * Query stock symbol list + * + * @param params Optional filters for symbols, exchange, and pagination + * @returns Promise with paginated symbol list + */ + getStockSymbols( + params?: GetStockSymbolsReq, + ): Promise>> { + return this.get('/stock/symbols', params); + } + + /** + * Query stock symbol details + * + * @param params Optional filters for symbols, exchange, and pagination + * @returns Promise with paginated symbol detail list + */ + getStockSymbolDetail( + params?: GetStockSymbolDetailReq, + ): Promise>> { + return this.getPrivate('/stock/symbols/detail', params); + } + + /** + * Query stock market order book + * + * @param symbol Symbol + * @returns Promise with order book data + */ + getStockOrderBook(symbol: string): Promise> { + return this.get(`/stock/market/${symbol}/orderbook`); + } + + /** + * Query open stock orders + * + * @param params Optional symbol filter + * @returns Promise with open order list + */ + getStockOrders( + params?: GetStockOrdersReq, + ): Promise>> { + return this.getPrivate('/stock/orders', params); + } + + /** + * Create a stock order + * + * Limit orders support only the all trading session; market orders support only regular. time_in_force supports day only. + * + * @param params Order parameters + * @returns Promise with created order ID + */ + createStockOrder( + params: CreateStockOrderReq, + ): Promise> { + return this.postPrivate('/stock/orders', { body: params }); + } + + /** + * Cancel all open stock orders + * + * @returns Promise with empty data on success + */ + cancelAllStockOrders(): Promise>> { + return this.deletePrivate('/stock/orders'); + } + + /** + * Query stock order history + * + * @param params Optional filters for symbol, order IDs, time range, side, and pagination + * @returns Promise with paginated historical order list + */ + getStockOrderHistory( + params?: GetStockOrderHistoryReq, + ): Promise>> { + return this.getPrivate('/stock/orders/history', params); + } + + /** + * Modify a stock order + * + * @param orderId Order ID + * @param params Modified volume and price + * @returns Promise with updated order ID + */ + updateStockOrder( + orderId: number, + params: UpdateStockOrderReq, + ): Promise> { + return this.putPrivate(`/stock/orders/${orderId}`, { body: params }); + } + + /** + * Cancel a stock order + * + * @param orderId Order ID + * @returns Promise with empty data on success + */ + cancelStockOrder( + orderId: number, + ): Promise>> { + return this.deletePrivate(`/stock/orders/${orderId}`); + } + + /** + * Query current stock positions + * + * @param params Optional filters for PnL calc, symbol, and exchange + * @returns Promise with position list + */ + getStockPositions( + params?: GetStockPositionsReq, + ): Promise>> { + return this.getPrivate('/stock/positions', params); + } + + /** + * Close a stock position + * + * @param params Close parameters (partial or full) + * @returns Promise with close order ID + */ + closeStockPosition( + params: CloseStockPositionReq, + ): Promise> { + return this.postPrivate('/stock/positions/close', { body: params }); + } + + /** + * Query stock transaction records + * + * @param params Optional filters for time range, ref_id, type, and pagination + * @returns Promise with paginated transaction list + */ + getStockTransactions( + params?: GetStockTransactionsReq, + ): Promise>> { + return this.getPrivate('/stock/transactions', params); + } + + /** + * Fund transfer for stock account + * + * Transfer funds in or out of the stock account (USDT only). + * + * @param params Transfer parameters including ref_id for idempotency + * @returns Promise with empty data on success + */ + createStockTransaction( + params: CreateStockTransactionReq, + ): Promise>> { + return this.postPrivate('/stock/transactions', { body: params }); + } + + /** + * Query supported stock exchanges + * + * @returns Promise with exchange list + */ + getStockExchanges(): Promise>> { + return this.get('/stock/exchanges'); + } + + /** + * Query stock fee rates + * + * Maker/taker fee fields apply to Japanese and Korean stocks. + * + * @returns Promise with fee rate list by VIP level + */ + getStockFeeRate(): Promise>> { + return this.get('/stock/fee-rate'); + } } diff --git a/src/index.ts b/src/index.ts index 2ac29b4..66bf8a3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,6 +23,7 @@ export * from './types/request/otc.js'; export * from './types/request/p2pMerchant.js'; export * from './types/request/rebate.js'; export * from './types/request/spot.js'; +export * from './types/request/stock.js'; export * from './types/request/subaccount.js'; export * from './types/request/tradfi.js'; export * from './types/request/unified.js'; @@ -48,6 +49,7 @@ export * from './types/response/otc.js'; export * from './types/response/p2pMerchant.js'; export * from './types/response/rebate.js'; export * from './types/response/spot.js'; +export * from './types/response/stock.js'; export * from './types/response/subaccount.js'; export * from './types/response/tradfi.js'; export * from './types/response/unified.js'; diff --git a/src/types/request/crossex.ts b/src/types/request/crossex.ts index f718a8c..4b27cbd 100644 --- a/src/types/request/crossex.ts +++ b/src/types/request/crossex.ts @@ -37,7 +37,7 @@ export interface CreateCrossExOrderReq { symbol: string; // Unique identifier Exchange_Business_Base_Counter side: 'BUY' | 'SELL'; type?: 'LIMIT' | 'MARKET'; // Order type (default: LIMIT) - time_in_force?: 'GTC' | 'IOC' | 'FOK' | 'POC'; // Default GTC + time_in_force?: 'GTC' | 'IOC' | 'FOK' | 'POC' | 'RPI'; // Default GTC; RPI = Retail Price Improvement qty?: string; // Order quantity (required unless spot market buy) price?: string; // Limit Order Price (Required for Limit Orders) quote_qty?: string; // Order quote quantity; required for spot and margin market buy orders @@ -45,6 +45,20 @@ export interface CreateCrossExOrderReq { position_side?: 'LONG' | 'SHORT' | 'NONE'; // Position side, defaults to NONE (single position mode) if not specified } +export interface GetCrossExMarketTickersReq { + symbols?: string; +} + +export interface GetCrossExMarketFundingInfoReq { + symbols?: string; +} + +/** Either order_id or text required; order_id wins if both set */ +export interface CancelBatchCrossExOrdersReq { + order_id?: string; + text?: string; +} + export interface ModifyCrossExOrderReq { qty?: string; // modify amount price?: string; // modify price diff --git a/src/types/request/otc.ts b/src/types/request/otc.ts index d75dd9a..59bc61f 100644 --- a/src/types/request/otc.ts +++ b/src/types/request/otc.ts @@ -31,19 +31,19 @@ export interface CreateOTCFiatOrderReq { } export interface CreateOTCStablecoinOrderReq { - pay_coin?: string; // Currency paid by the user - get_coin?: string; // Currency to be received by the user - pay_amount?: string; // User payment currency amount - get_amount?: string; // Amount of currency received by the user - side?: string; // Quote direction returned by the quote API (used for order validation) - promotion_code?: string; // Promotion code - quote_token?: string; // Parameter returned by the quote API + pay_coin: string; // Currency paid by the user + get_coin: string; // Currency to be received by the user + pay_amount: string; // User payment currency amount + get_amount: string; // Amount of currency received by the user + side: string; // Quote direction returned by the quote API (used for order validation) + quote_token: string; // Parameter returned by the quote API + promotion_code?: string; // Promotion code (optional) } export interface MarkOTCOrderAsPaidReq { order_id: string; // Order ID client_order_id?: string; // Client order ID (gateway/Inner Pay paths) - payment_receipt_file_key: string; // Required. Stored as file_key; jpg/jpeg/png/pdf; ≤4MB + payment_receipt_file_key: string; // Required. Stored as file_key; jpg/jpeg/png/pdf; ≤10MB payment_receipt?: string; // Alias compatible with payment_receipt_file_key } diff --git a/src/types/request/spot.ts b/src/types/request/spot.ts index 869e9ce..48ce3d1 100644 --- a/src/types/request/spot.ts +++ b/src/types/request/spot.ts @@ -172,3 +172,29 @@ export interface UpdateSpotOrderReq { stop_loss?: PatchSpotOrderTPSL; stop_profit?: PatchSpotOrderTPSL; } + +/** GET /spot/pov_orders */ +export interface GetSpotPovOrdersReq { + status: 'open' | 'finished'; + currency_pair?: string; + side?: 'buy' | 'sell'; + page?: number; + limit?: number; +} + +/** POST /spot/pov_orders */ +export interface CreateSpotPovOrderReq { + currency_pair: string; + side: 'buy' | 'sell'; + amount: string; + participation_rate: 5 | 10 | 20 | 40; + ttl: '1h' | '6h' | '12h' | '1d' | '2d' | '3d' | '4d' | '5d' | '6d' | '7d'; + limit_price?: string; + trigger_price?: string; + text?: string; +} + +/** POST /spot/pov_orders/cancel */ +export interface CancelSpotPovOrdersReq { + currency_pair?: string; +} diff --git a/src/types/request/stock.ts b/src/types/request/stock.ts new file mode 100644 index 0000000..a0dc773 --- /dev/null +++ b/src/types/request/stock.ts @@ -0,0 +1,81 @@ +/** Stock / TradFi Spot API request types */ + +export interface GetStockUserAssetsReq { + pnl_calc_type?: number; + pnl_calc_price?: number; +} + +export interface GetStockSymbolsReq { + symbols?: string; + exchange?: string; + with_desc_i18n?: boolean; + page?: number; + page_size?: number; +} + +export interface GetStockSymbolDetailReq { + symbols?: string; + exchange?: string; + page?: number; + page_size?: number; +} + +export interface GetStockOrdersReq { + symbol?: string; +} + +export interface CreateStockOrderReq { + volume: string; + symbol: string; + side: 1 | 2; + price_type: 'market' | 'limit'; + /** Limit: all only; market: regular only */ + trading_session: 'all' | 'regular'; + time_in_force: 'day'; + price?: string; + client_order_id?: string; +} + +export interface GetStockOrderHistoryReq { + symbol?: string; + order_ids?: string; + begin_time?: number; + end_time?: number; + side?: 1 | 2; + page?: number; + page_size?: number; +} + +export interface UpdateStockOrderReq { + volume: string; + price: string; +} + +export interface GetStockPositionsReq { + pnl_calc_type?: number; + pnl_calc_price?: number; + symbol?: string; + exchange?: string; +} + +export interface CloseStockPositionReq { + symbol: string; + close_type: 1 | 2; + close_volume?: string; +} + +export interface GetStockTransactionsReq { + begin_time?: number; + end_time?: number; + ref_id?: string; + type?: string; + page?: number; + page_size?: number; +} + +export interface CreateStockTransactionReq { + asset: string; + change: string; + type: 'deposit' | 'withdraw'; + ref_id: string; +} diff --git a/src/types/request/tradfi.ts b/src/types/request/tradfi.ts index b5b3752..e125c6f 100644 --- a/src/types/request/tradfi.ts +++ b/src/types/request/tradfi.ts @@ -66,3 +66,9 @@ export interface TradFiGetPositionHistoryParams { page?: number; page_size?: number; } + +/** GET /tradfi/symbols/commissions */ +export interface TradFiGetSymbolCommissionsParams { + symbols?: string; + category_code?: string; +} diff --git a/src/types/request/unified.ts b/src/types/request/unified.ts index ef7460c..a37785a 100644 --- a/src/types/request/unified.ts +++ b/src/types/request/unified.ts @@ -99,3 +99,8 @@ export interface CreateQuickRepaymentReq { export interface SetUnifiedDeltaNeutralReq { enabled: boolean; } + +/** POST /unified/leverage/user_setting — set leverage for all borrowed currencies */ +export interface SetUserLeverageReq { + leverage?: string; +} diff --git a/src/types/request/wallet.ts b/src/types/request/wallet.ts index 98b21a1..8531473 100644 --- a/src/types/request/wallet.ts +++ b/src/types/request/wallet.ts @@ -72,3 +72,8 @@ export interface SubmitMainSubTransferReq { client_order_id?: string; sub_account_type?: 'spot' | 'futures' | 'cross_margin' | 'delivery'; } + +/** GET /wallet/transfers */ +export interface GetTransferReq { + tx_id: string; +} diff --git a/src/types/response/crossex.ts b/src/types/response/crossex.ts index ad68db1..e4ce0fd 100644 --- a/src/types/response/crossex.ts +++ b/src/types/response/crossex.ts @@ -18,6 +18,7 @@ export interface CrossExSymbol { contract_size: string; liquidation_fee: string; delist_time: string; + support_rpi?: string; // true/false whether RPI orders are supported } export interface CrossExRiskLimitTier { @@ -196,17 +197,50 @@ export interface CrossExSpecialFee { symbol: string; // Currency pair taker_fee_rate: string; // Taker fee rate maker_fee_rate: string; // Maker fee rate + rpi_fee_rate?: string; // RPI order maker fee rate } export interface CrossExFeeRate { exchange_type: string; // Exchange (e.g. BINANCE, OKX, GATE, BYBIT) spot_maker_fee: string; // spot Maker fee rate spot_taker_fee: string; // spot Taker fee rate + spot_rpi_maker_fee?: string; // Spot RPI order maker fee rate future_maker_fee: string; // contract Maker fee rate future_taker_fee: string; // contract Taker fee rate + future_rpi_maker_fee?: string; // Futures RPI order maker fee rate special_fee_list: CrossExSpecialFee[]; } +export interface CrossExMarketTicker { + symbol: string; + last_price: string; + open_24h: string; + low_24h: string; + high_24h: string; + volume_24h_base: string; + volume_24h_quote: string; + mark_price: string; + index_price: string; + open_interest: string; + open_interest_quote: string; + timestamp: string; +} + +export interface CrossExMarketFundingInfo { + symbol: string; + funding_rate: string; + funding_interval: string; + funding_time: string; // Next funding time +} + +export interface CancelBatchCrossExOrdersResp { + order_id: string; + text: string; + accepted: string; // "true" | "false" + label: string; + message: string; +} + export interface CrossExPosition { user_id: string; // User ID position_id: string; // Position ID diff --git a/src/types/response/otc.ts b/src/types/response/otc.ts index b4613c4..8ad0483 100644 --- a/src/types/response/otc.ts +++ b/src/types/response/otc.ts @@ -44,6 +44,7 @@ export type CreateOTCFiatOrderResp = OTCActionResp; export interface CreateOTCStablecoinOrderResp { code: number; message: string; + timestamp: number; } export interface OTCBankListItem { @@ -90,10 +91,11 @@ export interface CreateOTCBankResp { } export interface OTCBankSupplementChecklistItem { - code: string; + description: string; + code?: string; zh?: string; en?: string; - required: boolean; + required?: boolean; } export interface GetOTCBankSupplementChecklistResp { @@ -116,7 +118,7 @@ export interface OTCFiatOrderListItem { order_id: string; trade_no: string; // Trade number type: string; // Quote direction buy/sell/all - status: string; // Order Status + status: string; // Order Status (includes DISBURSED) db_status: string; fiat_currency: string; // Fiat type fiat_currency_info: { diff --git a/src/types/response/spot.ts b/src/types/response/spot.ts index 99fd1ca..e93f924 100644 --- a/src/types/response/spot.ts +++ b/src/types/response/spot.ts @@ -278,3 +278,30 @@ export interface SpotHistoricTradeRecord { text: string; deal?: string; // v4.105.29: Total Executed Value } + +export type SpotPovOrderStatus = + | 'CREATED' + | 'CANCELING' + | 'RUNNING' + | 'COMPLETED' + | 'EXPIRED' + | 'TERMINATED'; + +export interface SpotPovOrder { + id?: string; + currency_pair?: string; + side?: string; + amount?: string; + participation_rate?: number; + ttl?: string; + limit_price?: string; + trigger_price?: string; + status?: SpotPovOrderStatus | string; + terminated_as?: string; + start_time_ms?: number; + end_time_ms?: number; + expire_time_ms?: number; + create_time_ms?: number; + update_time_ms?: number; + text?: string; +} diff --git a/src/types/response/stock.ts b/src/types/response/stock.ts new file mode 100644 index 0000000..db499f9 --- /dev/null +++ b/src/types/response/stock.ts @@ -0,0 +1,219 @@ +/** Stock / TradFi Spot API response types */ + +export interface StockApiResp { + timestamp?: number; + data?: T; + code?: number; + message?: string; + label?: string; +} + +export interface StockListData { + list?: T[]; + total?: number; + total_page?: number; +} + +export interface StockUserAssets { + equity?: string; + balance?: string; + available?: string; + position_market_value?: string; + position_pnl?: string; + today_pnl?: string; + user_exists?: boolean; +} + +export interface StockSymbolDescI18n { + lang?: string; + value?: string; +} + +export interface StockSymbolItem { + symbol?: string; + exchange?: string; + exchange_desc?: string; + quote_currency?: string; + quote_currency_precision?: number; + fx_rate?: string; + symbol_desc?: string; + category?: string; + trade_status?: string; + trade_mode?: number; + order_fill_timing?: number; + icon_link?: string; + quote_currency_symbol?: string; + price_precision?: number; + volume_precision?: number; + is_ipo?: boolean; + ipo_price?: string; + sell_price_protection?: string; + buy_price_protection?: string; + symbol_descs?: StockSymbolDescI18n[]; + timestamp?: number; +} + +export interface StockSymbolDetailItem { + symbol?: string; + exchange?: string; + exchange_desc?: string; + quote_currency?: string; + quote_currency_precision?: number; + fx_rate?: string; + symbol_desc?: string; + category?: string; + settlement_currency?: string; + max_order_volume?: string; + step_order_volume?: string; + min_order_volume?: string; + price_precision?: number; + volume_precision?: number; + is_ipo?: boolean; + ipo_price?: string; + price_protection?: string; + sell_price_protection?: string; + buy_price_protection?: string; + slippage_rate?: string; + commission_rate?: string; + trade_status?: string; + trade_mode?: number; + order_fill_timing?: number; + symbol_descs?: StockSymbolDescI18n[]; + [key: string]: unknown; +} + +export interface StockOrderBookLevel { + p?: string; + user_order?: boolean; + [key: string]: unknown; +} + +export interface StockOrderBook { + symbol?: string; + bids?: StockOrderBookLevel[]; + asks?: StockOrderBookLevel[]; + timestamp?: number; +} + +export interface StockOrderItem { + order_id?: string; + symbol?: string; + exchange?: string; + quote_currency?: string; + fx_rate?: string; + symbol_desc?: string; + trade_status?: string; + trade_mode?: number; + price_type?: string; + side?: number; + status?: number; + volume?: string; + fill_volume?: string; + price?: string; + time_setup?: number; + time_update?: number; + max_order_volume?: string; + step_order_volume?: string; + min_order_volume?: string; + price_precision?: number; + price_protection?: string; + sell_price_protection?: string; + buy_price_protection?: string; + commission_rate?: string; + slippage_rate?: string; + [key: string]: unknown; +} + +export interface StockCreateOrderResult { + id?: string; +} + +export interface StockOrderHistoryItem { + order_id?: string; + symbol?: string; + exchange?: string; + quote_currency?: string; + fx_rate?: string; + symbol_desc?: string; + price_type?: string; + status?: number; + status_desc?: string; + status_detail?: { title?: string; message?: string } | null; + finish_as?: number; + side?: number; + time_in_force?: string; + volume?: string; + fill_volume?: string; + price?: string; + avg_fill_price?: string | null; + commission?: string; + time_setup?: number; + time_done?: number; + [key: string]: unknown; +} + +export interface StockUpdateOrderResult { + order_id?: number; +} + +export interface StockPositionItem { + symbol?: string; + exchange?: string; + quote_currency?: string; + quote_currency_precision?: number; + fx_rate?: string; + trade_status?: string; + symbol_desc?: string; + position_pnl?: string; + today_pnl?: string; + pnl_rate?: string; + today_sell_amount?: string; + today_buy_amount?: string; + today_sell_volume?: string; + today_buy_volume?: string; + yesterday_volume?: string; + volume?: string; + available?: string; + transfer_out_pending_qty?: string; + avg_cost_price?: string; + diluted_cost_price?: string; + last_price?: string; + extended_last_price?: string | null; + max_order_volume?: string; + step_order_volume?: string; + min_order_volume?: string; + price_precision?: number; + price_protection?: string; + [key: string]: unknown; +} + +export interface StockClosePositionResult { + order_id?: number; +} + +export interface StockTransactionItem { + asset?: string; + symbol?: string; + symbol_display?: string; + type?: string; + type_desc?: string; + change?: string; + balance?: string; + ref_id?: string; + time?: number; + unit_text?: string; + detail?: object; +} + +export interface StockExchangeItem { + exchange?: string; + exchange_desc?: string; + icon_link?: string; + support_transfer?: boolean; +} + +export interface StockFeeRateItem { + vip_level?: number; + maker_fee?: string; + taker_fee?: string; +} diff --git a/src/types/response/tradfi.ts b/src/types/response/tradfi.ts index ce283f9..d0a203b 100644 --- a/src/types/response/tradfi.ts +++ b/src/types/response/tradfi.ts @@ -233,3 +233,9 @@ export interface TradFiOrderLog { price?: string; [key: string]: unknown; } + +export interface TradFiSymbolCommissionItem { + category_code?: string; + symbol?: string; + fee_per_lot?: string; +} diff --git a/src/types/response/unified.ts b/src/types/response/unified.ts index 50255d0..0b5498e 100644 --- a/src/types/response/unified.ts +++ b/src/types/response/unified.ts @@ -225,3 +225,9 @@ export interface QuickRepaymentResp { export interface DeltaNeutralEnabled { enabled: boolean; } + +/** POST /unified/leverage/user_setting failed currency entry */ +export interface LeverageFailedCurrency { + currency: string; + reason: string; +} diff --git a/src/types/response/wallet.ts b/src/types/response/wallet.ts index d5147c3..2462745 100644 --- a/src/types/response/wallet.ts +++ b/src/types/response/wallet.ts @@ -241,3 +241,27 @@ export interface PushOrder { | 'RECEIVED'; message: string; } + +/** GET /wallet/transfers — AccountTransferDetail */ +export interface AccountTransferDetail { + tx_id: string; + status: 'pending' | 'success' | 'fail'; + currency: string; + amount: string; + from_account: + | 'spot' + | 'margin' + | 'futures' + | 'delivery' + | 'options' + | 'unknown'; + to_account: + | 'spot' + | 'margin' + | 'futures' + | 'delivery' + | 'options' + | 'unknown'; + settle?: string | null; + currency_pair?: string | null; +} From ab8a21761142cd3f5973ba1d1b8a78f6e6dfa7c4 Mon Sep 17 00:00:00 2001 From: JJ-Cro Date: Tue, 11 Aug 2026 13:01:22 +0200 Subject: [PATCH 2/3] refactor: remove stock API types and update subaccount structures - Removed stock-related request and response types from the API. - Introduced new subaccount-related request and response types. - Updated documentation links to reflect repository migration. - Cleaned up unused files and improved code organization. --- docs/endpointFunctionList.md | 924 ++-- llms.txt | 7890 +++++++++++++++++----------------- 2 files changed, 4496 insertions(+), 4318 deletions(-) diff --git a/docs/endpointFunctionList.md b/docs/endpointFunctionList.md index c523b89..b805f76 100644 --- a/docs/endpointFunctionList.md +++ b/docs/endpointFunctionList.md @@ -4,8 +4,8 @@

- - SDK Logo + + SDK Logo

@@ -14,7 +14,7 @@ Each REST client is a JavaScript class, which provides functions individually ma The following table shows all methods available in each REST client, whether the method requires authentication (automatically handled if API keys are provided), as well as the exact endpoint each method is connected to. -This can be used to easily find which method to call, once you have [found which endpoint you're looking to use](https://github.com/tiagosiebler/awesome-crypto-examples/wiki/How-to-find-SDK-functions-that-match-API-docs-endpoint). +This can be used to easily find which method to call, once you have [found which endpoint you're looking to use](https://github.com/sieblyio/awesome-crypto-examples/wiki/How-to-find-SDK-functions-that-match-API-docs-endpoint). All REST clients are in the [src](/src) folder. For usage examples, make sure to check the [examples](/examples) folder. @@ -49,450 +49,450 @@ This table includes all endpoints from the official Exchange API docs and corres | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [getSystemMaintenanceStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L703) | | GET | `/v1/public/system_info` | -| [submitWithdrawal()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L720) | :closed_lock_with_key: | POST | `/withdrawals` | -| [submitSpotMainAccountTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L734) | :closed_lock_with_key: | POST | `/withdrawals/push` | -| [cancelWithdrawal()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L750) | :closed_lock_with_key: | DELETE | `/withdrawals/{withdrawal_id}` | -| [getCurrencyChains()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L767) | | GET | `/wallet/currency_chains` | -| [createDepositAddress()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L777) | :closed_lock_with_key: | GET | `/wallet/deposit_address` | -| [getWithdrawalRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L791) | :closed_lock_with_key: | GET | `/wallet/withdrawals` | -| [getDepositRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L805) | :closed_lock_with_key: | GET | `/wallet/deposits` | -| [submitTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L824) | :closed_lock_with_key: | POST | `/wallet/transfers` | -| [getTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L828) | :closed_lock_with_key: | GET | `/wallet/transfers` | -| [submitMainSubTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L840) | :closed_lock_with_key: | POST | `/wallet/sub_account_transfers` | -| [getMainSubTransfers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L854) | :closed_lock_with_key: | GET | `/wallet/sub_account_transfers` | -| [submitSubToSubTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L868) | :closed_lock_with_key: | POST | `/wallet/sub_account_to_sub_account` | -| [getTransferStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L883) | :closed_lock_with_key: | GET | `/wallet/order_status` | -| [getWithdrawalStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L899) | :closed_lock_with_key: | GET | `/wallet/withdraw_status` | -| [getSubBalance()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L911) | :closed_lock_with_key: | GET | `/wallet/sub_account_balances` | -| [getSubMarginBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L923) | :closed_lock_with_key: | GET | `/wallet/sub_account_margin_balances` | -| [getSubFuturesBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L935) | :closed_lock_with_key: | GET | `/wallet/sub_account_futures_balances` | -| [getSubCrossMarginBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L948) | :closed_lock_with_key: | GET | `/wallet/sub_account_cross_margin_balances` | -| [getSavedAddresses()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L960) | :closed_lock_with_key: | GET | `/wallet/saved_address` | -| [getTradingFees()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L970) | :closed_lock_with_key: | GET | `/wallet/fee` | -| [getBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L991) | :closed_lock_with_key: | GET | `/wallet/total_balance` | -| [getSmallBalances()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1000) | :closed_lock_with_key: | GET | `/wallet/small_balance` | -| [convertSmallBalance()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1010) | :closed_lock_with_key: | POST | `/wallet/small_balance` | -| [getSmallBalanceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1023) | :closed_lock_with_key: | GET | `/wallet/small_balance_history` | -| [getPushOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1035) | :closed_lock_with_key: | GET | `/wallet/push` | -| [getLowCapExchangeList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1044) | :closed_lock_with_key: | GET | `/wallet/getLowCapExchangeList` | -| [createSubAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1059) | :closed_lock_with_key: | POST | `/sub_accounts` | -| [getSubAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1070) | :closed_lock_with_key: | GET | `/sub_accounts` | -| [getSubAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1080) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}` | -| [createSubAccountApiKey()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1090) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/keys` | -| [getSubAccountApiKeys()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1103) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}/keys` | -| [updateSubAccountApiKey()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1117) | :closed_lock_with_key: | PUT | `/sub_accounts/{user_id}/keys/{key}` | -| [deleteSubAccountApiKey()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1128) | :closed_lock_with_key: | DELETE | `/sub_accounts/{user_id}/keys/{key}` | -| [getSubAccountApiKey()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1143) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}/keys/{key}` | -| [lockSubAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1158) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/lock` | -| [unlockSubAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1168) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/unlock` | -| [getSubAccountMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1182) | :closed_lock_with_key: | GET | `/sub_accounts/unified_mode` | -| [getUnifiedAccountInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1201) | :closed_lock_with_key: | GET | `/unified/accounts` | -| [getUnifiedMaxBorrow()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1217) | :closed_lock_with_key: | GET | `/unified/borrowable` | -| [getUnifiedMaxTransferable()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1233) | :closed_lock_with_key: | GET | `/unified/transferable` | -| [getUnifiedMaxTransferables()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1248) | :closed_lock_with_key: | GET | `/unified/transferables` | -| [getUnifiedBatchMaxBorrowable()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1257) | :closed_lock_with_key: | GET | `/unified/batch_borrowable` | -| [submitUnifiedBorrowOrRepay()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1275) | :closed_lock_with_key: | POST | `/unified/loans` | -| [getUnifiedLoans()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1287) | :closed_lock_with_key: | GET | `/unified/loans` | -| [getUnifiedLoanRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1297) | :closed_lock_with_key: | GET | `/unified/loan_records` | -| [getUnifiedInterestRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1309) | :closed_lock_with_key: | GET | `/unified/interest_records` | -| [getUnifiedRiskUnitDetails()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1320) | :closed_lock_with_key: | GET | `/unified/risk_units` | -| [setUnifiedAccountMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1332) | :closed_lock_with_key: | PUT | `/unified/unified_mode` | -| [getUnifiedAccountMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1341) | :closed_lock_with_key: | GET | `/unified/unified_mode` | -| [getUnifiedEstimateRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1353) | :closed_lock_with_key: | GET | `/unified/estimate_rate` | -| [getUnifiedCurrencyDiscountTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1364) | | GET | `/unified/currency_discount_tiers` | -| [getLoanMarginTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1376) | | GET | `/unified/loan_margin_tiers` | -| [portfolioMarginCalculate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1393) | | POST | `/unified/portfolio_calculator` | -| [setUserLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1399) | :closed_lock_with_key: | POST | `/unified/leverage/user_setting` | -| [getUserCurrencyLeverageConfig()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1413) | :closed_lock_with_key: | GET | `/unified/leverage/user_currency_config` | -| [getUserCurrencyLeverageSettings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1427) | :closed_lock_with_key: | GET | `/unified/leverage/user_currency_setting` | -| [updateUserCurrencyLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1442) | :closed_lock_with_key: | POST | `/unified/leverage/user_currency_setting` | -| [getUnifiedLoanCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1457) | :closed_lock_with_key: | GET | `/unified/currencies` | -| [getHistoricalLendingRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1469) | :closed_lock_with_key: | GET | `/unified/history_loan_rate` | -| [submitUnifiedLoanRepay()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1475) | :closed_lock_with_key: | POST | `/unified/loans/repay` | -| [getEstimatedQuickRepayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1482) | :closed_lock_with_key: | GET | `/unified/estimated_quick_repayment` | -| [createQuickRepayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1489) | :closed_lock_with_key: | POST | `/unified/quick_repayment` | -| [setUnifiedDeltaNeutral()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1500) | :closed_lock_with_key: | POST | `/unified/delta_neutral` | -| [getUnifiedDeltaNeutral()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1509) | :closed_lock_with_key: | GET | `/unified/delta_neutral` | -| [getSpotCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1529) | | GET | `/spot/currencies` | -| [getSpotCurrency()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1539) | | GET | `/spot/currencies/{currency}` | -| [getSpotCurrencyPairs()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1548) | | GET | `/spot/currency_pairs` | -| [getSpotCurrencyPair()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1558) | | GET | `/spot/currency_pairs/{currency_pair}` | -| [getSpotTicker()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1572) | | GET | `/spot/tickers` | -| [getSpotOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1587) | | GET | `/spot/order_book` | -| [getSpotTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1600) | | GET | `/spot/trades` | -| [getSpotCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1612) | | GET | `/spot/candlesticks` | -| [getSpotFeeRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1624) | :closed_lock_with_key: | GET | `/spot/fee` | -| [getSpotBatchFeeRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1633) | :closed_lock_with_key: | GET | `/spot/batch_fee` | -| [getSpotAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1645) | :closed_lock_with_key: | GET | `/spot/accounts` | -| [getSpotAccountBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1657) | :closed_lock_with_key: | GET | `/spot/account_book` | -| [submitSpotBatchOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1676) | :closed_lock_with_key: | POST | `/spot/batch_orders` | -| [getSpotOpenOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1703) | :closed_lock_with_key: | GET | `/spot/open_orders` | -| [submitSpotClosePosCrossDisabled()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1719) | :closed_lock_with_key: | POST | `/spot/cross_liquidate_orders` | -| [submitSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1735) | :closed_lock_with_key: | POST | `/spot/orders` | -| [getSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1752) | :closed_lock_with_key: | GET | `/spot/orders` | -| [cancelSpotOpenOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1767) | :closed_lock_with_key: | DELETE | `/spot/orders` | -| [batchCancelSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1795) | :closed_lock_with_key: | POST | `/spot/cancel_batch_orders` | -| [getSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1820) | :closed_lock_with_key: | GET | `/spot/orders/{order_id}` | -| [updateSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1837) | :closed_lock_with_key: | PATCH | `/spot/orders/{order_id}` | -| [cancelSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1865) | :closed_lock_with_key: | DELETE | `/spot/orders/{order_id}` | -| [getSpotTradingHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1894) | :closed_lock_with_key: | GET | `/spot/my_trades` | -| [submitSpotCountdownOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1923) | :closed_lock_with_key: | POST | `/spot/countdown_cancel_all` | -| [batchUpdateSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1942) | :closed_lock_with_key: | POST | `/spot/amend_batch_orders` | -| [getSpotInsuranceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1969) | :closed_lock_with_key: | GET | `/spot/insurance_history` | -| [submitSpotPriceTriggerOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1983) | :closed_lock_with_key: | POST | `/spot/price_orders` | -| [getSpotAutoOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L1995) | :closed_lock_with_key: | GET | `/spot/price_orders` | -| [cancelAllOpenSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2007) | :closed_lock_with_key: | DELETE | `/spot/price_orders` | -| [getPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2020) | :closed_lock_with_key: | GET | `/spot/price_orders/{order_id}` | -| [cancelSpotTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2032) | :closed_lock_with_key: | DELETE | `/spot/price_orders/{order_id}` | -| [listSpotPovOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2038) | :closed_lock_with_key: | GET | `/spot/pov_orders` | -| [createSpotPovOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2042) | :closed_lock_with_key: | POST | `/spot/pov_orders` | -| [cancelSpotPovOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2046) | :closed_lock_with_key: | POST | `/spot/pov_orders/cancel` | -| [getSpotPovOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2052) | :closed_lock_with_key: | GET | `/spot/pov_orders/{order_id}` | -| [cancelSpotPovOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2056) | :closed_lock_with_key: | POST | `/spot/pov_orders/{order_id}/cancel` | -| [setCollateralCurrency()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2068) | :closed_lock_with_key: | POST | `/unified/collateral_currencies` | -| [getMarginAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2089) | :closed_lock_with_key: | GET | `/margin/accounts` | -| [getMarginBalanceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2103) | :closed_lock_with_key: | GET | `/margin/account_book` | -| [getFundingAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2121) | :closed_lock_with_key: | GET | `/margin/funding_accounts` | -| [updateAutoRepaymentSetting()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2139) | :closed_lock_with_key: | POST | `/margin/auto_repay` | -| [getAutoRepaymentSetting()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2150) | :closed_lock_with_key: | GET | `/margin/auto_repay` | -| [getMarginTransferableAmount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2164) | :closed_lock_with_key: | GET | `/margin/transferable` | -| [getCrossMarginCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2181) | | GET | `/margin/cross/currencies` | -| [getCrossMarginCurrency()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2192) | | GET | `/margin/cross/currencies/{currency}` | -| [getCrossMarginAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2204) | :closed_lock_with_key: | GET | `/margin/cross/accounts` | -| [getCrossMarginAccountHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2217) | :closed_lock_with_key: | GET | `/margin/cross/account_book` | -| [submitCrossMarginBorrowLoan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2234) | :closed_lock_with_key: | POST | `/margin/cross/loans` | -| [getCrossMarginBorrowHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2249) | :closed_lock_with_key: | GET | `/margin/cross/loans` | -| [getCrossMarginBorrowLoan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2262) | :closed_lock_with_key: | GET | `/margin/cross/loans/{loan_id}` | -| [submitCrossMarginRepayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2277) | :closed_lock_with_key: | POST | `/margin/cross/repayments` | -| [getCrossMarginRepayments()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2293) | :closed_lock_with_key: | GET | `/margin/cross/repayments` | -| [getCrossMarginInterestRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2306) | :closed_lock_with_key: | GET | `/margin/cross/interest_records` | -| [getCrossMarginTransferableAmount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2322) | :closed_lock_with_key: | GET | `/margin/cross/transferable` | -| [getEstimatedInterestRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2338) | :closed_lock_with_key: | GET | `/margin/cross/estimate_rate` | -| [getCrossMarginBorrowableAmount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2352) | :closed_lock_with_key: | GET | `/margin/cross/borrowable` | -| [getMarginUserLoanTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2365) | :closed_lock_with_key: | GET | `/margin/user/loan_margin_tiers` | -| [getMarginPublicLoanTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2381) | | GET | `/margin/loan_margin_tiers` | -| [setMarginUserLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2397) | :closed_lock_with_key: | POST | `/margin/leverage/user_market_setting` | -| [getMarginUserAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2414) | :closed_lock_with_key: | GET | `/margin/user/account` | -| [getLendingMarkets()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2429) | | GET | `/margin/uni/currency_pairs` | -| [getLendingMarket()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2444) | | GET | `/margin/uni/currency_pairs/{currency_pair}` | -| [getEstimatedInterestRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2456) | :closed_lock_with_key: | GET | `/margin/uni/estimate_rate` | -| [submitMarginUNIBorrowOrRepay()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2466) | :closed_lock_with_key: | POST | `/margin/uni/loans` | -| [getMarginUNILoans()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2482) | :closed_lock_with_key: | GET | `/margin/uni/loans` | -| [getMarginUNILoanRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2492) | :closed_lock_with_key: | GET | `/margin/uni/loan_records` | -| [getMarginUNIInterestRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2504) | :closed_lock_with_key: | GET | `/margin/uni/interest_records` | -| [getMarginUNIMaxBorrow()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2516) | :closed_lock_with_key: | GET | `/margin/uni/borrowable` | -| [getFlashSwapCurrencyPairs()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2532) | | GET | `/flash_swap/currency_pairs` | -| [submitFlashSwapOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2548) | :closed_lock_with_key: | POST | `/flash_swap/orders` | -| [getFlashSwapOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2560) | :closed_lock_with_key: | GET | `/flash_swap/orders` | -| [getFlashSwapOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2572) | :closed_lock_with_key: | GET | `/flash_swap/orders/{order_id}` | -| [submitFlashSwapOrderPreview()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2582) | :closed_lock_with_key: | POST | `/flash_swap/orders/preview` | -| [getFuturesContracts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2599) | | GET | `/futures/{settle}/contracts` | -| [getFuturesContract()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2614) | | GET | `/futures/{settle}/contracts/{contract}` | -| [getFuturesOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2629) | | GET | `/futures/{settle}/order_book` | -| [getFuturesTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2642) | | GET | `/futures/{settle}/trades` | -| [getFuturesCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2657) | | GET | `/futures/{settle}/candlesticks` | -| [getPremiumIndexKLines()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2670) | | GET | `/futures/{settle}/premium_index` | -| [getFuturesTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2683) | | GET | `/futures/{settle}/tickers` | -| [getFundingRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2700) | | GET | `/futures/{settle}/funding_rate` | -| [getBatchFundingRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2716) | | POST | `/futures/{settle}/funding_rates` | -| [getFuturesInsuranceBalanceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2734) | | GET | `/futures/{settle}/insurance` | -| [getFuturesStats()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2753) | | GET | `/futures/{settle}/contract_stats` | -| [getIndexConstituents()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2764) | | GET | `/futures/{settle}/index_constituents/{index}` | -| [getLiquidationHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2781) | | GET | `/futures/{settle}/liq_orders` | -| [getRiskLimitTiers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2798) | | GET | `/futures/{settle}/risk_limit_tiers` | -| [getFuturesAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2811) | :closed_lock_with_key: | GET | `/futures/{settle}/accounts` | -| [getFuturesAccountBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2825) | :closed_lock_with_key: | GET | `/futures/{settle}/account_book` | -| [getFuturesPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2838) | :closed_lock_with_key: | GET | `/futures/{settle}/positions` | -| [getFuturesPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2853) | :closed_lock_with_key: | GET | `/futures/{settle}/positions/{contract}` | -| [updateFuturesMargin()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2870) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/margin` | -| [updateFuturesLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2898) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/leverage` | -| [getFuturesContractLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2918) | :closed_lock_with_key: | GET | `/futures/{settle}/get_leverage/{contract}` | -| [updateFuturesPositionMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2934) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/cross_mode` | -| [updatePositionRiskLimit()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2951) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/risk_limit` | -| [updateFuturesDualMode()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2971) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_mode` | -| [getDualModePosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L2987) | :closed_lock_with_key: | GET | `/futures/{settle}/dual_comp/positions/{contract}` | -| [updateDualModePositionMargin()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3002) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/margin` | -| [updateDualModePositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3018) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/leverage` | -| [updateDualModePositionRiskLimit()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3042) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/risk_limit` | -| [submitFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3069) | :closed_lock_with_key: | POST | `/futures/{settle}/orders` | -| [getFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3090) | :closed_lock_with_key: | GET | `/futures/{settle}/orders` | -| [cancelAllFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3105) | :closed_lock_with_key: | DELETE | `/futures/{settle}/orders` | -| [getFuturesOrdersByTimeRange()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3125) | :closed_lock_with_key: | GET | `/futures/{settle}/orders_timerange` | -| [submitFuturesBatchOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3148) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_orders` | -| [getFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3173) | :closed_lock_with_key: | GET | `/futures/{settle}/orders/{order_id}` | -| [cancelFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3190) | :closed_lock_with_key: | DELETE | `/futures/{settle}/orders/{order_id}` | -| [updateFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3215) | :closed_lock_with_key: | PUT | `/futures/{settle}/orders/{order_id}` | -| [getFuturesTradingHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3236) | :closed_lock_with_key: | GET | `/futures/{settle}/my_trades` | -| [getFuturesTradingHistoryByTimeRange()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3251) | :closed_lock_with_key: | GET | `/futures/{settle}/my_trades_timerange` | -| [getFuturesPositionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3264) | :closed_lock_with_key: | GET | `/futures/{settle}/position_close` | -| [getFuturesLiquidationHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3277) | :closed_lock_with_key: | GET | `/futures/{settle}/liquidates` | -| [getFuturesAutoDeleveragingHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3290) | :closed_lock_with_key: | GET | `/futures/{settle}/auto_deleverages` | -| [setFuturesOrderCancelCountdown()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3307) | :closed_lock_with_key: | POST | `/futures/{settle}/countdown_cancel_all` | -| [getFuturesUserTradingFees()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3324) | :closed_lock_with_key: | GET | `/futures/{settle}/fee` | -| [batchCancelFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3342) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_cancel_orders` | -| [batchUpdateFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3369) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_amend_orders` | -| [getRiskLimitTable()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3391) | | GET | `/futures/{settle}/risk_limit_table` | -| [submitFuturesPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3404) | :closed_lock_with_key: | POST | `/futures/{settle}/price_orders` | -| [getFuturesAutoOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3417) | :closed_lock_with_key: | GET | `/futures/{settle}/price_orders` | -| [cancelAllOpenFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3430) | :closed_lock_with_key: | DELETE | `/futures/{settle}/price_orders` | -| [getFuturesPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3446) | :closed_lock_with_key: | GET | `/futures/{settle}/price_orders/{order_id}` | -| [cancelFuturesPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3461) | :closed_lock_with_key: | DELETE | `/futures/{settle}/price_orders/{order_id}` | -| [updateFuturesPriceTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3476) | :closed_lock_with_key: | PUT | `/futures/{settle}/price_orders/amend` | -| [createTrailOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3491) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/create` | -| [terminateTrailOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3509) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/stop` | -| [batchTerminateTrailOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3522) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/stop_all` | -| [getTrailOrderList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3537) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/list` | -| [getTrailOrderDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3550) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/detail` | -| [updateTrailOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3568) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/update` | -| [getTrailOrderChangeLog()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3581) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/change_log` | -| [createChaseOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3594) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/create` | -| [stopChaseOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3604) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/stop` | -| [stopAllChaseOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3614) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/stop_all` | -| [getChaseOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3626) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/chase/list` | -| [getChaseOrderDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3634) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/chase/detail` | -| [getFuturesPositionCloseHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3643) | :closed_lock_with_key: | GET | `/futures/{settle}/position_close_history` | -| [getFuturesInsuranceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3652) | :closed_lock_with_key: | GET | `/futures/{settle}/insurance` | -| [getAllDeliveryContracts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3669) | | GET | `/delivery/{settle}/contracts` | -| [getDeliveryContract()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3681) | | GET | `/delivery/{settle}/contracts/{contract}` | -| [getDeliveryOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3696) | | GET | `/delivery/{settle}/order_book` | -| [getDeliveryTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3709) | | GET | `/delivery/{settle}/trades` | -| [getDeliveryCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3723) | | GET | `/delivery/{settle}/candlesticks` | -| [getDeliveryTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3734) | | GET | `/delivery/{settle}/tickers` | -| [getDeliveryInsuranceBalanceHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3751) | | GET | `/delivery/{settle}/insurance` | -| [getDeliveryAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3770) | :closed_lock_with_key: | GET | `/delivery/{settle}/accounts` | -| [getDeliveryBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3781) | :closed_lock_with_key: | GET | `/delivery/{settle}/account_book` | -| [getDeliveryPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3792) | :closed_lock_with_key: | GET | `/delivery/{settle}/positions` | -| [getDeliveryPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3802) | :closed_lock_with_key: | GET | `/delivery/{settle}/positions/{contract}` | -| [updateDeliveryMargin()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3817) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/margin` | -| [updateDeliveryLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3835) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/leverage` | -| [updateDeliveryRiskLimit()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3853) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/risk_limit` | -| [submitDeliveryOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3873) | :closed_lock_with_key: | POST | `/delivery/{settle}/orders` | -| [getDeliveryOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3888) | :closed_lock_with_key: | GET | `/delivery/{settle}/orders` | -| [cancelAllDeliveryOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3901) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/orders` | -| [getDeliveryOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3920) | :closed_lock_with_key: | GET | `/delivery/{settle}/orders/{order_id}` | -| [cancelDeliveryOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3935) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/orders/{order_id}` | -| [getDeliveryTradingHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3950) | :closed_lock_with_key: | GET | `/delivery/{settle}/my_trades` | -| [getDeliveryClosedPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3963) | :closed_lock_with_key: | GET | `/delivery/{settle}/position_close` | -| [getDeliveryLiquidationHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3976) | :closed_lock_with_key: | GET | `/delivery/{settle}/liquidates` | -| [getDeliverySettlementHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L3989) | :closed_lock_with_key: | GET | `/delivery/{settle}/settlements` | -| [submitDeliveryTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4002) | :closed_lock_with_key: | POST | `/delivery/{settle}/price_orders` | -| [getDeliveryAutoOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4017) | :closed_lock_with_key: | GET | `/delivery/{settle}/price_orders` | -| [cancelAllOpenDeliveryOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4030) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/price_orders` | -| [getDeliveryTriggeredOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4046) | :closed_lock_with_key: | GET | `/delivery/{settle}/price_orders/{order_id}` | -| [cancelTriggeredDeliveryOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4061) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/price_orders/{order_id}` | -| [getOptionsUnderlyings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4080) | | GET | `/options/underlyings` | -| [getOptionsExpirationTimes()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4090) | | GET | `/options/expirations` | -| [getOptionsContracts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4100) | | GET | `/options/contracts` | -| [getOptionsContract()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4113) | | GET | `/options/contracts/{contract}` | -| [getOptionsSettlementHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4123) | | GET | `/options/settlements` | -| [getOptionsContractSettlement()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4135) | | GET | `/options/settlements/{contract}` | -| [getOptionsMySettlements()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4150) | :closed_lock_with_key: | GET | `/options/my_settlements` | -| [getOptionsOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4164) | | GET | `/options/order_book` | -| [getOptionsTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4176) | | GET | `/options/tickers` | -| [getOptionsUnderlyingTicker()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4190) | | GET | `/options/underlying/tickers/{underlying}` | -| [getOptionsCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4204) | | GET | `/options/candlesticks` | -| [getOptionsUnderlyingCandles()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4214) | | GET | `/options/underlying/candlesticks` | -| [getOptionsTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4226) | | GET | `/options/trades` | -| [getOptionsAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4237) | :closed_lock_with_key: | GET | `/options/accounts` | -| [getOptionsAccountChange()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4247) | :closed_lock_with_key: | GET | `/options/account_book` | -| [getOptionsPositionsUnderlying()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4259) | :closed_lock_with_key: | GET | `/options/positions` | -| [getOptionsPositionContract()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4271) | :closed_lock_with_key: | GET | `/options/positions/{contract}` | -| [getOptionsLiquidation()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4283) | :closed_lock_with_key: | GET | `/options/position_close` | -| [submitOptionsOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4296) | :closed_lock_with_key: | POST | `/options/orders` | -| [getOptionsOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4308) | :closed_lock_with_key: | GET | `/options/orders` | -| [cancelAllOpenOptionsOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4320) | :closed_lock_with_key: | DELETE | `/options/orders` | -| [getOptionsOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4334) | :closed_lock_with_key: | GET | `/options/orders/{order_id}` | -| [amendOptionsOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4346) | :closed_lock_with_key: | PUT | `/options/orders/{order_id}` | -| [cancelOptionsOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4361) | :closed_lock_with_key: | DELETE | `/options/orders/{order_id}` | -| [submitOptionsCountdownCancel()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4380) | :closed_lock_with_key: | POST | `/options/countdown_cancel_all` | -| [getOptionsPersonalHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4396) | :closed_lock_with_key: | GET | `/options/my_trades` | -| [setOptionsMMPSettings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4408) | :closed_lock_with_key: | POST | `/options/mmp` | -| [getOptionsMMPSettings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4420) | :closed_lock_with_key: | GET | `/options/mmp` | -| [resetOptionsMMPSettings()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4432) | :closed_lock_with_key: | POST | `/options/mmp/reset` | -| [getLendingCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4448) | | GET | `/earn/uni/currencies` | -| [getLendingCurrency()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4458) | | GET | `/earn/uni/currencies/{currency}` | -| [submitLendOrRedeemOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4468) | :closed_lock_with_key: | POST | `/earn/uni/lends` | -| [getLendingOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4478) | :closed_lock_with_key: | GET | `/earn/uni/lends` | -| [updateLendingOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4490) | :closed_lock_with_key: | PATCH | `/earn/uni/lends` | -| [getLendingRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4503) | :closed_lock_with_key: | GET | `/earn/uni/lend_records` | -| [getLendingTotalInterest()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4516) | :closed_lock_with_key: | GET | `/earn/uni/interests/{currency}` | -| [getLendingInterestRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4529) | :closed_lock_with_key: | GET | `/earn/uni/interest_records` | -| [updateInterestReinvestment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4542) | :closed_lock_with_key: | PUT | `/earn/uni/interest_reinvest` | -| [getLendingInterestStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4558) | :closed_lock_with_key: | GET | `/earn/uni/interest_status/{currency}` | -| [getLendingAnnualizedTrendChart()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4573) | :closed_lock_with_key: | GET | `/earn/uni/chart` | -| [getLendingEstimatedRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4581) | :closed_lock_with_key: | GET | `/earn/uni/rate` | -| [submitMultiLoanOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4598) | :closed_lock_with_key: | POST | `/loan/multi_collateral/orders` | -| [getMultiLoanOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4610) | :closed_lock_with_key: | GET | `/loan/multi_collateral/orders` | -| [getMultiLoanOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4622) | :closed_lock_with_key: | GET | `/loan/multi_collateral/orders/{order_id}` | -| [repayMultiLoan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4632) | :closed_lock_with_key: | POST | `/loan/multi_collateral/repay` | -| [getMultiLoanRepayRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4642) | :closed_lock_with_key: | GET | `/loan/multi_collateral/repay` | -| [updateMultiLoan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4654) | :closed_lock_with_key: | POST | `/loan/multi_collateral/mortgage` | -| [getMultiLoanAdjustmentRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4666) | :closed_lock_with_key: | GET | `/loan/multi_collateral/mortgage` | -| [getMultiLoanCurrencyQuota()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4678) | :closed_lock_with_key: | GET | `/loan/multi_collateral/currency_quota` | -| [getMultiLoanSupportedCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4690) | | GET | `/loan/multi_collateral/currencies` | -| [getMultiLoanRatio()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4699) | | GET | `/loan/multi_collateral/ltv` | -| [getMultiLoanFixedRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4708) | | GET | `/loan/multi_collateral/fixed_rate` | -| [getMultiLoanCurrentRates()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4721) | | GET | `/loan/multi_collateral/current_rate` | -| [getDualInvestmentProducts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4743) | | GET | `/earn/dual/investment_plan` | -| [getDualInvestmentOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4754) | :closed_lock_with_key: | GET | `/earn/dual/orders` | -| [submitDualInvestmentOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4766) | :closed_lock_with_key: | POST | `/earn/dual/orders` | -| [getDualOrderRefundPreview()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4775) | :closed_lock_with_key: | GET | `/earn/dual/order-refund-preview` | -| [submitDualOrderRefund()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4784) | :closed_lock_with_key: | POST | `/earn/dual/order-refund` | -| [updateDualOrderReinvest()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4793) | :closed_lock_with_key: | POST | `/earn/dual/modify-order-reinvest` | -| [getDualProjectRecommend()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4804) | :closed_lock_with_key: | GET | `/earn/dual/project-recommend` | -| [getEarnFixedTermProducts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4813) | | GET | `/earn/fixed-term/product` | -| [getEarnFixedTermProductsByAsset()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4822) | | GET | `/earn/fixed-term/product/{asset}/list` | -| [createEarnFixedTermLend()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4832) | :closed_lock_with_key: | POST | `/earn/fixed-term/user/lend` | -| [getEarnFixedTermLends()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4841) | :closed_lock_with_key: | GET | `/earn/fixed-term/user/lend` | -| [createEarnFixedTermPreRedeem()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4850) | :closed_lock_with_key: | POST | `/earn/fixed-term/user/pre-redeem` | -| [getEarnFixedTermHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4861) | :closed_lock_with_key: | GET | `/earn/fixed-term/user/history` | -| [createAutoInvestPlan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4870) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/create` | -| [updateAutoInvestPlan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4879) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/update` | -| [stopAutoInvestPlan()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4886) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/stop` | -| [addAutoInvestPlanPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4893) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/add_position` | -| [getAutoInvestCoins()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4904) | :closed_lock_with_key: | GET | `/earn/autoinvest/coins` | -| [getAutoInvestMinAmount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4913) | :closed_lock_with_key: | POST | `/earn/autoinvest/min_invest_amount` | -| [getAutoInvestPlanRecords()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4924) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/records` | -| [getAutoInvestOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4933) | :closed_lock_with_key: | GET | `/earn/autoinvest/orders` | -| [getAutoInvestConfig()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4942) | :closed_lock_with_key: | GET | `/earn/autoinvest/config` | -| [getAutoInvestPlanDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4949) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/detail` | -| [getAutoInvestPlans()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4958) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/list_info` | -| [getStakingCoins()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4970) | :closed_lock_with_key: | GET | `/earn/staking/coins` | -| [submitStakingSwap()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L4983) | :closed_lock_with_key: | POST | `/earn/staking/swap` | -| [getAccountDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5002) | :closed_lock_with_key: | GET | `/account/detail` | -| [getAccountRateLimit()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5011) | :closed_lock_with_key: | GET | `/account/rate_limit` | -| [createStpGroup()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5021) | :closed_lock_with_key: | POST | `/account/stp_groups` | -| [getStpGroups()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5031) | :closed_lock_with_key: | GET | `/account/stp_groups` | -| [getStpGroupUsers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5041) | :closed_lock_with_key: | GET | `/account/stp_groups/{stp_id}/users` | -| [addUsersToStpGroup()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5051) | :closed_lock_with_key: | POST | `/account/stp_groups/{stp_id}/users` | -| [deleteUserFromStpGroup()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5067) | :closed_lock_with_key: | DELETE | `/account/stp_groups/{stp_id}/users` | -| [setGTDeduction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5085) | :closed_lock_with_key: | POST | `/account/debit_fee` | -| [getGTDeduction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5096) | :closed_lock_with_key: | GET | `/account/debit_fee` | -| [getAccountMainKeys()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5105) | :closed_lock_with_key: | GET | `/account/main_keys` | -| [getAgencyTransactionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5121) | :closed_lock_with_key: | GET | `/rebate/agency/transaction_history` | -| [getAgencyCommissionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5134) | :closed_lock_with_key: | GET | `/rebate/agency/commission_history` | -| [getPartnerTransactionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5148) | :closed_lock_with_key: | GET | `/rebate/partner/transaction_history` | -| [getPartnerCommissionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5163) | :closed_lock_with_key: | GET | `/rebate/partner/commission_history` | -| [getPartnerSubordinateList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5186) | :closed_lock_with_key: | GET | `/rebate/partner/sub_list` | -| [getPartnerAgentDataAggregated()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5196) | :closed_lock_with_key: | GET | `/rebate/partner/data/aggregated` | -| [getBrokerCommissionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5209) | :closed_lock_with_key: | GET | `/rebate/broker/commission_history` | -| [getBrokerTransactionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5222) | :closed_lock_with_key: | GET | `/rebate/broker/transaction_history` | -| [getUserRebateInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5231) | :closed_lock_with_key: | GET | `/rebate/user/info` | -| [createOTCQuote()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5266) | :closed_lock_with_key: | POST | `/otc/quote` | -| [createOTCFiatOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5278) | :closed_lock_with_key: | POST | `/otc/order/create` | -| [createOTCStablecoinOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5292) | :closed_lock_with_key: | POST | `/otc/stable_coin/order/create` | -| [getOTCBankList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5301) | :closed_lock_with_key: | GET | `/otc/bank/list` | -| [getOTCBankListLegacy()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5308) | :closed_lock_with_key: | GET | `/otc/bank_list` | -| [createOTCBank()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5315) | :closed_lock_with_key: | POST | `/otc/bank/delete` | -| [deleteOTCBank()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5326) | :closed_lock_with_key: | POST | `/otc/bank/delete` | -| [setDefaultOTCBank()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5333) | :closed_lock_with_key: | POST | `/otc/bank/set_default` | -| [getOTCBankSupplementChecklist()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5340) | :closed_lock_with_key: | GET | `/otc/bank/bank_supplement_checklist` | -| [submitOTCBankPersonalSupplement()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5349) | :closed_lock_with_key: | POST | `/otc/order/paid` | -| [submitOTCBankEnterpriseSupplement()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5368) | :closed_lock_with_key: | POST | `/otc/order/paid` | -| [markOTCOrderAsPaid()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5404) | :closed_lock_with_key: | POST | `/otc/order/paid` | -| [cancelOTCOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5418) | :closed_lock_with_key: | POST | `/otc/order/cancel` | -| [getOTCFiatOrderList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5430) | :closed_lock_with_key: | GET | `/otc/order/list` | -| [getOTCStablecoinOrderList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5444) | :closed_lock_with_key: | GET | `/otc/stable_coin/order/list` | -| [getOTCFiatOrderDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5458) | :closed_lock_with_key: | GET | `/otc/order/detail` | -| [getP2PMerchantUserInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5472) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_user_info` | -| [getP2PMerchantCounterpartyUserInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5481) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_counterparty_user_info` | -| [getP2PMerchantMyselfPayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5493) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_myself_payment` | -| [getP2PMerchantSpotBalance()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5506) | :closed_lock_with_key: | POST | `/p2p/merchant/account/set_merchant_work_hours` | -| [setP2PMerchantWorkHours()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5515) | :closed_lock_with_key: | POST | `/p2p/merchant/account/set_merchant_work_hours` | -| [getP2PMerchantPendingTransactionList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5526) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_pending_transaction_list` | -| [getP2PMerchantCompletedTransactionList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5538) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_completed_transaction_list` | -| [getP2PMerchantTransactionDetails()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5550) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_transaction_details` | -| [confirmP2PMerchantPayment()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5562) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/confirm-payment` | -| [confirmP2PMerchantReceipt()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5573) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/confirm-receipt` | -| [cancelP2PMerchantTransaction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5584) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/cancel` | -| [placeP2PMerchantBizPushOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5595) | :closed_lock_with_key: | POST | `/p2p/merchant/books/place_biz_push_order` | -| [updateP2PMerchantAdsStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5606) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_update_status` | -| [getP2PMerchantAdsDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5619) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_detail` | -| [getP2PMerchantMyAdsList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5628) | :closed_lock_with_key: | POST | `/p2p/merchant/books/my_ads_list` | -| [getP2PMerchantAdsList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5639) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_list` | -| [getP2PMerchantChatsList()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5648) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/get_chats_list` | -| [sendP2PMerchantChatMessage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5659) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/send_chat_message` | -| [uploadP2PMerchantChatFile()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5670) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/upload_chat_file` | -| [getCrossExSymbols()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5691) | | GET | `/crossex/rule/symbols` | -| [getCrossExRiskLimits()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5703) | | GET | `/crossex/rule/risk_limits` | -| [getCrossExTransferCoins()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5717) | | GET | `/crossex/transfers/coin` | -| [createCrossExTransfer()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5731) | :closed_lock_with_key: | POST | `/crossex/transfers` | -| [getCrossExTransferHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5745) | :closed_lock_with_key: | GET | `/crossex/transfers` | -| [createCrossExOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5759) | :closed_lock_with_key: | POST | `/crossex/orders` | -| [cancelBatchCrossExOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5765) | :closed_lock_with_key: | POST | `/crossex/batch_cancel_orders` | -| [cancelCrossExOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5779) | :closed_lock_with_key: | DELETE | `/crossex/orders/{order_id}` | -| [modifyCrossExOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5792) | :closed_lock_with_key: | PUT | `/crossex/orders/{order_id}` | -| [getCrossExOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5807) | :closed_lock_with_key: | GET | `/crossex/orders/{order_id}` | -| [createCrossExConvertQuote()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5819) | :closed_lock_with_key: | POST | `/crossex/convert/quote` | -| [createCrossExConvertOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5833) | :closed_lock_with_key: | POST | `/crossex/convert/orders` | -| [updateCrossExAccount()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5847) | :closed_lock_with_key: | PUT | `/crossex/accounts` | -| [getCrossExAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5861) | :closed_lock_with_key: | GET | `/crossex/accounts` | -| [setCrossExPositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5873) | :closed_lock_with_key: | POST | `/crossex/positions/leverage` | -| [getCrossExPositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5887) | :closed_lock_with_key: | GET | `/crossex/positions/leverage` | -| [setCrossExMarginPositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5901) | :closed_lock_with_key: | POST | `/crossex/margin_positions/leverage` | -| [getCrossExMarginPositionLeverage()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5917) | :closed_lock_with_key: | GET | `/crossex/margin_positions/leverage` | -| [closeCrossExPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5931) | :closed_lock_with_key: | POST | `/crossex/position` | -| [getCrossExInterestRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5945) | :closed_lock_with_key: | GET | `/crossex/interest_rate` | -| [getCrossExFeeRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5958) | :closed_lock_with_key: | GET | `/crossex/fee` | -| [getCrossExPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5970) | :closed_lock_with_key: | GET | `/crossex/positions` | -| [getCrossExMarginPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5984) | :closed_lock_with_key: | GET | `/crossex/margin_positions` | -| [getCrossExAdlRank()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L5998) | :closed_lock_with_key: | GET | `/crossex/adl_rank` | -| [getCrossExOpenOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6010) | :closed_lock_with_key: | GET | `/crossex/open_orders` | -| [getCrossExHistoryOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6024) | :closed_lock_with_key: | GET | `/crossex/history_orders` | -| [getCrossExHistoryPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6038) | :closed_lock_with_key: | GET | `/crossex/history_positions` | -| [getCrossExHistoryMarginPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6052) | :closed_lock_with_key: | GET | `/crossex/history_margin_positions` | -| [getCrossExHistoryMarginInterests()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6066) | :closed_lock_with_key: | GET | `/crossex/history_margin_interests` | -| [getCrossExHistoryTrades()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6080) | :closed_lock_with_key: | GET | `/crossex/history_trades` | -| [getCrossExAccountBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6094) | :closed_lock_with_key: | GET | `/crossex/account_book` | -| [getCrossExCoinDiscountRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6108) | :closed_lock_with_key: | GET | `/crossex/coin_discount_rate` | -| [listCrossExMarketTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6114) | | GET | `/crossex/market/tickers` | -| [listCrossExMarketFundingInfo()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6120) | | GET | `/crossex/market/funding_info` | -| [getAlphaAccounts()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6138) | :closed_lock_with_key: | GET | `/alpha/accounts` | -| [getAlphaAccountBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6150) | :closed_lock_with_key: | GET | `/alpha/account_book` | -| [createAlphaQuote()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6164) | :closed_lock_with_key: | POST | `/alpha/quote` | -| [createAlphaOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6176) | :closed_lock_with_key: | POST | `/alpha/orders` | -| [getAlphaOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6188) | :closed_lock_with_key: | GET | `/alpha/orders` | -| [getAlphaOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6200) | :closed_lock_with_key: | GET | `/alpha/order` | -| [getAlphaCurrencies()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6212) | | GET | `/alpha/currencies` | -| [getAlphaTickers()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6224) | | GET | `/alpha/tickers` | -| [getTradFiMT5Account()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6230) | :closed_lock_with_key: | GET | `/tradfi/users/mt5-account` | -| [getTradFiSymbolCategories()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6234) | | GET | `/tradfi/symbols/categories` | -| [getTradFiSymbols()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6240) | | GET | `/tradfi/symbols` | -| [getTradFiSymbolCommissions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6244) | | GET | `/tradfi/symbols/commissions` | -| [getTradFiSymbolDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6250) | :closed_lock_with_key: | GET | `/tradfi/symbols/detail` | -| [getTradFiKlines()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6256) | | GET | `/tradfi/symbols/{symbol}/klines` | -| [getTradFiTicker()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6263) | | GET | `/tradfi/symbols/{symbol}/tickers` | -| [createTradFiUser()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6267) | :closed_lock_with_key: | POST | `/tradfi/users` | -| [getTradFiAssets()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6271) | :closed_lock_with_key: | GET | `/tradfi/users/assets` | -| [createTradFiTransaction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6275) | :closed_lock_with_key: | POST | `/tradfi/transactions` | -| [getTradFiTransactions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6281) | :closed_lock_with_key: | GET | `/tradfi/transactions` | -| [createTradFiOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6287) | :closed_lock_with_key: | POST | `/tradfi/orders` | -| [getTradFiOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6293) | :closed_lock_with_key: | GET | `/tradfi/orders` | -| [modifyTradFiOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6297) | :closed_lock_with_key: | PUT | `/tradfi/orders/{orderId}` | -| [cancelTradFiOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6304) | :closed_lock_with_key: | DELETE | `/tradfi/orders/{orderId}` | -| [getTradFiOrderHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6308) | :closed_lock_with_key: | GET | `/tradfi/orders/history` | -| [getTradFiPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6314) | :closed_lock_with_key: | GET | `/tradfi/positions` | -| [modifyTradFiPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6320) | :closed_lock_with_key: | PUT | `/tradfi/positions/{positionId}` | -| [closeTradFiPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6329) | :closed_lock_with_key: | POST | `/tradfi/positions/{positionId}/close` | -| [getTradFiPositionHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6338) | :closed_lock_with_key: | GET | `/tradfi/positions/history` | -| [getTradFiOrderLog()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6347) | :closed_lock_with_key: | GET | `/tradfi/orders/log/{log_id}` | -| [getStockUserAssets()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6355) | :closed_lock_with_key: | GET | `/stock/users/assets` | -| [getStockSymbols()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6361) | | GET | `/stock/symbols` | -| [getStockSymbolDetail()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6367) | :closed_lock_with_key: | GET | `/stock/symbols/detail` | -| [getStockOrderBook()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6373) | | GET | `/stock/market/{symbol}/orderbook` | -| [getStockOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6377) | :closed_lock_with_key: | GET | `/stock/orders` | -| [createStockOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6383) | :closed_lock_with_key: | POST | `/stock/orders` | -| [cancelAllStockOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6389) | :closed_lock_with_key: | DELETE | `/stock/orders` | -| [getStockOrderHistory()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6393) | :closed_lock_with_key: | GET | `/stock/orders/history` | -| [updateStockOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6399) | :closed_lock_with_key: | PUT | `/stock/orders/{orderId}` | -| [cancelStockOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6406) | :closed_lock_with_key: | DELETE | `/stock/orders/{orderId}` | -| [getStockPositions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6412) | :closed_lock_with_key: | GET | `/stock/positions` | -| [closeStockPosition()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6418) | :closed_lock_with_key: | POST | `/stock/positions/close` | -| [getStockTransactions()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6424) | :closed_lock_with_key: | GET | `/stock/transactions` | -| [createStockTransaction()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6430) | :closed_lock_with_key: | POST | `/stock/transactions` | -| [getStockExchanges()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6436) | | GET | `/stock/exchanges` | -| [getStockFeeRate()](https://github.com/tiagosiebler/gateio-api/blob/master/src/RestClient.ts#L6440) | | GET | `/stock/fee-rate` | +| [getSystemMaintenanceStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L703) | | GET | `/v1/public/system_info` | +| [submitWithdrawal()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L720) | :closed_lock_with_key: | POST | `/withdrawals` | +| [submitSpotMainAccountTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L734) | :closed_lock_with_key: | POST | `/withdrawals/push` | +| [cancelWithdrawal()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L750) | :closed_lock_with_key: | DELETE | `/withdrawals/{withdrawal_id}` | +| [getCurrencyChains()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L767) | | GET | `/wallet/currency_chains` | +| [createDepositAddress()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L777) | :closed_lock_with_key: | GET | `/wallet/deposit_address` | +| [getWithdrawalRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L791) | :closed_lock_with_key: | GET | `/wallet/withdrawals` | +| [getDepositRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L805) | :closed_lock_with_key: | GET | `/wallet/deposits` | +| [submitTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L824) | :closed_lock_with_key: | POST | `/wallet/transfers` | +| [getTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L836) | :closed_lock_with_key: | GET | `/wallet/transfers` | +| [submitMainSubTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L848) | :closed_lock_with_key: | POST | `/wallet/sub_account_transfers` | +| [getMainSubTransfers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L862) | :closed_lock_with_key: | GET | `/wallet/sub_account_transfers` | +| [submitSubToSubTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L876) | :closed_lock_with_key: | POST | `/wallet/sub_account_to_sub_account` | +| [getTransferStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L891) | :closed_lock_with_key: | GET | `/wallet/order_status` | +| [getWithdrawalStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L907) | :closed_lock_with_key: | GET | `/wallet/withdraw_status` | +| [getSubBalance()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L919) | :closed_lock_with_key: | GET | `/wallet/sub_account_balances` | +| [getSubMarginBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L931) | :closed_lock_with_key: | GET | `/wallet/sub_account_margin_balances` | +| [getSubFuturesBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L943) | :closed_lock_with_key: | GET | `/wallet/sub_account_futures_balances` | +| [getSubCrossMarginBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L956) | :closed_lock_with_key: | GET | `/wallet/sub_account_cross_margin_balances` | +| [getSavedAddresses()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L968) | :closed_lock_with_key: | GET | `/wallet/saved_address` | +| [getTradingFees()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L978) | :closed_lock_with_key: | GET | `/wallet/fee` | +| [getBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L999) | :closed_lock_with_key: | GET | `/wallet/total_balance` | +| [getSmallBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1008) | :closed_lock_with_key: | GET | `/wallet/small_balance` | +| [convertSmallBalance()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1018) | :closed_lock_with_key: | POST | `/wallet/small_balance` | +| [getSmallBalanceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1031) | :closed_lock_with_key: | GET | `/wallet/small_balance_history` | +| [getPushOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1043) | :closed_lock_with_key: | GET | `/wallet/push` | +| [getLowCapExchangeList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1052) | :closed_lock_with_key: | GET | `/wallet/getLowCapExchangeList` | +| [createSubAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1067) | :closed_lock_with_key: | POST | `/sub_accounts` | +| [getSubAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1078) | :closed_lock_with_key: | GET | `/sub_accounts` | +| [getSubAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1088) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}` | +| [createSubAccountApiKey()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1098) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/keys` | +| [getSubAccountApiKeys()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1111) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}/keys` | +| [updateSubAccountApiKey()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1125) | :closed_lock_with_key: | PUT | `/sub_accounts/{user_id}/keys/{key}` | +| [deleteSubAccountApiKey()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1136) | :closed_lock_with_key: | DELETE | `/sub_accounts/{user_id}/keys/{key}` | +| [getSubAccountApiKey()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1151) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}/keys/{key}` | +| [lockSubAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1166) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/lock` | +| [unlockSubAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1176) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/unlock` | +| [getSubAccountMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1190) | :closed_lock_with_key: | GET | `/sub_accounts/unified_mode` | +| [getUnifiedAccountInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1209) | :closed_lock_with_key: | GET | `/unified/accounts` | +| [getUnifiedMaxBorrow()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1225) | :closed_lock_with_key: | GET | `/unified/borrowable` | +| [getUnifiedMaxTransferable()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1241) | :closed_lock_with_key: | GET | `/unified/transferable` | +| [getUnifiedMaxTransferables()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1256) | :closed_lock_with_key: | GET | `/unified/transferables` | +| [getUnifiedBatchMaxBorrowable()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1265) | :closed_lock_with_key: | GET | `/unified/batch_borrowable` | +| [submitUnifiedBorrowOrRepay()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1283) | :closed_lock_with_key: | POST | `/unified/loans` | +| [getUnifiedLoans()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1295) | :closed_lock_with_key: | GET | `/unified/loans` | +| [getUnifiedLoanRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1305) | :closed_lock_with_key: | GET | `/unified/loan_records` | +| [getUnifiedInterestRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1317) | :closed_lock_with_key: | GET | `/unified/interest_records` | +| [getUnifiedRiskUnitDetails()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1328) | :closed_lock_with_key: | GET | `/unified/risk_units` | +| [setUnifiedAccountMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1340) | :closed_lock_with_key: | PUT | `/unified/unified_mode` | +| [getUnifiedAccountMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1349) | :closed_lock_with_key: | GET | `/unified/unified_mode` | +| [getUnifiedEstimateRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1361) | :closed_lock_with_key: | GET | `/unified/estimate_rate` | +| [getUnifiedCurrencyDiscountTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1372) | | GET | `/unified/currency_discount_tiers` | +| [getLoanMarginTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1384) | | GET | `/unified/loan_margin_tiers` | +| [portfolioMarginCalculate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1401) | | POST | `/unified/portfolio_calculator` | +| [setUserLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1415) | :closed_lock_with_key: | POST | `/unified/leverage/user_setting` | +| [getUserCurrencyLeverageConfig()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1429) | :closed_lock_with_key: | GET | `/unified/leverage/user_currency_config` | +| [getUserCurrencyLeverageSettings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1443) | :closed_lock_with_key: | GET | `/unified/leverage/user_currency_setting` | +| [updateUserCurrencyLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1458) | :closed_lock_with_key: | POST | `/unified/leverage/user_currency_setting` | +| [getUnifiedLoanCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1473) | :closed_lock_with_key: | GET | `/unified/currencies` | +| [getHistoricalLendingRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1485) | :closed_lock_with_key: | GET | `/unified/history_loan_rate` | +| [submitUnifiedLoanRepay()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1491) | :closed_lock_with_key: | POST | `/unified/loans/repay` | +| [getEstimatedQuickRepayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1498) | :closed_lock_with_key: | GET | `/unified/estimated_quick_repayment` | +| [createQuickRepayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1505) | :closed_lock_with_key: | POST | `/unified/quick_repayment` | +| [setUnifiedDeltaNeutral()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1516) | :closed_lock_with_key: | POST | `/unified/delta_neutral` | +| [getUnifiedDeltaNeutral()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1525) | :closed_lock_with_key: | GET | `/unified/delta_neutral` | +| [getSpotCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1545) | | GET | `/spot/currencies` | +| [getSpotCurrency()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1555) | | GET | `/spot/currencies/{currency}` | +| [getSpotCurrencyPairs()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1564) | | GET | `/spot/currency_pairs` | +| [getSpotCurrencyPair()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1574) | | GET | `/spot/currency_pairs/{currency_pair}` | +| [getSpotTicker()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1588) | | GET | `/spot/tickers` | +| [getSpotOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1603) | | GET | `/spot/order_book` | +| [getSpotTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1616) | | GET | `/spot/trades` | +| [getSpotCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1628) | | GET | `/spot/candlesticks` | +| [getSpotFeeRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1640) | :closed_lock_with_key: | GET | `/spot/fee` | +| [getSpotBatchFeeRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1649) | :closed_lock_with_key: | GET | `/spot/batch_fee` | +| [getSpotAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1661) | :closed_lock_with_key: | GET | `/spot/accounts` | +| [getSpotAccountBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1673) | :closed_lock_with_key: | GET | `/spot/account_book` | +| [submitSpotBatchOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1692) | :closed_lock_with_key: | POST | `/spot/batch_orders` | +| [getSpotOpenOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1719) | :closed_lock_with_key: | GET | `/spot/open_orders` | +| [submitSpotClosePosCrossDisabled()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1735) | :closed_lock_with_key: | POST | `/spot/cross_liquidate_orders` | +| [submitSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1751) | :closed_lock_with_key: | POST | `/spot/orders` | +| [getSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1768) | :closed_lock_with_key: | GET | `/spot/orders` | +| [cancelSpotOpenOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1783) | :closed_lock_with_key: | DELETE | `/spot/orders` | +| [batchCancelSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1811) | :closed_lock_with_key: | POST | `/spot/cancel_batch_orders` | +| [getSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1836) | :closed_lock_with_key: | GET | `/spot/orders/{order_id}` | +| [updateSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1853) | :closed_lock_with_key: | PATCH | `/spot/orders/{order_id}` | +| [cancelSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1881) | :closed_lock_with_key: | DELETE | `/spot/orders/{order_id}` | +| [getSpotTradingHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1910) | :closed_lock_with_key: | GET | `/spot/my_trades` | +| [submitSpotCountdownOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1939) | :closed_lock_with_key: | POST | `/spot/countdown_cancel_all` | +| [batchUpdateSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1958) | :closed_lock_with_key: | POST | `/spot/amend_batch_orders` | +| [getSpotInsuranceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1985) | :closed_lock_with_key: | GET | `/spot/insurance_history` | +| [submitSpotPriceTriggerOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1999) | :closed_lock_with_key: | POST | `/spot/price_orders` | +| [getSpotAutoOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2011) | :closed_lock_with_key: | GET | `/spot/price_orders` | +| [cancelAllOpenSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2023) | :closed_lock_with_key: | DELETE | `/spot/price_orders` | +| [getPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2036) | :closed_lock_with_key: | GET | `/spot/price_orders/{order_id}` | +| [cancelSpotTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2048) | :closed_lock_with_key: | DELETE | `/spot/price_orders/{order_id}` | +| [listSpotPovOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2062) | :closed_lock_with_key: | GET | `/spot/pov_orders` | +| [createSpotPovOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2074) | :closed_lock_with_key: | POST | `/spot/pov_orders` | +| [cancelSpotPovOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2086) | :closed_lock_with_key: | POST | `/spot/pov_orders/cancel` | +| [getSpotPovOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2100) | :closed_lock_with_key: | GET | `/spot/pov_orders/{order_id}` | +| [cancelSpotPovOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2112) | :closed_lock_with_key: | POST | `/spot/pov_orders/{order_id}/cancel` | +| [setCollateralCurrency()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2124) | :closed_lock_with_key: | POST | `/unified/collateral_currencies` | +| [getMarginAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2145) | :closed_lock_with_key: | GET | `/margin/accounts` | +| [getMarginBalanceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2159) | :closed_lock_with_key: | GET | `/margin/account_book` | +| [getFundingAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2177) | :closed_lock_with_key: | GET | `/margin/funding_accounts` | +| [updateAutoRepaymentSetting()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2195) | :closed_lock_with_key: | POST | `/margin/auto_repay` | +| [getAutoRepaymentSetting()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2206) | :closed_lock_with_key: | GET | `/margin/auto_repay` | +| [getMarginTransferableAmount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2220) | :closed_lock_with_key: | GET | `/margin/transferable` | +| [getCrossMarginCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2237) | | GET | `/margin/cross/currencies` | +| [getCrossMarginCurrency()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2248) | | GET | `/margin/cross/currencies/{currency}` | +| [getCrossMarginAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2260) | :closed_lock_with_key: | GET | `/margin/cross/accounts` | +| [getCrossMarginAccountHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2273) | :closed_lock_with_key: | GET | `/margin/cross/account_book` | +| [submitCrossMarginBorrowLoan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2290) | :closed_lock_with_key: | POST | `/margin/cross/loans` | +| [getCrossMarginBorrowHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2305) | :closed_lock_with_key: | GET | `/margin/cross/loans` | +| [getCrossMarginBorrowLoan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2318) | :closed_lock_with_key: | GET | `/margin/cross/loans/{loan_id}` | +| [submitCrossMarginRepayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2333) | :closed_lock_with_key: | POST | `/margin/cross/repayments` | +| [getCrossMarginRepayments()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2349) | :closed_lock_with_key: | GET | `/margin/cross/repayments` | +| [getCrossMarginInterestRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2362) | :closed_lock_with_key: | GET | `/margin/cross/interest_records` | +| [getCrossMarginTransferableAmount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2378) | :closed_lock_with_key: | GET | `/margin/cross/transferable` | +| [getEstimatedInterestRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2394) | :closed_lock_with_key: | GET | `/margin/cross/estimate_rate` | +| [getCrossMarginBorrowableAmount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2408) | :closed_lock_with_key: | GET | `/margin/cross/borrowable` | +| [getMarginUserLoanTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2421) | :closed_lock_with_key: | GET | `/margin/user/loan_margin_tiers` | +| [getMarginPublicLoanTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2437) | | GET | `/margin/loan_margin_tiers` | +| [setMarginUserLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2453) | :closed_lock_with_key: | POST | `/margin/leverage/user_market_setting` | +| [getMarginUserAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2470) | :closed_lock_with_key: | GET | `/margin/user/account` | +| [getLendingMarkets()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2485) | | GET | `/margin/uni/currency_pairs` | +| [getLendingMarket()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2500) | | GET | `/margin/uni/currency_pairs/{currency_pair}` | +| [getEstimatedInterestRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2512) | :closed_lock_with_key: | GET | `/margin/uni/estimate_rate` | +| [submitMarginUNIBorrowOrRepay()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2522) | :closed_lock_with_key: | POST | `/margin/uni/loans` | +| [getMarginUNILoans()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2538) | :closed_lock_with_key: | GET | `/margin/uni/loans` | +| [getMarginUNILoanRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2548) | :closed_lock_with_key: | GET | `/margin/uni/loan_records` | +| [getMarginUNIInterestRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2560) | :closed_lock_with_key: | GET | `/margin/uni/interest_records` | +| [getMarginUNIMaxBorrow()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2572) | :closed_lock_with_key: | GET | `/margin/uni/borrowable` | +| [getFlashSwapCurrencyPairs()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2588) | | GET | `/flash_swap/currency_pairs` | +| [submitFlashSwapOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2604) | :closed_lock_with_key: | POST | `/flash_swap/orders` | +| [getFlashSwapOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2616) | :closed_lock_with_key: | GET | `/flash_swap/orders` | +| [getFlashSwapOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2628) | :closed_lock_with_key: | GET | `/flash_swap/orders/{order_id}` | +| [submitFlashSwapOrderPreview()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2638) | :closed_lock_with_key: | POST | `/flash_swap/orders/preview` | +| [getFuturesContracts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2655) | | GET | `/futures/{settle}/contracts` | +| [getFuturesContract()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2670) | | GET | `/futures/{settle}/contracts/{contract}` | +| [getFuturesOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2685) | | GET | `/futures/{settle}/order_book` | +| [getFuturesTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2698) | | GET | `/futures/{settle}/trades` | +| [getFuturesCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2713) | | GET | `/futures/{settle}/candlesticks` | +| [getPremiumIndexKLines()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2726) | | GET | `/futures/{settle}/premium_index` | +| [getFuturesTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2739) | | GET | `/futures/{settle}/tickers` | +| [getFundingRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2756) | | GET | `/futures/{settle}/funding_rate` | +| [getBatchFundingRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2772) | | POST | `/futures/{settle}/funding_rates` | +| [getFuturesInsuranceBalanceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2790) | | GET | `/futures/{settle}/insurance` | +| [getFuturesStats()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2809) | | GET | `/futures/{settle}/contract_stats` | +| [getIndexConstituents()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2820) | | GET | `/futures/{settle}/index_constituents/{index}` | +| [getLiquidationHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2837) | | GET | `/futures/{settle}/liq_orders` | +| [getRiskLimitTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2854) | | GET | `/futures/{settle}/risk_limit_tiers` | +| [getFuturesAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2867) | :closed_lock_with_key: | GET | `/futures/{settle}/accounts` | +| [getFuturesAccountBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2881) | :closed_lock_with_key: | GET | `/futures/{settle}/account_book` | +| [getFuturesPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2894) | :closed_lock_with_key: | GET | `/futures/{settle}/positions` | +| [getFuturesPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2909) | :closed_lock_with_key: | GET | `/futures/{settle}/positions/{contract}` | +| [updateFuturesMargin()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2926) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/margin` | +| [updateFuturesLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2954) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/leverage` | +| [getFuturesContractLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2974) | :closed_lock_with_key: | GET | `/futures/{settle}/get_leverage/{contract}` | +| [updateFuturesPositionMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2990) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/cross_mode` | +| [updatePositionRiskLimit()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3007) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/risk_limit` | +| [updateFuturesDualMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3027) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_mode` | +| [getDualModePosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3043) | :closed_lock_with_key: | GET | `/futures/{settle}/dual_comp/positions/{contract}` | +| [updateDualModePositionMargin()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3058) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/margin` | +| [updateDualModePositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3074) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/leverage` | +| [updateDualModePositionRiskLimit()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3098) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/risk_limit` | +| [submitFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3125) | :closed_lock_with_key: | POST | `/futures/{settle}/orders` | +| [getFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3146) | :closed_lock_with_key: | GET | `/futures/{settle}/orders` | +| [cancelAllFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3161) | :closed_lock_with_key: | DELETE | `/futures/{settle}/orders` | +| [getFuturesOrdersByTimeRange()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3181) | :closed_lock_with_key: | GET | `/futures/{settle}/orders_timerange` | +| [submitFuturesBatchOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3204) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_orders` | +| [getFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3229) | :closed_lock_with_key: | GET | `/futures/{settle}/orders/{order_id}` | +| [cancelFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3246) | :closed_lock_with_key: | DELETE | `/futures/{settle}/orders/{order_id}` | +| [updateFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3271) | :closed_lock_with_key: | PUT | `/futures/{settle}/orders/{order_id}` | +| [getFuturesTradingHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3292) | :closed_lock_with_key: | GET | `/futures/{settle}/my_trades` | +| [getFuturesTradingHistoryByTimeRange()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3307) | :closed_lock_with_key: | GET | `/futures/{settle}/my_trades_timerange` | +| [getFuturesPositionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3320) | :closed_lock_with_key: | GET | `/futures/{settle}/position_close` | +| [getFuturesLiquidationHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3333) | :closed_lock_with_key: | GET | `/futures/{settle}/liquidates` | +| [getFuturesAutoDeleveragingHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3346) | :closed_lock_with_key: | GET | `/futures/{settle}/auto_deleverages` | +| [setFuturesOrderCancelCountdown()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3363) | :closed_lock_with_key: | POST | `/futures/{settle}/countdown_cancel_all` | +| [getFuturesUserTradingFees()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3380) | :closed_lock_with_key: | GET | `/futures/{settle}/fee` | +| [batchCancelFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3398) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_cancel_orders` | +| [batchUpdateFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3425) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_amend_orders` | +| [getRiskLimitTable()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3447) | | GET | `/futures/{settle}/risk_limit_table` | +| [submitFuturesPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3460) | :closed_lock_with_key: | POST | `/futures/{settle}/price_orders` | +| [getFuturesAutoOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3473) | :closed_lock_with_key: | GET | `/futures/{settle}/price_orders` | +| [cancelAllOpenFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3486) | :closed_lock_with_key: | DELETE | `/futures/{settle}/price_orders` | +| [getFuturesPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3502) | :closed_lock_with_key: | GET | `/futures/{settle}/price_orders/{order_id}` | +| [cancelFuturesPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3517) | :closed_lock_with_key: | DELETE | `/futures/{settle}/price_orders/{order_id}` | +| [updateFuturesPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3532) | :closed_lock_with_key: | PUT | `/futures/{settle}/price_orders/amend` | +| [createTrailOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3547) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/create` | +| [terminateTrailOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3565) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/stop` | +| [batchTerminateTrailOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3578) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/stop_all` | +| [getTrailOrderList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3593) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/list` | +| [getTrailOrderDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3606) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/detail` | +| [updateTrailOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3624) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/update` | +| [getTrailOrderChangeLog()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3637) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/change_log` | +| [createChaseOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3650) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/create` | +| [stopChaseOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3660) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/stop` | +| [stopAllChaseOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3670) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/stop_all` | +| [getChaseOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3682) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/chase/list` | +| [getChaseOrderDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3690) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/chase/detail` | +| [getFuturesPositionCloseHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3699) | :closed_lock_with_key: | GET | `/futures/{settle}/position_close_history` | +| [getFuturesInsuranceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3708) | :closed_lock_with_key: | GET | `/futures/{settle}/insurance` | +| [getAllDeliveryContracts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3725) | | GET | `/delivery/{settle}/contracts` | +| [getDeliveryContract()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3737) | | GET | `/delivery/{settle}/contracts/{contract}` | +| [getDeliveryOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3752) | | GET | `/delivery/{settle}/order_book` | +| [getDeliveryTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3765) | | GET | `/delivery/{settle}/trades` | +| [getDeliveryCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3779) | | GET | `/delivery/{settle}/candlesticks` | +| [getDeliveryTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3790) | | GET | `/delivery/{settle}/tickers` | +| [getDeliveryInsuranceBalanceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3807) | | GET | `/delivery/{settle}/insurance` | +| [getDeliveryAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3826) | :closed_lock_with_key: | GET | `/delivery/{settle}/accounts` | +| [getDeliveryBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3837) | :closed_lock_with_key: | GET | `/delivery/{settle}/account_book` | +| [getDeliveryPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3848) | :closed_lock_with_key: | GET | `/delivery/{settle}/positions` | +| [getDeliveryPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3858) | :closed_lock_with_key: | GET | `/delivery/{settle}/positions/{contract}` | +| [updateDeliveryMargin()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3873) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/margin` | +| [updateDeliveryLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3891) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/leverage` | +| [updateDeliveryRiskLimit()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3909) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/risk_limit` | +| [submitDeliveryOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3929) | :closed_lock_with_key: | POST | `/delivery/{settle}/orders` | +| [getDeliveryOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3944) | :closed_lock_with_key: | GET | `/delivery/{settle}/orders` | +| [cancelAllDeliveryOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3957) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/orders` | +| [getDeliveryOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3976) | :closed_lock_with_key: | GET | `/delivery/{settle}/orders/{order_id}` | +| [cancelDeliveryOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3991) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/orders/{order_id}` | +| [getDeliveryTradingHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4006) | :closed_lock_with_key: | GET | `/delivery/{settle}/my_trades` | +| [getDeliveryClosedPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4019) | :closed_lock_with_key: | GET | `/delivery/{settle}/position_close` | +| [getDeliveryLiquidationHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4032) | :closed_lock_with_key: | GET | `/delivery/{settle}/liquidates` | +| [getDeliverySettlementHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4045) | :closed_lock_with_key: | GET | `/delivery/{settle}/settlements` | +| [submitDeliveryTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4058) | :closed_lock_with_key: | POST | `/delivery/{settle}/price_orders` | +| [getDeliveryAutoOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4073) | :closed_lock_with_key: | GET | `/delivery/{settle}/price_orders` | +| [cancelAllOpenDeliveryOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4086) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/price_orders` | +| [getDeliveryTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4102) | :closed_lock_with_key: | GET | `/delivery/{settle}/price_orders/{order_id}` | +| [cancelTriggeredDeliveryOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4117) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/price_orders/{order_id}` | +| [getOptionsUnderlyings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4136) | | GET | `/options/underlyings` | +| [getOptionsExpirationTimes()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4146) | | GET | `/options/expirations` | +| [getOptionsContracts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4156) | | GET | `/options/contracts` | +| [getOptionsContract()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4169) | | GET | `/options/contracts/{contract}` | +| [getOptionsSettlementHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4179) | | GET | `/options/settlements` | +| [getOptionsContractSettlement()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4191) | | GET | `/options/settlements/{contract}` | +| [getOptionsMySettlements()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4206) | :closed_lock_with_key: | GET | `/options/my_settlements` | +| [getOptionsOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4220) | | GET | `/options/order_book` | +| [getOptionsTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4232) | | GET | `/options/tickers` | +| [getOptionsUnderlyingTicker()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4246) | | GET | `/options/underlying/tickers/{underlying}` | +| [getOptionsCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4260) | | GET | `/options/candlesticks` | +| [getOptionsUnderlyingCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4270) | | GET | `/options/underlying/candlesticks` | +| [getOptionsTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4282) | | GET | `/options/trades` | +| [getOptionsAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4293) | :closed_lock_with_key: | GET | `/options/accounts` | +| [getOptionsAccountChange()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4303) | :closed_lock_with_key: | GET | `/options/account_book` | +| [getOptionsPositionsUnderlying()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4315) | :closed_lock_with_key: | GET | `/options/positions` | +| [getOptionsPositionContract()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4327) | :closed_lock_with_key: | GET | `/options/positions/{contract}` | +| [getOptionsLiquidation()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4339) | :closed_lock_with_key: | GET | `/options/position_close` | +| [submitOptionsOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4352) | :closed_lock_with_key: | POST | `/options/orders` | +| [getOptionsOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4364) | :closed_lock_with_key: | GET | `/options/orders` | +| [cancelAllOpenOptionsOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4376) | :closed_lock_with_key: | DELETE | `/options/orders` | +| [getOptionsOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4390) | :closed_lock_with_key: | GET | `/options/orders/{order_id}` | +| [amendOptionsOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4402) | :closed_lock_with_key: | PUT | `/options/orders/{order_id}` | +| [cancelOptionsOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4417) | :closed_lock_with_key: | DELETE | `/options/orders/{order_id}` | +| [submitOptionsCountdownCancel()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4436) | :closed_lock_with_key: | POST | `/options/countdown_cancel_all` | +| [getOptionsPersonalHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4452) | :closed_lock_with_key: | GET | `/options/my_trades` | +| [setOptionsMMPSettings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4464) | :closed_lock_with_key: | POST | `/options/mmp` | +| [getOptionsMMPSettings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4476) | :closed_lock_with_key: | GET | `/options/mmp` | +| [resetOptionsMMPSettings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4488) | :closed_lock_with_key: | POST | `/options/mmp/reset` | +| [getLendingCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4504) | | GET | `/earn/uni/currencies` | +| [getLendingCurrency()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4514) | | GET | `/earn/uni/currencies/{currency}` | +| [submitLendOrRedeemOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4524) | :closed_lock_with_key: | POST | `/earn/uni/lends` | +| [getLendingOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4534) | :closed_lock_with_key: | GET | `/earn/uni/lends` | +| [updateLendingOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4546) | :closed_lock_with_key: | PATCH | `/earn/uni/lends` | +| [getLendingRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4559) | :closed_lock_with_key: | GET | `/earn/uni/lend_records` | +| [getLendingTotalInterest()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4572) | :closed_lock_with_key: | GET | `/earn/uni/interests/{currency}` | +| [getLendingInterestRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4585) | :closed_lock_with_key: | GET | `/earn/uni/interest_records` | +| [updateInterestReinvestment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4598) | :closed_lock_with_key: | PUT | `/earn/uni/interest_reinvest` | +| [getLendingInterestStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4614) | :closed_lock_with_key: | GET | `/earn/uni/interest_status/{currency}` | +| [getLendingAnnualizedTrendChart()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4629) | :closed_lock_with_key: | GET | `/earn/uni/chart` | +| [getLendingEstimatedRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4637) | :closed_lock_with_key: | GET | `/earn/uni/rate` | +| [submitMultiLoanOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4654) | :closed_lock_with_key: | POST | `/loan/multi_collateral/orders` | +| [getMultiLoanOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4666) | :closed_lock_with_key: | GET | `/loan/multi_collateral/orders` | +| [getMultiLoanOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4678) | :closed_lock_with_key: | GET | `/loan/multi_collateral/orders/{order_id}` | +| [repayMultiLoan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4688) | :closed_lock_with_key: | POST | `/loan/multi_collateral/repay` | +| [getMultiLoanRepayRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4698) | :closed_lock_with_key: | GET | `/loan/multi_collateral/repay` | +| [updateMultiLoan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4710) | :closed_lock_with_key: | POST | `/loan/multi_collateral/mortgage` | +| [getMultiLoanAdjustmentRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4722) | :closed_lock_with_key: | GET | `/loan/multi_collateral/mortgage` | +| [getMultiLoanCurrencyQuota()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4734) | :closed_lock_with_key: | GET | `/loan/multi_collateral/currency_quota` | +| [getMultiLoanSupportedCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4746) | | GET | `/loan/multi_collateral/currencies` | +| [getMultiLoanRatio()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4755) | | GET | `/loan/multi_collateral/ltv` | +| [getMultiLoanFixedRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4764) | | GET | `/loan/multi_collateral/fixed_rate` | +| [getMultiLoanCurrentRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4777) | | GET | `/loan/multi_collateral/current_rate` | +| [getDualInvestmentProducts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4799) | | GET | `/earn/dual/investment_plan` | +| [getDualInvestmentOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4810) | :closed_lock_with_key: | GET | `/earn/dual/orders` | +| [submitDualInvestmentOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4822) | :closed_lock_with_key: | POST | `/earn/dual/orders` | +| [getDualOrderRefundPreview()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4831) | :closed_lock_with_key: | GET | `/earn/dual/order-refund-preview` | +| [submitDualOrderRefund()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4840) | :closed_lock_with_key: | POST | `/earn/dual/order-refund` | +| [updateDualOrderReinvest()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4849) | :closed_lock_with_key: | POST | `/earn/dual/modify-order-reinvest` | +| [getDualProjectRecommend()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4860) | :closed_lock_with_key: | GET | `/earn/dual/project-recommend` | +| [getEarnFixedTermProducts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4869) | | GET | `/earn/fixed-term/product` | +| [getEarnFixedTermProductsByAsset()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4878) | | GET | `/earn/fixed-term/product/{asset}/list` | +| [createEarnFixedTermLend()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4888) | :closed_lock_with_key: | POST | `/earn/fixed-term/user/lend` | +| [getEarnFixedTermLends()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4897) | :closed_lock_with_key: | GET | `/earn/fixed-term/user/lend` | +| [createEarnFixedTermPreRedeem()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4906) | :closed_lock_with_key: | POST | `/earn/fixed-term/user/pre-redeem` | +| [getEarnFixedTermHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4917) | :closed_lock_with_key: | GET | `/earn/fixed-term/user/history` | +| [createAutoInvestPlan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4926) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/create` | +| [updateAutoInvestPlan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4935) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/update` | +| [stopAutoInvestPlan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4942) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/stop` | +| [addAutoInvestPlanPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4949) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/add_position` | +| [getAutoInvestCoins()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4960) | :closed_lock_with_key: | GET | `/earn/autoinvest/coins` | +| [getAutoInvestMinAmount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4969) | :closed_lock_with_key: | POST | `/earn/autoinvest/min_invest_amount` | +| [getAutoInvestPlanRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4980) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/records` | +| [getAutoInvestOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4989) | :closed_lock_with_key: | GET | `/earn/autoinvest/orders` | +| [getAutoInvestConfig()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4998) | :closed_lock_with_key: | GET | `/earn/autoinvest/config` | +| [getAutoInvestPlanDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5005) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/detail` | +| [getAutoInvestPlans()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5014) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/list_info` | +| [getStakingCoins()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5026) | :closed_lock_with_key: | GET | `/earn/staking/coins` | +| [submitStakingSwap()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5039) | :closed_lock_with_key: | POST | `/earn/staking/swap` | +| [getAccountDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5058) | :closed_lock_with_key: | GET | `/account/detail` | +| [getAccountRateLimit()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5067) | :closed_lock_with_key: | GET | `/account/rate_limit` | +| [createStpGroup()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5077) | :closed_lock_with_key: | POST | `/account/stp_groups` | +| [getStpGroups()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5087) | :closed_lock_with_key: | GET | `/account/stp_groups` | +| [getStpGroupUsers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5097) | :closed_lock_with_key: | GET | `/account/stp_groups/{stp_id}/users` | +| [addUsersToStpGroup()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5107) | :closed_lock_with_key: | POST | `/account/stp_groups/{stp_id}/users` | +| [deleteUserFromStpGroup()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5123) | :closed_lock_with_key: | DELETE | `/account/stp_groups/{stp_id}/users` | +| [setGTDeduction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5141) | :closed_lock_with_key: | POST | `/account/debit_fee` | +| [getGTDeduction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5152) | :closed_lock_with_key: | GET | `/account/debit_fee` | +| [getAccountMainKeys()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5161) | :closed_lock_with_key: | GET | `/account/main_keys` | +| [getAgencyTransactionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5177) | :closed_lock_with_key: | GET | `/rebate/agency/transaction_history` | +| [getAgencyCommissionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5190) | :closed_lock_with_key: | GET | `/rebate/agency/commission_history` | +| [getPartnerTransactionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5204) | :closed_lock_with_key: | GET | `/rebate/partner/transaction_history` | +| [getPartnerCommissionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5219) | :closed_lock_with_key: | GET | `/rebate/partner/commission_history` | +| [getPartnerSubordinateList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5242) | :closed_lock_with_key: | GET | `/rebate/partner/sub_list` | +| [getPartnerAgentDataAggregated()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5252) | :closed_lock_with_key: | GET | `/rebate/partner/data/aggregated` | +| [getBrokerCommissionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5265) | :closed_lock_with_key: | GET | `/rebate/broker/commission_history` | +| [getBrokerTransactionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5278) | :closed_lock_with_key: | GET | `/rebate/broker/transaction_history` | +| [getUserRebateInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5287) | :closed_lock_with_key: | GET | `/rebate/user/info` | +| [createOTCQuote()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5322) | :closed_lock_with_key: | POST | `/otc/quote` | +| [createOTCFiatOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5334) | :closed_lock_with_key: | POST | `/otc/order/create` | +| [createOTCStablecoinOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5348) | :closed_lock_with_key: | POST | `/otc/stable_coin/order/create` | +| [getOTCBankList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5357) | :closed_lock_with_key: | GET | `/otc/bank/list` | +| [getOTCBankListLegacy()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5364) | :closed_lock_with_key: | GET | `/otc/bank_list` | +| [createOTCBank()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5371) | :closed_lock_with_key: | POST | `/otc/bank/delete` | +| [deleteOTCBank()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5382) | :closed_lock_with_key: | POST | `/otc/bank/delete` | +| [setDefaultOTCBank()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5389) | :closed_lock_with_key: | POST | `/otc/bank/set_default` | +| [getOTCBankSupplementChecklist()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5396) | :closed_lock_with_key: | GET | `/otc/bank/bank_supplement_checklist` | +| [submitOTCBankPersonalSupplement()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5405) | :closed_lock_with_key: | POST | `/otc/order/paid` | +| [submitOTCBankEnterpriseSupplement()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5424) | :closed_lock_with_key: | POST | `/otc/order/paid` | +| [markOTCOrderAsPaid()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5460) | :closed_lock_with_key: | POST | `/otc/order/paid` | +| [cancelOTCOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5474) | :closed_lock_with_key: | POST | `/otc/order/cancel` | +| [getOTCFiatOrderList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5486) | :closed_lock_with_key: | GET | `/otc/order/list` | +| [getOTCStablecoinOrderList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5500) | :closed_lock_with_key: | GET | `/otc/stable_coin/order/list` | +| [getOTCFiatOrderDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5514) | :closed_lock_with_key: | GET | `/otc/order/detail` | +| [getP2PMerchantUserInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5528) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_user_info` | +| [getP2PMerchantCounterpartyUserInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5537) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_counterparty_user_info` | +| [getP2PMerchantMyselfPayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5549) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_myself_payment` | +| [getP2PMerchantSpotBalance()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5562) | :closed_lock_with_key: | POST | `/p2p/merchant/account/set_merchant_work_hours` | +| [setP2PMerchantWorkHours()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5571) | :closed_lock_with_key: | POST | `/p2p/merchant/account/set_merchant_work_hours` | +| [getP2PMerchantPendingTransactionList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5582) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_pending_transaction_list` | +| [getP2PMerchantCompletedTransactionList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5594) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_completed_transaction_list` | +| [getP2PMerchantTransactionDetails()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5606) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_transaction_details` | +| [confirmP2PMerchantPayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5618) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/confirm-payment` | +| [confirmP2PMerchantReceipt()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5629) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/confirm-receipt` | +| [cancelP2PMerchantTransaction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5640) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/cancel` | +| [placeP2PMerchantBizPushOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5651) | :closed_lock_with_key: | POST | `/p2p/merchant/books/place_biz_push_order` | +| [updateP2PMerchantAdsStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5662) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_update_status` | +| [getP2PMerchantAdsDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5675) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_detail` | +| [getP2PMerchantMyAdsList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5684) | :closed_lock_with_key: | POST | `/p2p/merchant/books/my_ads_list` | +| [getP2PMerchantAdsList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5695) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_list` | +| [getP2PMerchantChatsList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5704) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/get_chats_list` | +| [sendP2PMerchantChatMessage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5715) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/send_chat_message` | +| [uploadP2PMerchantChatFile()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5726) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/upload_chat_file` | +| [getCrossExSymbols()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5747) | | GET | `/crossex/rule/symbols` | +| [getCrossExRiskLimits()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5759) | | GET | `/crossex/rule/risk_limits` | +| [getCrossExTransferCoins()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5773) | | GET | `/crossex/transfers/coin` | +| [createCrossExTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5787) | :closed_lock_with_key: | POST | `/crossex/transfers` | +| [getCrossExTransferHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5801) | :closed_lock_with_key: | GET | `/crossex/transfers` | +| [createCrossExOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5815) | :closed_lock_with_key: | POST | `/crossex/orders` | +| [cancelBatchCrossExOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5829) | :closed_lock_with_key: | POST | `/crossex/batch_cancel_orders` | +| [cancelCrossExOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5843) | :closed_lock_with_key: | DELETE | `/crossex/orders/{order_id}` | +| [modifyCrossExOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5856) | :closed_lock_with_key: | PUT | `/crossex/orders/{order_id}` | +| [getCrossExOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5871) | :closed_lock_with_key: | GET | `/crossex/orders/{order_id}` | +| [createCrossExConvertQuote()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5883) | :closed_lock_with_key: | POST | `/crossex/convert/quote` | +| [createCrossExConvertOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5897) | :closed_lock_with_key: | POST | `/crossex/convert/orders` | +| [updateCrossExAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5911) | :closed_lock_with_key: | PUT | `/crossex/accounts` | +| [getCrossExAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5925) | :closed_lock_with_key: | GET | `/crossex/accounts` | +| [setCrossExPositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5937) | :closed_lock_with_key: | POST | `/crossex/positions/leverage` | +| [getCrossExPositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5951) | :closed_lock_with_key: | GET | `/crossex/positions/leverage` | +| [setCrossExMarginPositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5965) | :closed_lock_with_key: | POST | `/crossex/margin_positions/leverage` | +| [getCrossExMarginPositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5981) | :closed_lock_with_key: | GET | `/crossex/margin_positions/leverage` | +| [closeCrossExPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5995) | :closed_lock_with_key: | POST | `/crossex/position` | +| [getCrossExInterestRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6009) | :closed_lock_with_key: | GET | `/crossex/interest_rate` | +| [getCrossExFeeRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6022) | :closed_lock_with_key: | GET | `/crossex/fee` | +| [getCrossExPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6034) | :closed_lock_with_key: | GET | `/crossex/positions` | +| [getCrossExMarginPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6048) | :closed_lock_with_key: | GET | `/crossex/margin_positions` | +| [getCrossExAdlRank()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6062) | :closed_lock_with_key: | GET | `/crossex/adl_rank` | +| [getCrossExOpenOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6074) | :closed_lock_with_key: | GET | `/crossex/open_orders` | +| [getCrossExHistoryOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6088) | :closed_lock_with_key: | GET | `/crossex/history_orders` | +| [getCrossExHistoryPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6102) | :closed_lock_with_key: | GET | `/crossex/history_positions` | +| [getCrossExHistoryMarginPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6116) | :closed_lock_with_key: | GET | `/crossex/history_margin_positions` | +| [getCrossExHistoryMarginInterests()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6130) | :closed_lock_with_key: | GET | `/crossex/history_margin_interests` | +| [getCrossExHistoryTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6144) | :closed_lock_with_key: | GET | `/crossex/history_trades` | +| [getCrossExAccountBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6158) | :closed_lock_with_key: | GET | `/crossex/account_book` | +| [getCrossExCoinDiscountRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6172) | :closed_lock_with_key: | GET | `/crossex/coin_discount_rate` | +| [listCrossExMarketTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6186) | | GET | `/crossex/market/tickers` | +| [listCrossExMarketFundingInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6200) | | GET | `/crossex/market/funding_info` | +| [getAlphaAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6218) | :closed_lock_with_key: | GET | `/alpha/accounts` | +| [getAlphaAccountBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6230) | :closed_lock_with_key: | GET | `/alpha/account_book` | +| [createAlphaQuote()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6244) | :closed_lock_with_key: | POST | `/alpha/quote` | +| [createAlphaOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6256) | :closed_lock_with_key: | POST | `/alpha/orders` | +| [getAlphaOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6268) | :closed_lock_with_key: | GET | `/alpha/orders` | +| [getAlphaOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6280) | :closed_lock_with_key: | GET | `/alpha/order` | +| [getAlphaCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6292) | | GET | `/alpha/currencies` | +| [getAlphaTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6304) | | GET | `/alpha/tickers` | +| [getTradFiMT5Account()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6310) | :closed_lock_with_key: | GET | `/tradfi/users/mt5-account` | +| [getTradFiSymbolCategories()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6314) | | GET | `/tradfi/symbols/categories` | +| [getTradFiSymbols()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6320) | | GET | `/tradfi/symbols` | +| [getTradFiSymbolCommissions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6332) | | GET | `/tradfi/symbols/commissions` | +| [getTradFiSymbolDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6338) | :closed_lock_with_key: | GET | `/tradfi/symbols/detail` | +| [getTradFiKlines()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6344) | | GET | `/tradfi/symbols/{symbol}/klines` | +| [getTradFiTicker()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6351) | | GET | `/tradfi/symbols/{symbol}/tickers` | +| [createTradFiUser()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6355) | :closed_lock_with_key: | POST | `/tradfi/users` | +| [getTradFiAssets()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6359) | :closed_lock_with_key: | GET | `/tradfi/users/assets` | +| [createTradFiTransaction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6363) | :closed_lock_with_key: | POST | `/tradfi/transactions` | +| [getTradFiTransactions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6369) | :closed_lock_with_key: | GET | `/tradfi/transactions` | +| [createTradFiOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6375) | :closed_lock_with_key: | POST | `/tradfi/orders` | +| [getTradFiOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6381) | :closed_lock_with_key: | GET | `/tradfi/orders` | +| [modifyTradFiOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6385) | :closed_lock_with_key: | PUT | `/tradfi/orders/{orderId}` | +| [cancelTradFiOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6392) | :closed_lock_with_key: | DELETE | `/tradfi/orders/{orderId}` | +| [getTradFiOrderHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6396) | :closed_lock_with_key: | GET | `/tradfi/orders/history` | +| [getTradFiPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6402) | :closed_lock_with_key: | GET | `/tradfi/positions` | +| [modifyTradFiPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6408) | :closed_lock_with_key: | PUT | `/tradfi/positions/{positionId}` | +| [closeTradFiPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6417) | :closed_lock_with_key: | POST | `/tradfi/positions/{positionId}/close` | +| [getTradFiPositionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6426) | :closed_lock_with_key: | GET | `/tradfi/positions/history` | +| [getTradFiOrderLog()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6435) | :closed_lock_with_key: | GET | `/tradfi/orders/log/{log_id}` | +| [getStockUserAssets()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6449) | :closed_lock_with_key: | GET | `/stock/users/assets` | +| [getStockSymbols()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6461) | | GET | `/stock/symbols` | +| [getStockSymbolDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6473) | :closed_lock_with_key: | GET | `/stock/symbols/detail` | +| [getStockOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6485) | | GET | `/stock/market/{symbol}/orderbook` | +| [getStockOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6495) | :closed_lock_with_key: | GET | `/stock/orders` | +| [createStockOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6509) | :closed_lock_with_key: | POST | `/stock/orders` | +| [cancelAllStockOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6520) | :closed_lock_with_key: | DELETE | `/stock/orders` | +| [getStockOrderHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6530) | :closed_lock_with_key: | GET | `/stock/orders/history` | +| [updateStockOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6543) | :closed_lock_with_key: | PUT | `/stock/orders/{orderId}` | +| [cancelStockOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6556) | :closed_lock_with_key: | DELETE | `/stock/orders/{orderId}` | +| [getStockPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6568) | :closed_lock_with_key: | GET | `/stock/positions` | +| [closeStockPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6580) | :closed_lock_with_key: | POST | `/stock/positions/close` | +| [getStockTransactions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6592) | :closed_lock_with_key: | GET | `/stock/transactions` | +| [createStockTransaction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6606) | :closed_lock_with_key: | POST | `/stock/transactions` | +| [getStockExchanges()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6617) | | GET | `/stock/exchanges` | +| [getStockFeeRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6628) | | GET | `/stock/fee-rate` | # WebsocketAPIClient.ts @@ -502,18 +502,18 @@ This client provides WebSocket API endpoints which allow for faster interactions | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [submitNewSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L97) | :closed_lock_with_key: | WS | `spot.order_place` | -| [cancelSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L111) | :closed_lock_with_key: | WS | `spot.order_cancel` | -| [cancelSpotOrderById()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L125) | :closed_lock_with_key: | WS | `spot.order_cancel_ids` | -| [cancelSpotOrderForSymbol()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L139) | :closed_lock_with_key: | WS | `spot.order_cancel_cp` | -| [updateSpotOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L153) | :closed_lock_with_key: | WS | `spot.order_amend` | -| [getSpotOrderStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L167) | :closed_lock_with_key: | WS | `spot.order_status` | -| [getSpotOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L181) | :closed_lock_with_key: | WS | `spot.order_list` | -| [submitNewFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L203) | :closed_lock_with_key: | WS | `futures.order_place` | -| [submitNewFuturesBatchOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L219) | :closed_lock_with_key: | WS | `futures.order_batch_place` | -| [cancelFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L235) | :closed_lock_with_key: | WS | `futures.order_cancel` | -| [cancelFuturesOrderById()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L251) | :closed_lock_with_key: | WS | `futures.order_cancel_ids` | -| [cancelFuturesAllOpenOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L267) | :closed_lock_with_key: | WS | `futures.order_cancel_cp` | -| [updateFuturesOrder()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L283) | :closed_lock_with_key: | WS | `futures.order_amend` | -| [getFuturesOrders()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L299) | :closed_lock_with_key: | WS | `futures.order_list` | -| [getFuturesOrderStatus()](https://github.com/tiagosiebler/gateio-api/blob/master/src/WebsocketAPIClient.ts#L315) | :closed_lock_with_key: | WS | `futures.order_status` | \ No newline at end of file +| [submitNewSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L97) | :closed_lock_with_key: | WS | `spot.order_place` | +| [cancelSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L111) | :closed_lock_with_key: | WS | `spot.order_cancel` | +| [cancelSpotOrderById()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L125) | :closed_lock_with_key: | WS | `spot.order_cancel_ids` | +| [cancelSpotOrderForSymbol()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L139) | :closed_lock_with_key: | WS | `spot.order_cancel_cp` | +| [updateSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L153) | :closed_lock_with_key: | WS | `spot.order_amend` | +| [getSpotOrderStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L167) | :closed_lock_with_key: | WS | `spot.order_status` | +| [getSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L181) | :closed_lock_with_key: | WS | `spot.order_list` | +| [submitNewFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L203) | :closed_lock_with_key: | WS | `futures.order_place` | +| [submitNewFuturesBatchOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L219) | :closed_lock_with_key: | WS | `futures.order_batch_place` | +| [cancelFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L235) | :closed_lock_with_key: | WS | `futures.order_cancel` | +| [cancelFuturesOrderById()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L251) | :closed_lock_with_key: | WS | `futures.order_cancel_ids` | +| [cancelFuturesAllOpenOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L267) | :closed_lock_with_key: | WS | `futures.order_cancel_cp` | +| [updateFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L283) | :closed_lock_with_key: | WS | `futures.order_amend` | +| [getFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L299) | :closed_lock_with_key: | WS | `futures.order_list` | +| [getFuturesOrderStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L315) | :closed_lock_with_key: | WS | `futures.order_status` | \ No newline at end of file diff --git a/llms.txt b/llms.txt index 52bb67f..8b62f39 100644 --- a/llms.txt +++ b/llms.txt @@ -162,7 +162,6 @@ webpack/ .gitignore .nvmrc .prettierrc -check-july2026-gaps.ts jest.config.ts LICENSE.md package.json @@ -1005,93 +1004,6 @@ export interface GetMultiLoanAdjustmentRecordsReq { collateral_currency?: string; } -================ -File: src/types/request/stock.ts -================ -/** Stock / TradFi Spot API request types */ -⋮---- -export interface GetStockUserAssetsReq { - pnl_calc_type?: number; - pnl_calc_price?: number; -} -⋮---- -export interface GetStockSymbolsReq { - symbols?: string; - exchange?: string; - with_desc_i18n?: boolean; - page?: number; - page_size?: number; -} -⋮---- -export interface GetStockSymbolDetailReq { - symbols?: string; - exchange?: string; - page?: number; - page_size?: number; -} -⋮---- -export interface GetStockOrdersReq { - symbol?: string; -} -⋮---- -export interface CreateStockOrderReq { - volume: string; - symbol: string; - side: 1 | 2; - price_type: 'market' | 'limit'; - /** Limit: all only; market: regular only */ - trading_session: 'all' | 'regular'; - time_in_force: 'day'; - price?: string; - client_order_id?: string; -} -⋮---- -/** Limit: all only; market: regular only */ -⋮---- -export interface GetStockOrderHistoryReq { - symbol?: string; - order_ids?: string; - begin_time?: number; - end_time?: number; - side?: 1 | 2; - page?: number; - page_size?: number; -} -⋮---- -export interface UpdateStockOrderReq { - volume: string; - price: string; -} -⋮---- -export interface GetStockPositionsReq { - pnl_calc_type?: number; - pnl_calc_price?: number; - symbol?: string; - exchange?: string; -} -⋮---- -export interface CloseStockPositionReq { - symbol: string; - close_type: 1 | 2; - close_volume?: string; -} -⋮---- -export interface GetStockTransactionsReq { - begin_time?: number; - end_time?: number; - ref_id?: string; - type?: string; - page?: number; - page_size?: number; -} -⋮---- -export interface CreateStockTransactionReq { - asset: string; - change: string; - type: 'deposit' | 'withdraw'; - ref_id: string; -} - ================ File: src/types/request/subaccount.ts ================ @@ -1305,324 +1217,101 @@ export interface SubmitFlashSwapOrderPreviewResp { } ================ -File: src/types/response/stock.ts +File: src/types/response/subaccount.ts ================ -/** Stock / TradFi Spot API response types */ -⋮---- -export interface StockApiResp { - timestamp?: number; - data?: T; - code?: number; - message?: string; - label?: string; +export interface SubAccount { + remark?: string; + login_name: string; + password?: string; + email?: string; + state: number; + type: number; + user_id: number; + create_time: number; } ⋮---- -export interface StockListData { - list?: T[]; - total?: number; - total_page?: number; +export interface CreatedSubAccountAPIKey { + user_id: string; + mode?: number; + name?: string; + perms?: { + name?: + | 'wallet' + | 'spot' + | 'futures' + | 'delivery' + | 'earn' + | 'options' + | 'account' + | 'unified' + | 'loan'; + read_only?: boolean; + }[]; + ip_whitelist?: string[]; + key: string; + state: number; + created_at: number; + updated_at: number; + last_access: number; } ⋮---- -export interface StockUserAssets { - equity?: string; - balance?: string; - available?: string; - position_market_value?: string; - position_pnl?: string; - today_pnl?: string; - user_exists?: boolean; +export interface SubAccountAPIKey { + user_id?: string; + mode?: number; + name?: string; + perms?: { + name?: + | 'wallet' + | 'spot' + | 'futures' + | 'delivery' + | 'earn' + | 'options' + | 'account' + | 'unified' + | 'loan'; + read_only?: boolean; + }[]; + ip_whitelist?: string[]; + key?: string; + state?: number; + created_at?: number; + updated_at?: number; + last_access?: number; } ⋮---- -export interface StockSymbolDescI18n { - lang?: string; - value?: string; +export interface SubAccountMode { + user_id: number; + is_unified: boolean; + mode: 'classic' | 'multi_currency' | 'portfolio'; } -⋮---- -export interface StockSymbolItem { - symbol?: string; - exchange?: string; - exchange_desc?: string; - quote_currency?: string; - quote_currency_precision?: number; - fx_rate?: string; - symbol_desc?: string; - category?: string; - trade_status?: string; - trade_mode?: number; - order_fill_timing?: number; - icon_link?: string; - quote_currency_symbol?: string; - price_precision?: number; - volume_precision?: number; - is_ipo?: boolean; - ipo_price?: string; - sell_price_protection?: string; - buy_price_protection?: string; - symbol_descs?: StockSymbolDescI18n[]; - timestamp?: number; + +================ +File: src/types/websockets/events.ts +================ +export interface WsDataEvent { + data: TData; + table: string; + wsKey: TWSKey; } + +================ +File: src/types/websockets/requests.ts +================ +import { CHANNEL_ID } from '../../lib/requestUtils.js'; +import { WSAPITopic } from './wsAPI.js'; ⋮---- -export interface StockSymbolDetailItem { - symbol?: string; - exchange?: string; - exchange_desc?: string; - quote_currency?: string; - quote_currency_precision?: number; - fx_rate?: string; - symbol_desc?: string; - category?: string; - settlement_currency?: string; - max_order_volume?: string; - step_order_volume?: string; - min_order_volume?: string; - price_precision?: number; - volume_precision?: number; - is_ipo?: boolean; - ipo_price?: string; - price_protection?: string; - sell_price_protection?: string; - buy_price_protection?: string; - slippage_rate?: string; - commission_rate?: string; - trade_status?: string; - trade_mode?: number; - order_fill_timing?: number; - symbol_descs?: StockSymbolDescI18n[]; - [key: string]: unknown; -} +export type WsOperation = 'subscribe' | 'unsubscribe' | 'auth'; ⋮---- -export interface StockOrderBookLevel { - p?: string; - user_order?: boolean; - [key: string]: unknown; +export interface WsRequestAuthGate { + method: 'api_key'; + KEY: string; + SIGN: string; } ⋮---- -export interface StockOrderBook { - symbol?: string; - bids?: StockOrderBookLevel[]; - asks?: StockOrderBookLevel[]; - timestamp?: number; -} -⋮---- -export interface StockOrderItem { - order_id?: string; - symbol?: string; - exchange?: string; - quote_currency?: string; - fx_rate?: string; - symbol_desc?: string; - trade_status?: string; - trade_mode?: number; - price_type?: string; - side?: number; - status?: number; - volume?: string; - fill_volume?: string; - price?: string; - time_setup?: number; - time_update?: number; - max_order_volume?: string; - step_order_volume?: string; - min_order_volume?: string; - price_precision?: number; - price_protection?: string; - sell_price_protection?: string; - buy_price_protection?: string; - commission_rate?: string; - slippage_rate?: string; - [key: string]: unknown; -} -⋮---- -export interface StockCreateOrderResult { - id?: string; -} -⋮---- -export interface StockOrderHistoryItem { - order_id?: string; - symbol?: string; - exchange?: string; - quote_currency?: string; - fx_rate?: string; - symbol_desc?: string; - price_type?: string; - status?: number; - status_desc?: string; - status_detail?: { title?: string; message?: string } | null; - finish_as?: number; - side?: number; - time_in_force?: string; - volume?: string; - fill_volume?: string; - price?: string; - avg_fill_price?: string | null; - commission?: string; - time_setup?: number; - time_done?: number; - [key: string]: unknown; -} -⋮---- -export interface StockUpdateOrderResult { - order_id?: number; -} -⋮---- -export interface StockPositionItem { - symbol?: string; - exchange?: string; - quote_currency?: string; - quote_currency_precision?: number; - fx_rate?: string; - trade_status?: string; - symbol_desc?: string; - position_pnl?: string; - today_pnl?: string; - pnl_rate?: string; - today_sell_amount?: string; - today_buy_amount?: string; - today_sell_volume?: string; - today_buy_volume?: string; - yesterday_volume?: string; - volume?: string; - available?: string; - transfer_out_pending_qty?: string; - avg_cost_price?: string; - diluted_cost_price?: string; - last_price?: string; - extended_last_price?: string | null; - max_order_volume?: string; - step_order_volume?: string; - min_order_volume?: string; - price_precision?: number; - price_protection?: string; - [key: string]: unknown; -} -⋮---- -export interface StockClosePositionResult { - order_id?: number; -} -⋮---- -export interface StockTransactionItem { - asset?: string; - symbol?: string; - symbol_display?: string; - type?: string; - type_desc?: string; - change?: string; - balance?: string; - ref_id?: string; - time?: number; - unit_text?: string; - detail?: object; -} -⋮---- -export interface StockExchangeItem { - exchange?: string; - exchange_desc?: string; - icon_link?: string; - support_transfer?: boolean; -} -⋮---- -export interface StockFeeRateItem { - vip_level?: number; - maker_fee?: string; - taker_fee?: string; -} - -================ -File: src/types/response/subaccount.ts -================ -export interface SubAccount { - remark?: string; - login_name: string; - password?: string; - email?: string; - state: number; - type: number; - user_id: number; - create_time: number; -} -⋮---- -export interface CreatedSubAccountAPIKey { - user_id: string; - mode?: number; - name?: string; - perms?: { - name?: - | 'wallet' - | 'spot' - | 'futures' - | 'delivery' - | 'earn' - | 'options' - | 'account' - | 'unified' - | 'loan'; - read_only?: boolean; - }[]; - ip_whitelist?: string[]; - key: string; - state: number; - created_at: number; - updated_at: number; - last_access: number; -} -⋮---- -export interface SubAccountAPIKey { - user_id?: string; - mode?: number; - name?: string; - perms?: { - name?: - | 'wallet' - | 'spot' - | 'futures' - | 'delivery' - | 'earn' - | 'options' - | 'account' - | 'unified' - | 'loan'; - read_only?: boolean; - }[]; - ip_whitelist?: string[]; - key?: string; - state?: number; - created_at?: number; - updated_at?: number; - last_access?: number; -} -⋮---- -export interface SubAccountMode { - user_id: number; - is_unified: boolean; - mode: 'classic' | 'multi_currency' | 'portfolio'; -} - -================ -File: src/types/websockets/events.ts -================ -export interface WsDataEvent { - data: TData; - table: string; - wsKey: TWSKey; -} - -================ -File: src/types/websockets/requests.ts -================ -import { CHANNEL_ID } from '../../lib/requestUtils.js'; -import { WSAPITopic } from './wsAPI.js'; -⋮---- -export type WsOperation = 'subscribe' | 'unsubscribe' | 'auth'; -⋮---- -export interface WsRequestAuthGate { - method: 'api_key'; - KEY: string; - SIGN: string; -} -⋮---- -export interface WsRequestPing { - time: number; - channel: 'spot.ping' | 'futures.ping' | 'options.ping' | 'announcement.ping'; +export interface WsRequestPing { + time: number; + channel: 'spot.ping' | 'futures.ping' | 'options.ping' | 'announcement.ping'; } ⋮---- export interface WsRequestOperationGate< @@ -2358,15 +2047,6 @@ File: .prettierrc "trailingComma": "all" } -================ -File: check-july2026-gaps.ts -================ -/** - * ponytail: assert new July/Aug 2026 endpoints exist on RestClient. - * Run after build: node --input-type=module check-july2026-gaps.ts - */ -import { RestClient } from './dist/mjs/RestClient.js'; - ================ File: jest.config.ts ================ @@ -4474,34 +4154,121 @@ export interface GetPartnerAgentDataAggregatedReq { */ ================ -File: src/types/response/account.ts +File: src/types/request/stock.ts ================ -/**========================================================================================================================== - * ACCOUNT - * ========================================================================================================================== - */ +/** Stock / TradFi Spot API request types */ ⋮---- -export interface AccountDetail { - user_id: number; - ip_whitelist: string[]; - currency_pairs: string[]; - key: { - mode: number; - }; - tier: number; - copy_trading_role: number; +export interface GetStockUserAssetsReq { + pnl_calc_type?: number; + pnl_calc_price?: number; } ⋮---- -export interface AccountRateLimit { - type: string; - tier: string; - ratio: string; - main_ratio: string; - updated_at: string; +export interface GetStockSymbolsReq { + symbols?: string; + exchange?: string; + with_desc_i18n?: boolean; + page?: number; + page_size?: number; } ⋮---- -export interface StpGroup { - id: number; +export interface GetStockSymbolDetailReq { + symbols?: string; + exchange?: string; + page?: number; + page_size?: number; +} +⋮---- +export interface GetStockOrdersReq { + symbol?: string; +} +⋮---- +export interface CreateStockOrderReq { + volume: string; + symbol: string; + side: 1 | 2; + price_type: 'market' | 'limit'; + /** Limit: all only; market: regular only */ + trading_session: 'all' | 'regular'; + time_in_force: 'day'; + price?: string; + client_order_id?: string; +} +⋮---- +/** Limit: all only; market: regular only */ +⋮---- +export interface GetStockOrderHistoryReq { + symbol?: string; + order_ids?: string; + begin_time?: number; + end_time?: number; + side?: 1 | 2; + page?: number; + page_size?: number; +} +⋮---- +export interface UpdateStockOrderReq { + volume: string; + price: string; +} +⋮---- +export interface GetStockPositionsReq { + pnl_calc_type?: number; + pnl_calc_price?: number; + symbol?: string; + exchange?: string; +} +⋮---- +export interface CloseStockPositionReq { + symbol: string; + close_type: 1 | 2; + close_volume?: string; +} +⋮---- +export interface GetStockTransactionsReq { + begin_time?: number; + end_time?: number; + ref_id?: string; + type?: string; + page?: number; + page_size?: number; +} +⋮---- +export interface CreateStockTransactionReq { + asset: string; + change: string; + type: 'deposit' | 'withdraw'; + ref_id: string; +} + +================ +File: src/types/response/account.ts +================ +/**========================================================================================================================== + * ACCOUNT + * ========================================================================================================================== + */ +⋮---- +export interface AccountDetail { + user_id: number; + ip_whitelist: string[]; + currency_pairs: string[]; + key: { + mode: number; + }; + tier: number; + copy_trading_role: number; +} +⋮---- +export interface AccountRateLimit { + type: string; + tier: string; + ratio: string; + main_ratio: string; + updated_at: string; +} +⋮---- +export interface StpGroup { + id: number; name: string; creator_id: number; create_time: number; @@ -5725,229 +5492,452 @@ export interface PartnerDataAggregatedResponse { } ================ -File: src/types/shared.ts +File: src/types/response/stock.ts ================ -export type GateBaseUrlKey = - | 'live' - | 'futuresLiveAlternative' - | 'futuresTestnet'; -⋮---- -// interfaces +/** Stock / TradFi Spot API response types */ ⋮---- -export interface FromToPageLimit { - from: number; - to: number; - page: number; - limit: number; +export interface StockApiResp { + timestamp?: number; + data?: T; + code?: number; + message?: string; + label?: string; } ⋮---- -// Used for spot and flash swap -export interface CurrencyPair { - id?: string; - base?: string; - base_name?: string; - quote?: string; - quote_name?: string; - fee?: string; - min_base_amount?: string; - min_quote_amount?: string; - max_base_amount?: string; - max_quote_amount?: string; - amount_precision?: number; - precision?: number; - trade_status?: 'untradable' | 'buyable' | 'sellable' | 'tradable'; - sell_start?: number; - buy_start?: number; - type: string; - delisting_time?: number; - trade_url?: string; - up_rate?: string; // v4.106.4: Maximum price increase percentage - down_rate?: string; // v4.106.4: Maximum price decrease percentage +export interface StockListData { + list?: T[]; + total?: number; + total_page?: number; } ⋮---- -up_rate?: string; // v4.106.4: Maximum price increase percentage -down_rate?: string; // v4.106.4: Maximum price decrease percentage - -================ -File: src/WebsocketAPIClient.ts -================ -import { DefaultLogger } from './lib/logger.js'; -import { WS_KEY_MAP } from './lib/websocket/websocket-util.js'; -import { WSClientConfigurableOptions } from './types/websockets/client.js'; -import { - WSAPIFuturesOrder, - WSAPIFuturesOrderAmendReq, - WSAPIFuturesOrderBatchPlaceRespItem, - WSAPIFuturesOrderCancelCPReq, - WSAPIFuturesOrderCancelIdsRespItem, - WSAPIFuturesOrderCancelReq, - WSAPIFuturesOrderListReq, - WSAPIFuturesOrderPlaceReq, - WSAPIFuturesOrderStatusReq, - WSAPIResponse, - WSAPISpotOrder, - WSAPISpotOrderAmendReq, - WSAPISpotOrderCancelCPReq, - WSAPISpotOrderCancelIdsReq, - WSAPISpotOrderCancelIdsRespItem, - WSAPISpotOrderCancelReq, - WSAPISpotOrderListReq, - WSAPISpotOrderPlaceReq, - WSAPISpotOrderStatusReq, - WSAPIWsKey, -} from './types/websockets/wsAPI.js'; -import { WebsocketClient } from './WebsocketClient.js'; -⋮---- -/** - * Configurable options specific to only the REST-like WebsocketAPIClient - */ -export interface WSAPIClientConfigurableOptions { - /** - * Default: true - * - * Attach default event listeners, which will console log any high level - * events (opened/reconnecting/reconnected/etc). - * - * If you disable this, you should set your own event listeners - * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. - */ - attachEventListeners: boolean; +export interface StockUserAssets { + equity?: string; + balance?: string; + available?: string; + position_market_value?: string; + position_pnl?: string; + today_pnl?: string; + user_exists?: boolean; } ⋮---- -/** - * Default: true - * - * Attach default event listeners, which will console log any high level - * events (opened/reconnecting/reconnected/etc). - * - * If you disable this, you should set your own event listeners - * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. - */ +export interface StockSymbolDescI18n { + lang?: string; + value?: string; +} ⋮---- -/** - * This is a minimal Websocket API wrapper around the WebsocketClient. - * - * Some methods support passing in a custom "wsKey". This is a reference to which WS connection should - * be used to transmit that message. This is only useful if you wish to use an alternative wss - * domain that is supported by the SDK. - * - * Note: To use testnet, don't set the wsKey - use `testnet: true` in - * the constructor instead. - * - * 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/gateio-api/blob/master/examples/ws-private-spot-wsapi.ts#L119 - */ -export class WebsocketAPIClient +export interface StockSymbolItem { + symbol?: string; + exchange?: string; + exchange_desc?: string; + quote_currency?: string; + quote_currency_precision?: number; + fx_rate?: string; + symbol_desc?: string; + category?: string; + trade_status?: string; + trade_mode?: number; + order_fill_timing?: number; + icon_link?: string; + quote_currency_symbol?: string; + price_precision?: number; + volume_precision?: number; + is_ipo?: boolean; + ipo_price?: string; + sell_price_protection?: string; + buy_price_protection?: string; + symbol_descs?: StockSymbolDescI18n[]; + timestamp?: number; +} ⋮---- -constructor( - options?: WSClientConfigurableOptions & - Partial, - logger?: DefaultLogger, -) +export interface StockSymbolDetailItem { + symbol?: string; + exchange?: string; + exchange_desc?: string; + quote_currency?: string; + quote_currency_precision?: number; + fx_rate?: string; + symbol_desc?: string; + category?: string; + settlement_currency?: string; + max_order_volume?: string; + step_order_volume?: string; + min_order_volume?: string; + price_precision?: number; + volume_precision?: number; + is_ipo?: boolean; + ipo_price?: string; + price_protection?: string; + sell_price_protection?: string; + buy_price_protection?: string; + slippage_rate?: string; + commission_rate?: string; + trade_status?: string; + trade_mode?: number; + order_fill_timing?: number; + symbol_descs?: StockSymbolDescI18n[]; + [key: string]: unknown; +} ⋮---- -public getWSClient(): WebsocketClient +export interface StockOrderBookLevel { + p?: string; + user_order?: boolean; + [key: string]: unknown; +} ⋮---- -public setTimeOffsetMs(newOffset: number): void +export interface StockOrderBook { + symbol?: string; + bids?: StockOrderBookLevel[]; + asks?: StockOrderBookLevel[]; + timestamp?: number; +} ⋮---- -/* - * - * SPOT - Trading requests - * - */ +export interface StockOrderItem { + order_id?: string; + symbol?: string; + exchange?: string; + quote_currency?: string; + fx_rate?: string; + symbol_desc?: string; + trade_status?: string; + trade_mode?: number; + price_type?: string; + side?: number; + status?: number; + volume?: string; + fill_volume?: string; + price?: string; + time_setup?: number; + time_update?: number; + max_order_volume?: string; + step_order_volume?: string; + min_order_volume?: string; + price_precision?: number; + price_protection?: string; + sell_price_protection?: string; + buy_price_protection?: string; + commission_rate?: string; + slippage_rate?: string; + [key: string]: unknown; +} ⋮---- -/** - * Submit a spot order - */ -submitNewSpotOrder( - params: WSAPISpotOrderPlaceReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface StockCreateOrderResult { + id?: string; +} ⋮---- -/** - * Cancel a spot order - */ -cancelSpotOrder( - params: WSAPISpotOrderCancelReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface StockOrderHistoryItem { + order_id?: string; + symbol?: string; + exchange?: string; + quote_currency?: string; + fx_rate?: string; + symbol_desc?: string; + price_type?: string; + status?: number; + status_desc?: string; + status_detail?: { title?: string; message?: string } | null; + finish_as?: number; + side?: number; + time_in_force?: string; + volume?: string; + fill_volume?: string; + price?: string; + avg_fill_price?: string | null; + commission?: string; + time_setup?: number; + time_done?: number; + [key: string]: unknown; +} ⋮---- -/** - * Cancel all spot orders with the given id list - */ -cancelSpotOrderById( - params: WSAPISpotOrderCancelIdsReq[], - wsKey?: WSAPIWsKey, -): Promise> +export interface StockUpdateOrderResult { + order_id?: number; +} ⋮---- -/** - * Cancel a spot order for a given symbol - */ -cancelSpotOrderForSymbol( - params: WSAPISpotOrderCancelCPReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface StockPositionItem { + symbol?: string; + exchange?: string; + quote_currency?: string; + quote_currency_precision?: number; + fx_rate?: string; + trade_status?: string; + symbol_desc?: string; + position_pnl?: string; + today_pnl?: string; + pnl_rate?: string; + today_sell_amount?: string; + today_buy_amount?: string; + today_sell_volume?: string; + today_buy_volume?: string; + yesterday_volume?: string; + volume?: string; + available?: string; + transfer_out_pending_qty?: string; + avg_cost_price?: string; + diluted_cost_price?: string; + last_price?: string; + extended_last_price?: string | null; + max_order_volume?: string; + step_order_volume?: string; + min_order_volume?: string; + price_precision?: number; + price_protection?: string; + [key: string]: unknown; +} ⋮---- -/** - * Update a spot order - */ -updateSpotOrder( - params: WSAPISpotOrderAmendReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface StockClosePositionResult { + order_id?: number; +} ⋮---- -/** - * Get the status of a spot order - */ -getSpotOrderStatus( - params: WSAPISpotOrderStatusReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface StockTransactionItem { + asset?: string; + symbol?: string; + symbol_display?: string; + type?: string; + type_desc?: string; + change?: string; + balance?: string; + ref_id?: string; + time?: number; + unit_text?: string; + detail?: object; +} ⋮---- -/** - * Get all spot orders - */ -getSpotOrders( - params: WSAPISpotOrderListReq, - wsKey?: WSAPIWsKey, -): Promise> +export interface StockExchangeItem { + exchange?: string; + exchange_desc?: string; + icon_link?: string; + support_transfer?: boolean; +} ⋮---- -/* - * - * Futures - Trading requests - * - */ +export interface StockFeeRateItem { + vip_level?: number; + maker_fee?: string; + taker_fee?: string; +} + +================ +File: src/types/shared.ts +================ +export type GateBaseUrlKey = + | 'live' + | 'futuresLiveAlternative' + | 'futuresTestnet'; ⋮---- -/** - * Submit a futures order. - * - * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection - */ -submitNewFuturesOrder( - params: WSAPIFuturesOrderPlaceReq, - wsKey?: WSAPIWsKey, -): Promise> +// interfaces ⋮---- -/** - * Submit a batch of futures orders - * - * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection - */ -submitNewFuturesBatchOrder( - params: WSAPIFuturesOrderPlaceReq[], - wsKey?: WSAPIWsKey, -): Promise> +export interface FromToPageLimit { + from: number; + to: number; + page: number; + limit: number; +} ⋮---- -/** - * Cancel a futures order - * - * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection - */ -cancelFuturesOrder( - params: WSAPIFuturesOrderCancelReq, - wsKey?: WSAPIWsKey, +// Used for spot and flash swap +export interface CurrencyPair { + id?: string; + base?: string; + base_name?: string; + quote?: string; + quote_name?: string; + fee?: string; + min_base_amount?: string; + min_quote_amount?: string; + max_base_amount?: string; + max_quote_amount?: string; + amount_precision?: number; + precision?: number; + trade_status?: 'untradable' | 'buyable' | 'sellable' | 'tradable'; + sell_start?: number; + buy_start?: number; + type: string; + delisting_time?: number; + trade_url?: string; + up_rate?: string; // v4.106.4: Maximum price increase percentage + down_rate?: string; // v4.106.4: Maximum price decrease percentage +} +⋮---- +up_rate?: string; // v4.106.4: Maximum price increase percentage +down_rate?: string; // v4.106.4: Maximum price decrease percentage + +================ +File: src/WebsocketAPIClient.ts +================ +import { DefaultLogger } from './lib/logger.js'; +import { WS_KEY_MAP } from './lib/websocket/websocket-util.js'; +import { WSClientConfigurableOptions } from './types/websockets/client.js'; +import { + WSAPIFuturesOrder, + WSAPIFuturesOrderAmendReq, + WSAPIFuturesOrderBatchPlaceRespItem, + WSAPIFuturesOrderCancelCPReq, + WSAPIFuturesOrderCancelIdsRespItem, + WSAPIFuturesOrderCancelReq, + WSAPIFuturesOrderListReq, + WSAPIFuturesOrderPlaceReq, + WSAPIFuturesOrderStatusReq, + WSAPIResponse, + WSAPISpotOrder, + WSAPISpotOrderAmendReq, + WSAPISpotOrderCancelCPReq, + WSAPISpotOrderCancelIdsReq, + WSAPISpotOrderCancelIdsRespItem, + WSAPISpotOrderCancelReq, + WSAPISpotOrderListReq, + WSAPISpotOrderPlaceReq, + WSAPISpotOrderStatusReq, + WSAPIWsKey, +} from './types/websockets/wsAPI.js'; +import { WebsocketClient } from './WebsocketClient.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; +} +⋮---- +/** + * 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. + * + * Some methods support passing in a custom "wsKey". This is a reference to which WS connection should + * be used to transmit that message. This is only useful if you wish to use an alternative wss + * domain that is supported by the SDK. + * + * Note: To use testnet, don't set the wsKey - use `testnet: true` in + * the constructor instead. + * + * 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/gateio-api/blob/master/examples/ws-private-spot-wsapi.ts#L119 + */ +export class WebsocketAPIClient +⋮---- +constructor( + options?: WSClientConfigurableOptions & + Partial, + logger?: DefaultLogger, +) +⋮---- +public getWSClient(): WebsocketClient +⋮---- +public setTimeOffsetMs(newOffset: number): void +⋮---- +/* + * + * SPOT - Trading requests + * + */ +⋮---- +/** + * Submit a spot order + */ +submitNewSpotOrder( + params: WSAPISpotOrderPlaceReq, + wsKey?: WSAPIWsKey, +): Promise> +⋮---- +/** + * Cancel a spot order + */ +cancelSpotOrder( + params: WSAPISpotOrderCancelReq, + wsKey?: WSAPIWsKey, +): Promise> +⋮---- +/** + * Cancel all spot orders with the given id list + */ +cancelSpotOrderById( + params: WSAPISpotOrderCancelIdsReq[], + wsKey?: WSAPIWsKey, +): Promise> +⋮---- +/** + * Cancel a spot order for a given symbol + */ +cancelSpotOrderForSymbol( + params: WSAPISpotOrderCancelCPReq, + wsKey?: WSAPIWsKey, +): Promise> +⋮---- +/** + * Update a spot order + */ +updateSpotOrder( + params: WSAPISpotOrderAmendReq, + wsKey?: WSAPIWsKey, +): Promise> +⋮---- +/** + * Get the status of a spot order + */ +getSpotOrderStatus( + params: WSAPISpotOrderStatusReq, + wsKey?: WSAPIWsKey, +): Promise> +⋮---- +/** + * Get all spot orders + */ +getSpotOrders( + params: WSAPISpotOrderListReq, + wsKey?: WSAPIWsKey, +): Promise> +⋮---- +/* + * + * Futures - Trading requests + * + */ +⋮---- +/** + * Submit a futures order. + * + * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection + */ +submitNewFuturesOrder( + params: WSAPIFuturesOrderPlaceReq, + wsKey?: WSAPIWsKey, +): Promise> +⋮---- +/** + * Submit a batch of futures orders + * + * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection + */ +submitNewFuturesBatchOrder( + params: WSAPIFuturesOrderPlaceReq[], + wsKey?: WSAPIWsKey, +): Promise> +⋮---- +/** + * Cancel a futures order + * + * Note: without a wsKey, this defaults to the perpFuturesUSDTV4 connection + */ +cancelFuturesOrder( + params: WSAPIFuturesOrderCancelReq, + wsKey?: WSAPIWsKey, ): Promise> ⋮---- /** @@ -8254,229 +8244,894 @@ No. The SDK signs the same requests through the proxy. The Gate account, API hos ### What causes `INVALID_SIGNATURE` or `REQUEST_EXPIRED`? -Common causes are a drifting system clock, the wrong API secret, credentials from another environment, or an API request reaching the wrong host. Verify the clock, credential source, and API host without logging the secret. +Common causes are a drifting system clock, the wrong API secret, credentials from another environment, or an API request reaching the wrong host. Verify the clock, credential source, and API host without logging the secret. + +## Next steps + +- Browse the [Gate SDK examples](https://siebly.io/examples/Gate). +- Find methods in the [complete endpoint map](./endpointFunctionList.md). +- Review the [Gate SDK page](https://siebly.io/sdk/gate/javascript). +- Install or update [`gateio-api` from npm](https://www.npmjs.com/package/gateio-api). +- Browse the [`gateio-api` source repository](https://github.com/tiagosiebler/gateio-api). +- Read the official [Gate REST API documentation](https://www.gate.com/docs/developers/apiv4/en/). +- Read the official [Gate Spot WebSocket documentation](https://www.gate.com/docs/developers/apiv4/ws/). +- Read the official [Gate Futures WebSocket documentation](https://www.gate.com/docs/developers/futures/ws/). +- Review [Exchange State](https://siebly.io/reference/exchange-state) before building private state management. +- Use [Runtime Workflows](https://siebly.io/reference/runtime-workflows) when designing startup, reconnect, and reconciliation behavior. +- Open the [Siebly glossary](https://siebly.io/reference/glossary) for order, stream, and recovery terms. +- Report SDK issues in the [`gateio-api` GitHub repository](https://github.com/tiagosiebler/gateio-api/issues). + +================ +File: examples/Rest/otc/submitOTCBankPersonalSupplement.ts +================ +import { readFileSync } from 'fs'; +⋮---- +import { RestClient } from '../../../src/index.js'; +// import { RestClient } from 'gateio-api'; +⋮---- +async function submitOTCBankPersonalSupplementExample() + +================ +File: src/types/request/alpha.ts +================ +/**========================================================================================================================== + * ALPHA + * ========================================================================================================================== + */ +⋮---- +export interface GetAlphaAccountBookReq { + from: number; // Start timestamp for the query + to?: number; // End timestamp for the query, defaults to current time if not specified + page?: number; // Page number + limit?: number; // Maximum 100 items per page +} +⋮---- +from: number; // Start timestamp for the query +to?: number; // End timestamp for the query, defaults to current time if not specified +page?: number; // Page number +limit?: number; // Maximum 100 items per page +⋮---- +export interface CreateAlphaQuoteReq { + currency: string; // Trading symbol + side: 'buy' | 'sell'; // Buy or sell orders + amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) + gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) + slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom +} +⋮---- +currency: string; // Trading symbol +side: 'buy' | 'sell'; // Buy or sell orders +amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) +gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) +slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom +⋮---- +export interface CreateAlphaOrderReq { + currency: string; // Trading symbol + side: 'buy' | 'sell'; // Buy or sell orders + amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) + gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) + slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom + quote_id: string; // Quote ID returned from quotation API +} +⋮---- +currency: string; // Trading symbol +side: 'buy' | 'sell'; // Buy or sell orders +amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) +gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) +slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom +quote_id: string; // Quote ID returned from quotation API +⋮---- +export interface GetAlphaOrdersReq { + currency?: string; // Trading symbol + side?: 'buy' | 'sell'; // Buy or sell orders + status?: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) + from?: number; // Start time for order query + to?: number; // End time for order query, defaults to current time if not specified + limit?: number; // Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 + page?: number; // Page number +} +⋮---- +currency?: string; // Trading symbol +side?: 'buy' | 'sell'; // Buy or sell orders +status?: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) +from?: number; // Start time for order query +to?: number; // End time for order query, defaults to current time if not specified +limit?: number; // Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 +page?: number; // Page number +⋮---- +export interface GetAlphaOrderReq { + order_id: string; // Order ID +} +⋮---- +order_id: string; // Order ID +⋮---- +export interface GetAlphaCurrenciesReq { + currency?: string; // Query currency information by currency symbol + limit?: number; // Maximum number of records returned in a single list + page?: number; // Page number +} +⋮---- +currency?: string; // Query currency information by currency symbol +limit?: number; // Maximum number of records returned in a single list +page?: number; // Page number +⋮---- +export interface GetAlphaTickersReq { + currency?: string; // Query by specified currency name + limit?: number; // Maximum number of records returned in a single list + page?: number; // Page number +} +⋮---- +currency?: string; // Query by specified currency name +limit?: number; // Maximum number of records returned in a single list +page?: number; // Page number + +================ +File: src/types/request/autoinvest.ts +================ +/**========================================================================================================================== + * EARN AUTO INVEST + * ========================================================================================================================== + */ +⋮---- +export interface AutoInvestPlanPortfolioItemInput { + asset: string; + ratio: string; +} +⋮---- +/** POST /earn/autoinvest/plans/create */ +export interface CreateAutoInvestPlanReq { + plan_name?: string; + plan_des?: string; + plan_money: string; + plan_amount: string; + plan_period_type: + | 'daily' + | 'weekly' + | 'biweekly' + | 'monthly' + | 'hourly' + | '4-hourly'; + plan_period_day: number; + plan_period_hour: number; + items: AutoInvestPlanPortfolioItemInput[]; + /** Fund source: `spot` or `earn`; default spot */ + fund_source?: string; + /** Fund flow: `auto_invest` or `earn`; default auto_invest */ + fund_flow?: string; + /** 0 normal creation, 1 quick investment */ + type?: number; +} +⋮---- +/** Fund source: `spot` or `earn`; default spot */ +⋮---- +/** Fund flow: `auto_invest` or `earn`; default auto_invest */ +⋮---- +/** 0 normal creation, 1 quick investment */ +⋮---- +/** POST /earn/autoinvest/plans/update */ +export interface UpdateAutoInvestPlanReq { + plan_id: number; + fund_source?: string; + fund_flow?: string; +} +⋮---- +/** POST /earn/autoinvest/plans/stop */ +export interface StopAutoInvestPlanReq { + plan_id: number; +} +⋮---- +/** POST /earn/autoinvest/plans/add_position */ +export interface AddAutoInvestPlanPositionReq { + plan_id: number; + amount: string; +} +⋮---- +/** POST /earn/autoinvest/min_invest_amount */ +export interface GetAutoInvestMinAmountReq { + money: string; + items: AutoInvestPlanPortfolioItemInput[]; +} +⋮---- +/** GET /earn/autoinvest/coins */ +export interface GetAutoInvestCoinsReq { + /** Pricing currency: USDT or BTC; default USDT */ + plan_money?: string; +} +⋮---- +/** Pricing currency: USDT or BTC; default USDT */ +⋮---- +/** GET /earn/autoinvest/plans/records */ +export interface GetAutoInvestPlanRecordsReq { + plan_id: number; + page?: number; + page_size?: number; +} +⋮---- +/** GET /earn/autoinvest/orders */ +export interface GetAutoInvestOrdersReq { + plan_id: number; + record_id: number; +} +⋮---- +/** GET /earn/autoinvest/plans/detail */ +export interface GetAutoInvestPlanDetailReq { + plan_id: number; +} +⋮---- +/** GET /earn/autoinvest/plans/list_info */ +export interface GetAutoInvestPlansReq { + /** Plan status: e.g. History (history) or Active (active) */ + status: string; + page?: number; + page_size?: number; +} +⋮---- +/** Plan status: e.g. History (history) or Active (active) */ + +================ +File: src/types/request/p2pMerchant.ts +================ +/** P2P Merchant API request types */ +⋮---- +export interface P2PMerchantGetCounterpartyUserInfoReq { + biz_uid: string; +} +⋮---- +export interface P2PMerchantGetMyselfPaymentReq { + fiat?: string; +} +⋮---- +export interface P2PMerchantGetPendingTransactionListReq { + crypto_currency: string; + fiat_currency: string; + order_tab?: string; + select_type?: string; + status?: string; + txid?: number; + start_time?: number; + end_time?: number; +} +⋮---- +export interface P2PMerchantGetCompletedTransactionListReq { + crypto_currency: string; + fiat_currency: string; + select_type?: string; + status?: string; + txid?: number; + start_time?: number; + end_time?: number; + query_dispute?: number; + page?: number; + per_page?: number; +} +⋮---- +export interface P2PMerchantGetTransactionDetailsReq { + txid: number; + channel?: string; +} +⋮---- +export interface P2PMerchantConfirmPaymentReq { + trade_id: string; + payment_method: string; +} +⋮---- +export interface P2PMerchantConfirmReceiptReq { + trade_id: string; +} +⋮---- +export interface P2PMerchantCancelTransactionReq { + trade_id: string; + reason_id?: string; + reason_memo?: string; +} +⋮---- +export interface P2PMerchantPlaceBizPushOrderReq { + currencyType: string; + exchangeType: string; + type: string; + unitPrice: string; + number: string; + payType: string; + minAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType + maxAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType + pay_type_json?: string; + rateFixed?: string; + oid?: string; + tierLimit?: string; + verifiedLimit?: string; + regTimeLimit?: string; + advertisersLimit?: string; + hide_payment?: string; + expire_min?: string; + trade_tips?: string; + auto_reply?: string; + min_completed_limit?: string; + max_completed_limit?: string; + completed_rate_limit?: string; + user_country_limit?: string; + user_order_limit?: string; + rateReferenceId?: string; + rateOffset?: string; + float_trend?: string; + limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount; defaults to 0 + fiatMinAmount?: string; // v4.106.102: Required when limitBasis is 1 + fiatMaxAmount?: string; // v4.106.102: Required when limitBasis is 1 + polymarket_limit?: string; // v4.106.102: Restrict trading with Polymarket users +} +⋮---- +minAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType +maxAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType +⋮---- +limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount; defaults to 0 +fiatMinAmount?: string; // v4.106.102: Required when limitBasis is 1 +fiatMaxAmount?: string; // v4.106.102: Required when limitBasis is 1 +polymarket_limit?: string; // v4.106.102: Restrict trading with Polymarket users +⋮---- +/** POST /p2p/merchant/account/set_merchant_work_hours — v4.106.96 */ +export interface P2PMerchantSetMerchantWorkHoursReq { + work_status: 0 | 1 | 2; // 0 resting, 1 working, 2 custom working hours + cycle_type?: string; + day_of_week?: string; + time_zone?: string; // UTC offset -12 to +14 + start_time?: string; + end_time?: string; +} +⋮---- +work_status: 0 | 1 | 2; // 0 resting, 1 working, 2 custom working hours +⋮---- +time_zone?: string; // UTC offset -12 to +14 +⋮---- +export interface P2PMerchantAdsUpdateStatusReq { + adv_no: number; + adv_status: 1 | 3 | 4; + /** Optional query param */ + trade_type?: string; +} +⋮---- +/** Optional query param */ +⋮---- +export interface P2PMerchantAdsDetailReq { + adv_no: string; +} +⋮---- +export interface P2PMerchantMyAdsListReq { + asset?: string; + fiat_unit?: string; + trade_type?: string; +} +⋮---- +export interface P2PMerchantGetAdsListReq { + asset: string; + fiat_unit: string; + trade_type: string; +} +⋮---- +export interface P2PMerchantGetChatsListReq { + txid: number; + lastreceived?: number; + firstreceived?: number; +} +⋮---- +export interface P2PMerchantSendChatMessageReq { + txid: number; + message: string; + /** 0=Text, 1=File (video or image). Default 0 */ + type?: 0 | 1; +} +⋮---- +/** 0=Text, 1=File (video or image). Default 0 */ +⋮---- +export interface P2PMerchantUploadChatFileReq { + image_content_type: string; + base64_img: string; +} + +================ +File: src/types/response/p2pMerchant.ts +================ +/** P2P Merchant API response types */ +⋮---- +export interface P2PMerchantApiResp { + timestamp: number; + method: string; + code: number; + message: string; + data: T; + version: string; +} +⋮---- +export interface P2PMerchantUserInfo { + is_self?: boolean; + user_timest?: string; + counterparties_num?: number; + email_verified?: string; + verified?: string; + has_phone?: string; + user_name?: string; + user_note?: string; + complete_transactions?: string; + paid_transactions?: string; + accepted_transactions?: string; + transactions_used_time?: string; + cancelled_used_time_month?: string; + complete_transactions_month?: string; + complete_rate_month?: number; + orders_buy_rate_month?: number; + is_black?: number; + is_follow?: number; + have_traded?: number; + biz_uid?: string; + blue_vip?: number; + work_status?: number; + registration_days?: number; + first_trade_days?: number; + need_replenish?: number; + merchant_info?: { type?: string; market?: string }; + online_status?: number; + work_hours?: Record | null; + transactions_month?: number; + transactions_all?: number; + trade_versatile?: boolean; + [key: string]: unknown; +} +⋮---- +export interface P2PMerchantCounterpartyUserInfo { + user_timest?: string; + email_verified?: string; + verified?: string; + has_phone?: string; + user_name?: string; + user_note?: string; + complete_transactions?: string; + paid_transactions?: string; + accepted_transactions?: string; + transactions_used_time?: string; + cancelled_used_time_month?: string; + complete_transactions_month?: string; + complete_rate_month?: number; + is_follow?: number; + have_traded?: number; + biz_uid?: string; + registration_days?: number; + first_trade_days?: number; + trade_versatile?: boolean; + [key: string]: unknown; +} +⋮---- +export interface P2PMerchantPaymentMethod { + pay_type: string; + pay_name: string; + ids: number[]; + list: Record[]; +} +⋮---- +export interface P2PMerchantTransactionListItem { + type_buy?: number; + timest?: string; + timest_expire?: string; + type?: string; + trade_type?: string; + timestamp?: number; + rate?: string; + amount?: string; + total?: string; + txid?: number; + status?: string; + order_status?: string; + [key: string]: unknown; +} +⋮---- +export interface P2PMerchantTransactionListData { + list: P2PMerchantTransactionListItem[]; + trans_time?: { od_time?: number }[]; + count: number; + exported_num: number; +} +⋮---- +export interface P2PMerchantTransactionDetails { + is_sell?: number; + txid?: number; + orderid?: number; + timest?: number; + last_pay_time?: number; + remain_pay_time?: number; + currencyType?: string; + want_type?: string; + rate?: string; + amount?: string; + total?: string; + status?: string; + state?: string; + its_uid?: string; + its_nickname?: string; + its_realname?: string; + [key: string]: unknown; +} +⋮---- +export interface P2PMerchantAdsDetail { + rate?: string; + type?: string; + amount?: string; + min_amount?: string; + max_amount?: string; + fiat_min_amount?: string; // v4.106.102: Min fiat amount per order + fiat_max_amount?: string; // v4.106.102: Max fiat amount per order + minFiatAmount?: string; // v4.106.102 + maxFiatAmount?: string; // v4.106.102 + limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount + limitBasisText?: string; // v4.106.102 + polymarket_limit?: string; // v4.106.102 + total?: string; + orderid?: number; + timestamp?: number; + currencyType?: string; + want_type?: string; + status?: string; + [key: string]: unknown; +} +⋮---- +fiat_min_amount?: string; // v4.106.102: Min fiat amount per order +fiat_max_amount?: string; // v4.106.102: Max fiat amount per order +minFiatAmount?: string; // v4.106.102 +maxFiatAmount?: string; // v4.106.102 +limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount +limitBasisText?: string; // v4.106.102 +polymarket_limit?: string; // v4.106.102 +⋮---- +export interface P2PMerchantMyAdsListItem { + type?: string; + rate?: string; + amount?: string; + total?: string; + id?: string; + status?: string; + currencyType?: string; + want_type?: string; + fiat_min_amount?: string; // v4.106.102 + fiat_max_amount?: string; // v4.106.102 + limit_basis?: string; // v4.106.103 + limit_basis_text?: string; // v4.106.103 + [key: string]: unknown; +} +⋮---- +fiat_min_amount?: string; // v4.106.102 +fiat_max_amount?: string; // v4.106.102 +limit_basis?: string; // v4.106.103 +limit_basis_text?: string; // v4.106.103 +⋮---- +export interface P2PMerchantMyAdsListData { + lists: P2PMerchantMyAdsListItem[]; +} +⋮---- +export interface P2PMerchantAdsListItem { + index?: number; + asset?: string; + fiat_unit?: string; + adv_no?: number; + price?: string; + max_single_trans_amount?: string; + min_single_trans_amount?: string; + nick_name?: string; + surplus_amount?: string; // v4.106.103: Remaining tradable crypto quantity + trade_methods?: string[]; // v4.106.103: Supported payment methods list + fiat_min_amount?: string; // v4.106.103 + fiat_max_amount?: string; // v4.106.103 + limit_basis?: string; // v4.106.103 + limit_basis_text?: string; // v4.106.103 +} +⋮---- +surplus_amount?: string; // v4.106.103: Remaining tradable crypto quantity +trade_methods?: string[]; // v4.106.103: Supported payment methods list +fiat_min_amount?: string; // v4.106.103 +fiat_max_amount?: string; // v4.106.103 +limit_basis?: string; // v4.106.103 +limit_basis_text?: string; // v4.106.103 +⋮---- +export interface P2PMerchantChatMessage { + is_sell?: number; + msg_type?: number; + msg?: string; + username?: string; + uid?: string; + timest?: number; + type?: number; + pic?: string; + file_key?: string; + file_type?: string; + width?: string; + height?: string; + msg_obj?: Record; + risk_type?: number; // v4.106.96: 1 off-platform traffic diversion risk + toast_msg?: string; // v4.106.96 + [key: string]: unknown; +} +⋮---- +risk_type?: number; // v4.106.96: 1 off-platform traffic diversion risk +toast_msg?: string; // v4.106.96 +⋮---- +/** v4.106.96: Risk control response when place_biz_push_order hits off-platform diversion check */ +export interface P2PMerchantPlaceOrderRiskData { + risk_code?: string; + risk_event?: { + type?: string; + title?: string; + msg?: string; + action?: string; + content_risk_type?: string; + trade_tips?: string; + auto_reply?: string; + }; +} +⋮---- +/** v4.106.96: send_chat_message risk fields in data */ +export interface P2PMerchantSendChatMessageData { + risk_type?: number; + toast_msg?: string; + [key: string]: unknown; +} +⋮---- +export interface P2PMerchantChatsListData { + messages: P2PMerchantChatMessage[]; + has_history?: boolean; + txid?: number; + SRVTM?: number; + order_status?: string; + memo?: string; +} + +================ +File: src/types/response/withdrawal.ts +================ +export interface WithdrawalRecord { + id: string; + txid: string; + block_number: string; + withdraw_order_id: string; + /** When `status` is DONE, withdrawal success time (not conditioned on `block_number`). */ + timestamp: string; + amount: string; + currency: string; + address: string; + memo?: string; + status: + | 'BCODE' // Deposit Code Operation + | 'CANCEL' // Cancelled + | 'CANCELPEND' // Withdrawal Cancellation Pending + | 'DMOVE' // Pending Manual Review + | 'DONE' // Completed + | 'EXTPEND' // Sent and Waiting for Confirmation + | 'FAIL' // On-Chain Failure Pending Confirmation + | 'FVERIFY' // Facial Verification in Progress + | 'INVALID' // Invalid Transaction + | 'LOCKED' // Wallet-Side Order Locked + | 'MANUAL' // Pending Manual Review + | 'PEND' // Processing + | 'PROCES' // Processing + | 'REJECT' // Rejected + | 'REQUEST' // Request in Progress + | 'REVIEW' // Under Review + | 'SPLITPEND' // Split Pending + | 'VERIFY'; // Verification in Progress + chain: string; +} +⋮---- +/** When `status` is DONE, withdrawal success time (not conditioned on `block_number`). */ +⋮---- +| 'BCODE' // Deposit Code Operation +| 'CANCEL' // Cancelled +| 'CANCELPEND' // Withdrawal Cancellation Pending +| 'DMOVE' // Pending Manual Review +| 'DONE' // Completed +| 'EXTPEND' // Sent and Waiting for Confirmation +| 'FAIL' // On-Chain Failure Pending Confirmation +| 'FVERIFY' // Facial Verification in Progress +| 'INVALID' // Invalid Transaction +| 'LOCKED' // Wallet-Side Order Locked +| 'MANUAL' // Pending Manual Review +| 'PEND' // Processing +| 'PROCES' // Processing +| 'REJECT' // Rejected +| 'REQUEST' // Request in Progress +| 'REVIEW' // Under Review +| 'SPLITPEND' // Split Pending +| 'VERIFY'; // Verification in Progress + +================ +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 +bundleReport.html +.history/ +dist +coverage +localtest.sh +repomix.sh +doc +examples/ignored/ -## Next steps +ws-private-spot-wsapi-performance.ts +ws-private-perp-futures-wsapi-readonly.ts +privatetest.ts -- Browse the [Gate SDK examples](https://siebly.io/examples/Gate). -- Find methods in the [complete endpoint map](./endpointFunctionList.md). -- Review the [Gate SDK page](https://siebly.io/sdk/gate/javascript). -- Install or update [`gateio-api` from npm](https://www.npmjs.com/package/gateio-api). -- Browse the [`gateio-api` source repository](https://github.com/tiagosiebler/gateio-api). -- Read the official [Gate REST API documentation](https://www.gate.com/docs/developers/apiv4/en/). -- Read the official [Gate Spot WebSocket documentation](https://www.gate.com/docs/developers/apiv4/ws/). -- Read the official [Gate Futures WebSocket documentation](https://www.gate.com/docs/developers/futures/ws/). -- Review [Exchange State](https://siebly.io/reference/exchange-state) before building private state management. -- Use [Runtime Workflows](https://siebly.io/reference/runtime-workflows) when designing startup, reconnect, and reconciliation behavior. -- Open the [Siebly glossary](https://siebly.io/reference/glossary) for order, stream, and recovery terms. -- Report SDK issues in the [`gateio-api` GitHub repository](https://github.com/tiagosiebler/gateio-api/issues). +privaterepotracker +restClientRegex.ts -================ -File: examples/Rest/otc/submitOTCBankPersonalSupplement.ts -================ -import { readFileSync } from 'fs'; -⋮---- -import { RestClient } from '../../../src/index.js'; -// import { RestClient } from 'gateio-api'; -⋮---- -async function submitOTCBankPersonalSupplementExample() +testfile.ts ================ -File: src/types/request/alpha.ts +File: src/types/request/earn.ts ================ /**========================================================================================================================== - * ALPHA + * EARN * ========================================================================================================================== */ ⋮---- -export interface GetAlphaAccountBookReq { - from: number; // Start timestamp for the query - to?: number; // End timestamp for the query, defaults to current time if not specified - page?: number; // Page number - limit?: number; // Maximum 100 items per page +/** GET /earn/dual/investment_plan */ +export interface GetDualInvestmentPlansReq { + plan_id?: number | string; + coin?: string; + type?: string; + quote_currency?: string; + /** `apy` | `short-period` | `multiple` */ + sort?: string; + page?: number; + page_size?: number; } ⋮---- -from: number; // Start timestamp for the query -to?: number; // End timestamp for the query, defaults to current time if not specified -page?: number; // Page number -limit?: number; // Maximum 100 items per page +/** `apy` | `short-period` | `multiple` */ ⋮---- -export interface CreateAlphaQuoteReq { - currency: string; // Trading symbol - side: 'buy' | 'sell'; // Buy or sell orders - amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) - gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) - slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom +/** GET /earn/dual/orders */ +export interface GetDualInvestmentOrdersReq { + from?: number; + to?: number; + type?: string; + status?: string; + coin?: string; + page?: number; + limit?: number; } ⋮---- -currency: string; // Trading symbol -side: 'buy' | 'sell'; // Buy or sell orders -amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) -gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) -slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom -⋮---- -export interface CreateAlphaOrderReq { - currency: string; // Trading symbol - side: 'buy' | 'sell'; // Buy or sell orders - amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) - gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) - slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom - quote_id: string; // Quote ID returned from quotation API +/** GET /earn/dual/order-refund-preview */ +export interface GetDualOrderRefundPreviewReq { + order_id: string; } ⋮---- -currency: string; // Trading symbol -side: 'buy' | 'sell'; // Buy or sell orders -amount: string; // Trade Quantity (side: buy refers to quote currency USDT, side: sell refers to base currency) -gas_mode: 'speed' | 'custom'; // Trading mode (speed: Smart mode, custom: Custom mode uses slippage parameter) -slippage?: string; // Slippage tolerance (10 means 10% tolerance) - required when gas_mode is custom -quote_id: string; // Quote ID returned from quotation API -⋮---- -export interface GetAlphaOrdersReq { - currency?: string; // Trading symbol - side?: 'buy' | 'sell'; // Buy or sell orders - status?: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) - from?: number; // Start time for order query - to?: number; // End time for order query, defaults to current time if not specified - limit?: number; // Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 - page?: number; // Page number +/** POST /earn/dual/order-refund */ +export interface SubmitDualOrderRefundParams { + order_id: string; + /** From order-refund-preview */ + req_id: string; } ⋮---- -currency?: string; // Trading symbol -side?: 'buy' | 'sell'; // Buy or sell orders -status?: number; // Order Status (0: All, 1: Processing, 2: Successful, 3: Failed, 4: Cancelled, 5: Buy order placed but transfer not completed, 6: Order cancelled but transfer not completed) -from?: number; // Start time for order query -to?: number; // End time for order query, defaults to current time if not specified -limit?: number; // Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 -page?: number; // Page number +/** From order-refund-preview */ ⋮---- -export interface GetAlphaOrderReq { - order_id: string; // Order ID +/** POST /earn/dual/modify-order-reinvest */ +export interface UpdateDualOrderReinvestParams { + order_id?: number; + /** 0 off, 1 on */ + status?: number; + /** Effective duration in seconds; default 86400 */ + effective_time_duration?: number; } ⋮---- -order_id: string; // Order ID -⋮---- -export interface GetAlphaCurrenciesReq { - currency?: string; // Query currency information by currency symbol - limit?: number; // Maximum number of records returned in a single list - page?: number; // Page number -} +/** 0 off, 1 on */ ⋮---- -currency?: string; // Query currency information by currency symbol -limit?: number; // Maximum number of records returned in a single list -page?: number; // Page number +/** Effective duration in seconds; default 86400 */ ⋮---- -export interface GetAlphaTickersReq { - currency?: string; // Query by specified currency name - limit?: number; // Maximum number of records returned in a single list - page?: number; // Page number +/** GET /earn/dual/project-recommend */ +export interface GetDualProjectRecommendReq { + mode?: string; + coin?: string; + type?: string; + /** Comma-separated project IDs to exclude */ + history_pids?: string; } ⋮---- -currency?: string; // Query by specified currency name -limit?: number; // Maximum number of records returned in a single list -page?: number; // Page number - -================ -File: src/types/request/autoinvest.ts -================ -/**========================================================================================================================== - * EARN AUTO INVEST - * ========================================================================================================================== - */ -⋮---- -export interface AutoInvestPlanPortfolioItemInput { - asset: string; - ratio: string; -} +/** Comma-separated project IDs to exclude */ ⋮---- -/** POST /earn/autoinvest/plans/create */ -export interface CreateAutoInvestPlanReq { - plan_name?: string; - plan_des?: string; - plan_money: string; - plan_amount: string; - plan_period_type: - | 'daily' - | 'weekly' - | 'biweekly' - | 'monthly' - | 'hourly' - | '4-hourly'; - plan_period_day: number; - plan_period_hour: number; - items: AutoInvestPlanPortfolioItemInput[]; - /** Fund source: `spot` or `earn`; default spot */ - fund_source?: string; - /** Fund flow: `auto_invest` or `earn`; default auto_invest */ - fund_flow?: string; - /** 0 normal creation, 1 quick investment */ - type?: number; +/** Request params for POST /earn/dual/orders */ +export interface PlaceDualInvestmentOrderParams { + plan_id: string; + /** Subscription amount. Mutually exclusive with copies. */ + amount: string; + /** Units. Mutually exclusive with amount. */ + copies?: string; + /** Custom order info, must start with t- */ + text?: string; } ⋮---- -/** Fund source: `spot` or `earn`; default spot */ +/** Subscription amount. Mutually exclusive with copies. */ ⋮---- -/** Fund flow: `auto_invest` or `earn`; default auto_invest */ +/** Units. Mutually exclusive with amount. */ ⋮---- -/** 0 normal creation, 1 quick investment */ +/** Custom order info, must start with t- */ ⋮---- -/** POST /earn/autoinvest/plans/update */ -export interface UpdateAutoInvestPlanReq { - plan_id: number; - fund_source?: string; - fund_flow?: string; -} +/**========================================================================================================================== + * EARN FIXED-TERM + * ========================================================================================================================== + */ ⋮---- -/** POST /earn/autoinvest/plans/stop */ -export interface StopAutoInvestPlanReq { - plan_id: number; +export interface GetEarnFixedTermProductsReq { + asset?: string; + type?: number; // 1 regular, 2 VIP + page: number; + limit: number; } ⋮---- -/** POST /earn/autoinvest/plans/add_position */ -export interface AddAutoInvestPlanPositionReq { - plan_id: number; - amount: string; -} +type?: number; // 1 regular, 2 VIP ⋮---- -/** POST /earn/autoinvest/min_invest_amount */ -export interface GetAutoInvestMinAmountReq { - money: string; - items: AutoInvestPlanPortfolioItemInput[]; +export interface GetEarnFixedTermProductsByAssetReq { + /** Product type: "" or 1 regular, 2 VIP, 0 all */ + type?: string; } ⋮---- -/** GET /earn/autoinvest/coins */ -export interface GetAutoInvestCoinsReq { - /** Pricing currency: USDT or BTC; default USDT */ - plan_money?: string; +/** Product type: "" or 1 regular, 2 VIP, 0 all */ +⋮---- +export interface CreateEarnFixedTermLendReq { + product_id: number; + amount: string; + year_rate?: string; + reinvest_status?: number; // 0 off, 1 on + redeem_account_type?: number; // 1 spot + financial_rate_id?: number; // interest boost coupon id, 0 = none + sub_business?: number; } ⋮---- -/** Pricing currency: USDT or BTC; default USDT */ +reinvest_status?: number; // 0 off, 1 on +redeem_account_type?: number; // 1 spot +financial_rate_id?: number; // interest boost coupon id, 0 = none ⋮---- -/** GET /earn/autoinvest/plans/records */ -export interface GetAutoInvestPlanRecordsReq { - plan_id: number; - page?: number; - page_size?: number; +export interface GetEarnFixedTermLendsReq { + product_id?: number; + order_id?: number; + asset?: string; + order_type: '1' | '2'; // 1 current, 2 historical + page: number; + limit: number; + sub_business?: number; + business_filter?: string; } ⋮---- -/** GET /earn/autoinvest/orders */ -export interface GetAutoInvestOrdersReq { - plan_id: number; - record_id: number; -} +order_type: '1' | '2'; // 1 current, 2 historical ⋮---- -/** GET /earn/autoinvest/plans/detail */ -export interface GetAutoInvestPlanDetailReq { - plan_id: number; +export interface EarnFixedTermPreRedeemReq { + order_id: string; } ⋮---- -/** GET /earn/autoinvest/plans/list_info */ -export interface GetAutoInvestPlansReq { - /** Plan status: e.g. History (history) or Active (active) */ - status: string; - page?: number; - page_size?: number; +export interface GetEarnFixedTermHistoryReq { + product_id?: number; + order_id?: string; + asset?: string; + type: '1' | '2' | '3' | '4'; // 1 subscribe, 2 redeem, 3 interest, 4 bonus + page: number; + limit: number; + start_at?: number; + end_at?: number; + sub_business?: number; + business_filter?: string; } ⋮---- -/** Plan status: e.g. History (history) or Active (active) */ +type: '1' | '2' | '3' | '4'; // 1 subscribe, 2 redeem, 3 interest, 4 bonus ================ File: src/types/request/otc.ts @@ -8622,186 +9277,28 @@ export interface CreateOTCBankReq { bank_address: string; iban: string; swift: string; - remittance_line_number?: string; - agent_bank_name?: string; - agent_bank_swift?: string; - documentation_file: GateMultipartFile; -} -⋮---- -export interface SubmitOTCBankPersonalSupplementReq { - bank_id: string; - id_document_front: GateMultipartFile; - id_document_back: GateMultipartFile; - address_proof: GateMultipartFile; -} -⋮---- -export interface SubmitOTCBankEnterpriseSupplementReq { - bank_id: string; - certificate: GateMultipartFile; - share_holders: GateMultipartFile; - passport: GateMultipartFile; - share_holding_structure: GateMultipartFile; - uid?: string; - funds_statement?: GateMultipartFile; - additional?: GateMultipartFile; -} - -================ -File: src/types/request/p2pMerchant.ts -================ -/** P2P Merchant API request types */ -⋮---- -export interface P2PMerchantGetCounterpartyUserInfoReq { - biz_uid: string; -} -⋮---- -export interface P2PMerchantGetMyselfPaymentReq { - fiat?: string; -} -⋮---- -export interface P2PMerchantGetPendingTransactionListReq { - crypto_currency: string; - fiat_currency: string; - order_tab?: string; - select_type?: string; - status?: string; - txid?: number; - start_time?: number; - end_time?: number; -} -⋮---- -export interface P2PMerchantGetCompletedTransactionListReq { - crypto_currency: string; - fiat_currency: string; - select_type?: string; - status?: string; - txid?: number; - start_time?: number; - end_time?: number; - query_dispute?: number; - page?: number; - per_page?: number; -} -⋮---- -export interface P2PMerchantGetTransactionDetailsReq { - txid: number; - channel?: string; -} -⋮---- -export interface P2PMerchantConfirmPaymentReq { - trade_id: string; - payment_method: string; -} -⋮---- -export interface P2PMerchantConfirmReceiptReq { - trade_id: string; -} -⋮---- -export interface P2PMerchantCancelTransactionReq { - trade_id: string; - reason_id?: string; - reason_memo?: string; -} -⋮---- -export interface P2PMerchantPlaceBizPushOrderReq { - currencyType: string; - exchangeType: string; - type: string; - unitPrice: string; - number: string; - payType: string; - minAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType - maxAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType - pay_type_json?: string; - rateFixed?: string; - oid?: string; - tierLimit?: string; - verifiedLimit?: string; - regTimeLimit?: string; - advertisersLimit?: string; - hide_payment?: string; - expire_min?: string; - trade_tips?: string; - auto_reply?: string; - min_completed_limit?: string; - max_completed_limit?: string; - completed_rate_limit?: string; - user_country_limit?: string; - user_order_limit?: string; - rateReferenceId?: string; - rateOffset?: string; - float_trend?: string; - limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount; defaults to 0 - fiatMinAmount?: string; // v4.106.102: Required when limitBasis is 1 - fiatMaxAmount?: string; // v4.106.102: Required when limitBasis is 1 - polymarket_limit?: string; // v4.106.102: Restrict trading with Polymarket users -} -⋮---- -minAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType -maxAmount?: string; // v4.106.102: No longer required; trade quantity priced by currencyType -⋮---- -limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount; defaults to 0 -fiatMinAmount?: string; // v4.106.102: Required when limitBasis is 1 -fiatMaxAmount?: string; // v4.106.102: Required when limitBasis is 1 -polymarket_limit?: string; // v4.106.102: Restrict trading with Polymarket users -⋮---- -/** POST /p2p/merchant/account/set_merchant_work_hours — v4.106.96 */ -export interface P2PMerchantSetMerchantWorkHoursReq { - work_status: 0 | 1 | 2; // 0 resting, 1 working, 2 custom working hours - cycle_type?: string; - day_of_week?: string; - time_zone?: string; // UTC offset -12 to +14 - start_time?: string; - end_time?: string; -} -⋮---- -work_status: 0 | 1 | 2; // 0 resting, 1 working, 2 custom working hours -⋮---- -time_zone?: string; // UTC offset -12 to +14 -⋮---- -export interface P2PMerchantAdsUpdateStatusReq { - adv_no: number; - adv_status: 1 | 3 | 4; - /** Optional query param */ - trade_type?: string; -} -⋮---- -/** Optional query param */ -⋮---- -export interface P2PMerchantAdsDetailReq { - adv_no: string; -} -⋮---- -export interface P2PMerchantMyAdsListReq { - asset?: string; - fiat_unit?: string; - trade_type?: string; -} -⋮---- -export interface P2PMerchantGetAdsListReq { - asset: string; - fiat_unit: string; - trade_type: string; -} -⋮---- -export interface P2PMerchantGetChatsListReq { - txid: number; - lastreceived?: number; - firstreceived?: number; -} -⋮---- -export interface P2PMerchantSendChatMessageReq { - txid: number; - message: string; - /** 0=Text, 1=File (video or image). Default 0 */ - type?: 0 | 1; + remittance_line_number?: string; + agent_bank_name?: string; + agent_bank_swift?: string; + documentation_file: GateMultipartFile; } ⋮---- -/** 0=Text, 1=File (video or image). Default 0 */ +export interface SubmitOTCBankPersonalSupplementReq { + bank_id: string; + id_document_front: GateMultipartFile; + id_document_back: GateMultipartFile; + address_proof: GateMultipartFile; +} ⋮---- -export interface P2PMerchantUploadChatFileReq { - image_content_type: string; - base64_img: string; +export interface SubmitOTCBankEnterpriseSupplementReq { + bank_id: string; + certificate: GateMultipartFile; + share_holders: GateMultipartFile; + passport: GateMultipartFile; + share_holding_structure: GateMultipartFile; + uid?: string; + funds_statement?: GateMultipartFile; + additional?: GateMultipartFile; } ================ @@ -9227,418 +9724,179 @@ export interface SubmitTransferReq { currency_pair?: string; settle?: string; client_order_id?: string; -} -⋮---- -export interface GetMainSubTransfersReq { - sub_uid?: string; - from?: number; - to?: number; - limit?: number; - offset?: number; -} -⋮---- -export interface GetSavedAddressReq { - currency?: string; // v4.106.94: Optional filter by currency - chain?: string; - limit?: string; - page?: number; - verified?: string; // v4.106.94: 1 verification-free, 0 normal, empty for no filter -} -⋮---- -currency?: string; // v4.106.94: Optional filter by currency -⋮---- -verified?: string; // v4.106.94: 1 verification-free, 0 normal, empty for no filter -⋮---- -export interface GetSmallBalanceHistoryReq { - currency?: string; - page?: number; - limit?: number; -} -⋮---- -export interface ListPushOrdersReq { - id?: number; - from?: number; - to?: number; - limit?: number; - offset?: number; - transaction_type?: string; -} -⋮---- -export interface SubmitSubToSubTransferReq { - currency: string; - sub_account_from: string; - sub_account_from_type: 'spot' | 'futures' | 'delivery' | 'cross_margin'; - sub_account_to: string; - sub_account_to_type: 'spot' | 'futures' | 'delivery' | 'cross_margin'; - amount: string; - sub_account_type?: string; -} -⋮---- -export interface SubmitMainSubTransferReq { - currency: string; - sub_account: string; - direction: 'to' | 'from'; - amount: string; - client_order_id?: string; - sub_account_type?: 'spot' | 'futures' | 'cross_margin' | 'delivery'; -} -⋮---- -/** GET /wallet/transfers */ -export interface GetTransferReq { - tx_id: string; -} - -================ -File: src/types/response/p2pMerchant.ts -================ -/** P2P Merchant API response types */ -⋮---- -export interface P2PMerchantApiResp { - timestamp: number; - method: string; - code: number; - message: string; - data: T; - version: string; -} -⋮---- -export interface P2PMerchantUserInfo { - is_self?: boolean; - user_timest?: string; - counterparties_num?: number; - email_verified?: string; - verified?: string; - has_phone?: string; - user_name?: string; - user_note?: string; - complete_transactions?: string; - paid_transactions?: string; - accepted_transactions?: string; - transactions_used_time?: string; - cancelled_used_time_month?: string; - complete_transactions_month?: string; - complete_rate_month?: number; - orders_buy_rate_month?: number; - is_black?: number; - is_follow?: number; - have_traded?: number; - biz_uid?: string; - blue_vip?: number; - work_status?: number; - registration_days?: number; - first_trade_days?: number; - need_replenish?: number; - merchant_info?: { type?: string; market?: string }; - online_status?: number; - work_hours?: Record | null; - transactions_month?: number; - transactions_all?: number; - trade_versatile?: boolean; - [key: string]: unknown; -} -⋮---- -export interface P2PMerchantCounterpartyUserInfo { - user_timest?: string; - email_verified?: string; - verified?: string; - has_phone?: string; - user_name?: string; - user_note?: string; - complete_transactions?: string; - paid_transactions?: string; - accepted_transactions?: string; - transactions_used_time?: string; - cancelled_used_time_month?: string; - complete_transactions_month?: string; - complete_rate_month?: number; - is_follow?: number; - have_traded?: number; - biz_uid?: string; - registration_days?: number; - first_trade_days?: number; - trade_versatile?: boolean; - [key: string]: unknown; -} -⋮---- -export interface P2PMerchantPaymentMethod { - pay_type: string; - pay_name: string; - ids: number[]; - list: Record[]; -} -⋮---- -export interface P2PMerchantTransactionListItem { - type_buy?: number; - timest?: string; - timest_expire?: string; - type?: string; - trade_type?: string; - timestamp?: number; - rate?: string; - amount?: string; - total?: string; - txid?: number; - status?: string; - order_status?: string; - [key: string]: unknown; -} -⋮---- -export interface P2PMerchantTransactionListData { - list: P2PMerchantTransactionListItem[]; - trans_time?: { od_time?: number }[]; - count: number; - exported_num: number; -} -⋮---- -export interface P2PMerchantTransactionDetails { - is_sell?: number; - txid?: number; - orderid?: number; - timest?: number; - last_pay_time?: number; - remain_pay_time?: number; - currencyType?: string; - want_type?: string; - rate?: string; - amount?: string; - total?: string; - status?: string; - state?: string; - its_uid?: string; - its_nickname?: string; - its_realname?: string; - [key: string]: unknown; -} -⋮---- -export interface P2PMerchantAdsDetail { - rate?: string; - type?: string; - amount?: string; - min_amount?: string; - max_amount?: string; - fiat_min_amount?: string; // v4.106.102: Min fiat amount per order - fiat_max_amount?: string; // v4.106.102: Max fiat amount per order - minFiatAmount?: string; // v4.106.102 - maxFiatAmount?: string; // v4.106.102 - limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount - limitBasisText?: string; // v4.106.102 - polymarket_limit?: string; // v4.106.102 - total?: string; - orderid?: number; - timestamp?: number; - currencyType?: string; - want_type?: string; - status?: string; - [key: string]: unknown; -} -⋮---- -fiat_min_amount?: string; // v4.106.102: Min fiat amount per order -fiat_max_amount?: string; // v4.106.102: Max fiat amount per order -minFiatAmount?: string; // v4.106.102 -maxFiatAmount?: string; // v4.106.102 -limitBasis?: string; // v4.106.102: 0 by crypto quantity, 1 by fiat amount -limitBasisText?: string; // v4.106.102 -polymarket_limit?: string; // v4.106.102 -⋮---- -export interface P2PMerchantMyAdsListItem { - type?: string; - rate?: string; - amount?: string; - total?: string; - id?: string; - status?: string; - currencyType?: string; - want_type?: string; - fiat_min_amount?: string; // v4.106.102 - fiat_max_amount?: string; // v4.106.102 - limit_basis?: string; // v4.106.103 - limit_basis_text?: string; // v4.106.103 - [key: string]: unknown; -} -⋮---- -fiat_min_amount?: string; // v4.106.102 -fiat_max_amount?: string; // v4.106.102 -limit_basis?: string; // v4.106.103 -limit_basis_text?: string; // v4.106.103 +} ⋮---- -export interface P2PMerchantMyAdsListData { - lists: P2PMerchantMyAdsListItem[]; +export interface GetMainSubTransfersReq { + sub_uid?: string; + from?: number; + to?: number; + limit?: number; + offset?: number; } ⋮---- -export interface P2PMerchantAdsListItem { - index?: number; - asset?: string; - fiat_unit?: string; - adv_no?: number; - price?: string; - max_single_trans_amount?: string; - min_single_trans_amount?: string; - nick_name?: string; - surplus_amount?: string; // v4.106.103: Remaining tradable crypto quantity - trade_methods?: string[]; // v4.106.103: Supported payment methods list - fiat_min_amount?: string; // v4.106.103 - fiat_max_amount?: string; // v4.106.103 - limit_basis?: string; // v4.106.103 - limit_basis_text?: string; // v4.106.103 +export interface GetSavedAddressReq { + currency?: string; // v4.106.94: Optional filter by currency + chain?: string; + limit?: string; + page?: number; + verified?: string; // v4.106.94: 1 verification-free, 0 normal, empty for no filter } ⋮---- -surplus_amount?: string; // v4.106.103: Remaining tradable crypto quantity -trade_methods?: string[]; // v4.106.103: Supported payment methods list -fiat_min_amount?: string; // v4.106.103 -fiat_max_amount?: string; // v4.106.103 -limit_basis?: string; // v4.106.103 -limit_basis_text?: string; // v4.106.103 +currency?: string; // v4.106.94: Optional filter by currency ⋮---- -export interface P2PMerchantChatMessage { - is_sell?: number; - msg_type?: number; - msg?: string; - username?: string; - uid?: string; - timest?: number; - type?: number; - pic?: string; - file_key?: string; - file_type?: string; - width?: string; - height?: string; - msg_obj?: Record; - risk_type?: number; // v4.106.96: 1 off-platform traffic diversion risk - toast_msg?: string; // v4.106.96 - [key: string]: unknown; +verified?: string; // v4.106.94: 1 verification-free, 0 normal, empty for no filter +⋮---- +export interface GetSmallBalanceHistoryReq { + currency?: string; + page?: number; + limit?: number; } ⋮---- -risk_type?: number; // v4.106.96: 1 off-platform traffic diversion risk -toast_msg?: string; // v4.106.96 +export interface ListPushOrdersReq { + id?: number; + from?: number; + to?: number; + limit?: number; + offset?: number; + transaction_type?: string; +} ⋮---- -/** v4.106.96: Risk control response when place_biz_push_order hits off-platform diversion check */ -export interface P2PMerchantPlaceOrderRiskData { - risk_code?: string; - risk_event?: { - type?: string; - title?: string; - msg?: string; - action?: string; - content_risk_type?: string; - trade_tips?: string; - auto_reply?: string; - }; +export interface SubmitSubToSubTransferReq { + currency: string; + sub_account_from: string; + sub_account_from_type: 'spot' | 'futures' | 'delivery' | 'cross_margin'; + sub_account_to: string; + sub_account_to_type: 'spot' | 'futures' | 'delivery' | 'cross_margin'; + amount: string; + sub_account_type?: string; } ⋮---- -/** v4.106.96: send_chat_message risk fields in data */ -export interface P2PMerchantSendChatMessageData { - risk_type?: number; - toast_msg?: string; - [key: string]: unknown; +export interface SubmitMainSubTransferReq { + currency: string; + sub_account: string; + direction: 'to' | 'from'; + amount: string; + client_order_id?: string; + sub_account_type?: 'spot' | 'futures' | 'cross_margin' | 'delivery'; } ⋮---- -export interface P2PMerchantChatsListData { - messages: P2PMerchantChatMessage[]; - has_history?: boolean; - txid?: number; - SRVTM?: number; - order_status?: string; - memo?: string; +/** GET /wallet/transfers */ +export interface GetTransferReq { + tx_id: string; } ================ -File: src/types/response/withdrawal.ts +File: src/types/websockets/client.ts ================ -export interface WithdrawalRecord { - id: string; - txid: string; - block_number: string; - withdraw_order_id: string; - /** When `status` is DONE, withdrawal success time (not conditioned on `block_number`). */ - timestamp: string; - amount: string; - currency: string; - address: string; - memo?: string; - status: - | 'BCODE' // Deposit Code Operation - | 'CANCEL' // Cancelled - | 'CANCELPEND' // Withdrawal Cancellation Pending - | 'DMOVE' // Pending Manual Review - | 'DONE' // Completed - | 'EXTPEND' // Sent and Waiting for Confirmation - | 'FAIL' // On-Chain Failure Pending Confirmation - | 'FVERIFY' // Facial Verification in Progress - | 'INVALID' // Invalid Transaction - | 'LOCKED' // Wallet-Side Order Locked - | 'MANUAL' // Pending Manual Review - | 'PEND' // Processing - | 'PROCES' // Processing - | 'REJECT' // Rejected - | 'REQUEST' // Request in Progress - | 'REVIEW' // Under Review - | 'SPLITPEND' // Split Pending - | 'VERIFY'; // Verification in Progress - chain: string; +import type { ClientRequestArgs } from 'http'; +import WebSocket from 'isomorphic-ws'; +⋮---- +/** + * Event args for subscribing/unsubscribing + */ +⋮---- +// export type WsTopicSubscribePrivateArgsV2 = +// | WsTopicSubscribePrivateInstIdArgsV2 +// | WsTopicSubscribePrivateCoinArgsV2; +⋮---- +// export type WsTopicSubscribeEventArgsV2 = +// | WsTopicSubscribePublicArgsV2 +// | WsTopicSubscribePrivateArgsV2; +⋮---- +/** General configuration for the WebsocketClient */ +export interface WSClientConfigurableOptions { + /** Your API key */ + apiKey?: string; + + /** Your API secret */ + apiSecret?: string; + + useTestnet?: boolean; + + /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ + recvWindow?: number; + + /** How often to check if the connection is alive */ + pingInterval?: number; + + /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ + pongTimeout?: number; + + /** Delay in milliseconds before respawning the connection */ + reconnectTimeout?: number; + + requestOptions?: {}; + + wsUrl?: string; + + wsOptions?: { + protocols?: string[]; + agent?: any; + } & ( + | Omit, 'agent'> + | Omit, 'agent'> + ); + + /** + * 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; + + /** + * If you authenticated the WS API before, automatically try to re-authenticate the WS API if you're disconnected/reconnected for any reason. + */ + reauthWSAPIOnReconnect?: boolean; } ⋮---- -/** When `status` is DONE, withdrawal success time (not conditioned on `block_number`). */ +/** Your API key */ ⋮---- -| 'BCODE' // Deposit Code Operation -| 'CANCEL' // Cancelled -| 'CANCELPEND' // Withdrawal Cancellation Pending -| 'DMOVE' // Pending Manual Review -| 'DONE' // Completed -| 'EXTPEND' // Sent and Waiting for Confirmation -| 'FAIL' // On-Chain Failure Pending Confirmation -| 'FVERIFY' // Facial Verification in Progress -| 'INVALID' // Invalid Transaction -| 'LOCKED' // Wallet-Side Order Locked -| 'MANUAL' // Pending Manual Review -| 'PEND' // Processing -| 'PROCES' // Processing -| 'REJECT' // Rejected -| 'REQUEST' // Request in Progress -| 'REVIEW' // Under Review -| 'SPLITPEND' // Split Pending -| 'VERIFY'; // Verification in Progress +/** Your API secret */ +⋮---- +/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ +⋮---- +/** How often to check if the connection is alive */ +⋮---- +/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ +⋮---- +/** Delay in milliseconds before respawning the connection */ +⋮---- +/** + * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method + * + * Look in the examples folder for a demonstration on using node's createHmac instead. + */ +⋮---- +/** + * If you authenticated the WS API before, automatically try to re-authenticate the WS API if you're disconnected/reconnected for any reason. + */ +⋮---- +/** + * WS configuration that's always defined, regardless of user configuration + * (usually comes from defaults if there's no user-provided values) + */ +export interface WebsocketClientOptions extends WSClientConfigurableOptions { + pingInterval: number; + pongTimeout: number; + reconnectTimeout: number; + recvWindow: number; + authPrivateConnectionsOnConnect: boolean; + authPrivateRequests: boolean; + reauthWSAPIOnReconnect: boolean; +} ================ -File: .gitignore +File: webpack/webpack.config.cjs ================ -!.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 -bundleReport.html -.history/ -dist -coverage -localtest.sh -repomix.sh -doc -examples/ignored/ - -ws-private-spot-wsapi-performance.ts -ws-private-perp-futures-wsapi-readonly.ts -privatetest.ts - -privaterepotracker -restClientRegex.ts - -testfile.ts +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: src/types/request/crossex.ts @@ -9941,161 +10199,6 @@ export interface GetCrossExCoinDiscountRateReq { ⋮---- exchange_type?: string; // OKX/GATE/BINANCE/BYBIT -================ -File: src/types/request/earn.ts -================ -/**========================================================================================================================== - * EARN - * ========================================================================================================================== - */ -⋮---- -/** GET /earn/dual/investment_plan */ -export interface GetDualInvestmentPlansReq { - plan_id?: number | string; - coin?: string; - type?: string; - quote_currency?: string; - /** `apy` | `short-period` | `multiple` */ - sort?: string; - page?: number; - page_size?: number; -} -⋮---- -/** `apy` | `short-period` | `multiple` */ -⋮---- -/** GET /earn/dual/orders */ -export interface GetDualInvestmentOrdersReq { - from?: number; - to?: number; - type?: string; - status?: string; - coin?: string; - page?: number; - limit?: number; -} -⋮---- -/** GET /earn/dual/order-refund-preview */ -export interface GetDualOrderRefundPreviewReq { - order_id: string; -} -⋮---- -/** POST /earn/dual/order-refund */ -export interface SubmitDualOrderRefundParams { - order_id: string; - /** From order-refund-preview */ - req_id: string; -} -⋮---- -/** From order-refund-preview */ -⋮---- -/** POST /earn/dual/modify-order-reinvest */ -export interface UpdateDualOrderReinvestParams { - order_id?: number; - /** 0 off, 1 on */ - status?: number; - /** Effective duration in seconds; default 86400 */ - effective_time_duration?: number; -} -⋮---- -/** 0 off, 1 on */ -⋮---- -/** Effective duration in seconds; default 86400 */ -⋮---- -/** GET /earn/dual/project-recommend */ -export interface GetDualProjectRecommendReq { - mode?: string; - coin?: string; - type?: string; - /** Comma-separated project IDs to exclude */ - history_pids?: string; -} -⋮---- -/** Comma-separated project IDs to exclude */ -⋮---- -/** Request params for POST /earn/dual/orders */ -export interface PlaceDualInvestmentOrderParams { - plan_id: string; - /** Subscription amount. Mutually exclusive with copies. */ - amount: string; - /** Units. Mutually exclusive with amount. */ - copies?: string; - /** Custom order info, must start with t- */ - text?: string; -} -⋮---- -/** Subscription amount. Mutually exclusive with copies. */ -⋮---- -/** Units. Mutually exclusive with amount. */ -⋮---- -/** Custom order info, must start with t- */ -⋮---- -/**========================================================================================================================== - * EARN FIXED-TERM - * ========================================================================================================================== - */ -⋮---- -export interface GetEarnFixedTermProductsReq { - asset?: string; - type?: number; // 1 regular, 2 VIP - page: number; - limit: number; -} -⋮---- -type?: number; // 1 regular, 2 VIP -⋮---- -export interface GetEarnFixedTermProductsByAssetReq { - /** Product type: "" or 1 regular, 2 VIP, 0 all */ - type?: string; -} -⋮---- -/** Product type: "" or 1 regular, 2 VIP, 0 all */ -⋮---- -export interface CreateEarnFixedTermLendReq { - product_id: number; - amount: string; - year_rate?: string; - reinvest_status?: number; // 0 off, 1 on - redeem_account_type?: number; // 1 spot - financial_rate_id?: number; // interest boost coupon id, 0 = none - sub_business?: number; -} -⋮---- -reinvest_status?: number; // 0 off, 1 on -redeem_account_type?: number; // 1 spot -financial_rate_id?: number; // interest boost coupon id, 0 = none -⋮---- -export interface GetEarnFixedTermLendsReq { - product_id?: number; - order_id?: number; - asset?: string; - order_type: '1' | '2'; // 1 current, 2 historical - page: number; - limit: number; - sub_business?: number; - business_filter?: string; -} -⋮---- -order_type: '1' | '2'; // 1 current, 2 historical -⋮---- -export interface EarnFixedTermPreRedeemReq { - order_id: string; -} -⋮---- -export interface GetEarnFixedTermHistoryReq { - product_id?: number; - order_id?: string; - asset?: string; - type: '1' | '2' | '3' | '4'; // 1 subscribe, 2 redeem, 3 interest, 4 bonus - page: number; - limit: number; - start_at?: number; - end_at?: number; - sub_business?: number; - business_filter?: string; -} -⋮---- -type: '1' | '2' | '3' | '4'; // 1 subscribe, 2 redeem, 3 interest, 4 bonus - ================ File: src/types/response/crossex.ts ================ @@ -10773,1222 +10876,1109 @@ max_value: string; // Maximum value discount_rate: string; // Discount rate ================ -File: src/types/response/otc.ts +File: src/types/response/earn.ts ================ /**========================================================================================================================== - * OTC + * EARN * ========================================================================================================================== */ ⋮---- -export interface OTCActionResp { - code: number; - message: string; - timestamp: number; -} -⋮---- -export interface CreateOTCQuoteResp { - code: number; - message: string; - data: { - type: string; // BUY (on-ramp) or SELL (off-ramp) - pay_coin: string; - get_coin: string; - pay_amount: string; - get_amount: string; - rate: string; - rate_reci: string; // Reciprocal of the exchange rate - promotion_code: string; - side: string; - order_type: string; // FIAT or STABLE - quote_token: string; // Quote token required when placing an order - url?: string; - memo?: string; - has_signature?: string; - validity_period?: string; - ex_rate?: string; - usdc_rate?: string; - is_need_file?: string; - gate_bank_id?: string; - gate_bank_name?: string; - refresh_limit?: number; - refresh_limit_msg?: string; - }; - timestamp: number; +export interface DualInvestmentProduct { + id: number; + instrument_name: string; + invest_currency: string; + exercise_currency: string; + exercise_price: number; + delivery_time: number; + min_amount?: string; + min_copies: number; + max_copies: number; + /** @deprecated */ + per_value: string; + apy_display: string; + start_time: number; + end_time: number; + status: 'NOTSTARTED' | 'ONGOING' | 'ENDED'; } ⋮---- -type: string; // BUY (on-ramp) or SELL (off-ramp) -⋮---- -rate_reci: string; // Reciprocal of the exchange rate -⋮---- -order_type: string; // FIAT or STABLE -quote_token: string; // Quote token required when placing an order -⋮---- -export type CreateOTCFiatOrderResp = OTCActionResp; +/** @deprecated */ ⋮---- -export interface CreateOTCStablecoinOrderResp { - code: number; - message: string; - timestamp: number; +/** GET /earn/dual/order-refund-preview */ +export interface DualOrderRefundPreview { + create_timest: number; + delivery_timest: number; + exercise_price: string; + invest_amount: string; + invest_currency: string; + name: string; + order_id: number; + req_id: string; + refund_service_charge: number; + settle_price: string; + settlement_amount: string; + settlement_currency: string; + settlement_interest: string; + settlement_principle: string; + type: string; + money_back_timest: number; } ⋮---- -export interface OTCBankListItem { - id: string; // Bank ID (required for order placement) - bank_account_name: string; - bank_name: string; - bank_country?: string; - bank_address?: string; - bank_code?: string; - branch_code?: string; - iban?: string; - swift?: string; - remittance_line_number?: string; - agent_bank_name?: string; - agent_bank_swift?: string; - submit_time?: string; - update_time?: string; - status?: string; - documentation_file_type?: string; - memo?: string; - /** 1 = default bank card, 0 = not default */ - is_default?: 0 | 1; - bank_id?: string; - documentation_file_key_url?: string; +/** GET /earn/dual/project-recommend item */ +export interface DualProjectRecommend { + id: number; + category: number; + type: string; + invest_currency: string; + exercise_currency: string; + apy_display: string; + exercise_price: string; + delivery_timest: number; + min_amount: string; + max_amount: string; + min_copies: number; + max_copies: number; + invest_days: number; + invest_hours: string; } ⋮---- -id: string; // Bank ID (required for order placement) +export interface DualInvestmentOrder { + id: number; + plan_id: number; + copies: string; + invest_amount: string; + settlement_amount: string; + create_time: number; + complete_time: number; + status: + | 'INIT' + | 'SETTLEMENT_SUCCESS' + | 'SETTLEMENT_PROCESSING' + | 'CANCELED' + | 'FAILED'; + invest_currency: string; + exercise_currency: string; + exercise_price: string; + settlement_price: string; + settlement_currency: string; + apy_display: string; + apy_settlement: string; + delivery_time: number; + text: string; +} ⋮---- -/** 1 = default bank card, 0 = not default */ +/**========================================================================================================================== + * EARN FIXED-TERM + * ========================================================================================================================== + */ ⋮---- -export interface GetOTCBankListResp { - code: number; - message: string; - data: { - lists: OTCBankListItem[]; - }; - timestamp: number; +export interface FixedTermLadderApr { + apr: string; + left: string; + right: string; } ⋮---- -export interface CreateOTCBankResp { - code: number; - message: string; - data: { - bank_id: number; - status: number; - }; - timestamp?: number; +export interface FixedTermProductInfo { + pre_redeem: number; + reinvest: number; + redeem_account: number; + min_vip: number; + max_vip: number; } ⋮---- -export interface OTCBankSupplementChecklistItem { - description: string; - code?: string; - zh?: string; - en?: string; - required?: boolean; +export interface FixedTermBonusInfo { + id?: number; + product_id?: number; + asset?: string; + bonus_asset?: string; + kyc_limit?: string; + ladder_apr?: FixedTermLadderApr[]; + total_bonus_amount?: string; + user_total_bonus_amount?: string; + status?: number; + start_time?: string; + end_time?: string; + create_time?: string; + start_at?: number; + end_at?: number; + total_issued_amount?: string; + user_total_issued_amount?: string; + bonus_asset_price?: string; + product_asset_price?: string; + product_year_rate?: string; } ⋮---- -export interface GetOTCBankSupplementChecklistResp { - code: number; - message: string; - data: { - user_type: 'personal' | 'enterprise'; - items: OTCBankSupplementChecklistItem[]; - }; - timestamp?: number; +export interface FixedTermCouponInfo { + id?: number; + business?: number; + user_id?: number; + asset?: string; + order_id?: number; + financial_rate_id?: number; + buy_limit_low?: string; + buy_limit_high?: string; + rate_day?: number; + rate_ratio?: string; + coupon_days?: number; + coupon_principal?: string; + coupon_year_rate?: string; + coupon_interest?: string; + status?: number; + finish_time?: string; + create_time?: string; } ⋮---- -export type MarkOTCOrderAsPaidResp = OTCActionResp; -⋮---- -export type CancelOTCOrderResp = OTCActionResp; +export interface FixedTermLendOrder { + id?: number; + business?: number; + order_id?: number; + user_id?: number; + asset?: string; + product_id?: number; + lock_up_period?: number; + principal?: string; + year_rate?: string; + product_type?: number; + interest?: string; + status?: number; + reinvest_status?: number; + redeem_account_type?: number; + origin_order?: string; + redeem_type?: number; + redeem_time?: string; + finish_time?: string; + create_time?: string; + year_rate_perent?: string; + total_year_rate_percent?: string; + total_interest?: string; + product_info?: FixedTermProductInfo; + bonus_info?: FixedTermBonusInfo; + coupon_info?: FixedTermCouponInfo; + redeem_at?: number; + finish_at?: number; + create_at?: number; + icon?: string; +} ⋮---- -export interface OTCFiatOrderListItem { - time: string; // Current time - timestamp: number; // Current timestamp - order_id: string; - trade_no: string; // Trade number - type: string; // Quote direction buy/sell/all - status: string; // Order Status (includes DISBURSED) - db_status: string; - fiat_currency: string; // Fiat type - fiat_currency_info: { - name: string; - icon: string; - }; - fiat_amount: string; // Fiat amount - crypto_currency: string; // Stablecoin - crypto_currency_info: { - name: string; - icon: string; - }; - crypto_amount: string; // Stablecoin amount - rate: string; // Exchange rate - transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) - reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders - gate_bank_account_iban: string; // Bank account - promotion_code: string; // Promotion code +export interface FixedTermProduct { + id?: number; + name?: string; + asset?: string; + lock_up_period?: number; + min_lend_amount?: string; + user_max_lend_amount?: string; + total_lend_amount?: string; + year_rate?: string; + type?: number; + pre_redeem?: number; + reinvest?: number; + redeem_account?: number; + min_vip?: number; + max_vip?: number; + status?: number; + create_time?: string; + user_max_lend_volume?: string; + user_total_amount?: string; + sale_status?: number; } ⋮---- -time: string; // Current time -timestamp: number; // Current timestamp -⋮---- -trade_no: string; // Trade number -type: string; // Quote direction buy/sell/all -status: string; // Order Status (includes DISBURSED) -⋮---- -fiat_currency: string; // Fiat type -⋮---- -fiat_amount: string; // Fiat amount -crypto_currency: string; // Stablecoin -⋮---- -crypto_amount: string; // Stablecoin amount -rate: string; // Exchange rate -transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) -reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders -gate_bank_account_iban: string; // Bank account -promotion_code: string; // Promotion code +export interface FixedTermProductSimple { + id?: number; + asset?: string; + lock_up_period?: number; + year_rate?: string; + type?: number; + pre_redeem?: number; + reinvest?: number; + simple_earn?: number; + min_vip?: number; + max_vip?: number; + sale_status?: number; +} ⋮---- -export interface GetOTCFiatOrderListResp { +export interface GetEarnFixedTermProductsResponse { code: number; message: string; data: { - pn: number; - ps: number; - total_pn: number; - count: number; - list: OTCFiatOrderListItem[]; + list: FixedTermProduct[]; + total: number; }; + timestamp: number; } ⋮---- -export interface OTCStablecoinOrderListItem { - id: number; // Order ID - trade_no: string; // Transaction reference number - pay_coin: string; // Payment currency - pay_amount: string; // Payment amount - get_coin: string; // Received currency - get_amount: string; // Received amount - rate: string; // Exchange rate - rate_reci: string; // Reciprocal of the exchange rate - status: string; // PROCESSING: in progress / DONE: completed / FAILED: failed - create_timest: number; // Timestamp - create_time: string; // Created time - pay_icon?: string; - get_icon?: string; -} -⋮---- -id: number; // Order ID -trade_no: string; // Transaction reference number -pay_coin: string; // Payment currency -pay_amount: string; // Payment amount -get_coin: string; // Received currency -get_amount: string; // Received amount -rate: string; // Exchange rate -rate_reci: string; // Reciprocal of the exchange rate -status: string; // PROCESSING: in progress / DONE: completed / FAILED: failed -create_timest: number; // Timestamp -create_time: string; // Created time -⋮---- -export interface GetOTCStablecoinOrderListResp { +export interface GetEarnFixedTermProductsByAssetResponse { code: number; message: string; data: { - total: number; - page_size: number; - page_number: number; - total_page: number; - list: OTCStablecoinOrderListItem[]; + list: FixedTermProductSimple[]; }; + timestamp: number; } ⋮---- -export interface OTCFiatOrderDetail { - order_id: string; // Order ID - uid: string; // User ID - type: string; // Order Type - fiat_currency: string; // Fiat type - fiat_amount: string; // Fiat amount - crypto_currency: string; // Stablecoin - crypto_amount: string; // Stablecoin amount - rate: string; // Exchange rate - transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) - reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders - status: string; // Status - db_status: string; - create_time: string; // Created time - memo: string; // Cancellation or rejection reason - side: string; // Quote direction - promotion_code: string; // Promotion code - trade_no: string; // Trade number +export interface CreateEarnFixedTermLendResponse { + code?: number; + message?: string; + data?: { + order_id?: number; + }; + timestamp?: number; } ⋮---- -order_id: string; // Order ID -uid: string; // User ID -type: string; // Order Type -fiat_currency: string; // Fiat type -fiat_amount: string; // Fiat amount -crypto_currency: string; // Stablecoin -crypto_amount: string; // Stablecoin amount -rate: string; // Exchange rate -transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) -reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders -status: string; // Status -⋮---- -create_time: string; // Created time -memo: string; // Cancellation or rejection reason -side: string; // Quote direction -promotion_code: string; // Promotion code -trade_no: string; // Trade number -⋮---- -export interface GetOTCFiatOrderDetailResp { - message: string; +export interface GetEarnFixedTermLendsResponse { code: number; - data: OTCFiatOrderDetail; + message: string; + data: { + list: FixedTermLendOrder[]; + total: number; + }; + timestamp: number; } - -================ -File: src/types/response/tradfi.ts -================ -/** TradFi API response types */ ⋮---- -export interface TradFiApiResp { - timestamp?: number; - data?: T; +export interface CreateEarnFixedTermPreRedeemResponse { code?: number; message?: string; - label?: string; -} -⋮---- -export interface TradFiListData { - list?: T[]; - total?: number; - total_page?: number; + data?: Record; + timestamp?: number; } ⋮---- -export interface TradFiMT5Account { - mt5_uid?: number; - leverage?: number; - stop_out_level?: string; +export interface FixedTermHistoryRecord { + id?: number; + order_id?: number; + user_id?: number; + asset?: string; + uniq_time?: string; + bonus_id?: number; + product_id?: number; + bonus_asset?: string; + total_principal?: string; + amount?: string; + asset_price?: string; status?: number; + detail?: string; + create_time?: string; + create_at?: number; + lock_up_period?: number; } ⋮---- -export interface TradFiCategoryItem { - category_id?: number; - is_favorite?: boolean; - category_name?: string; -} -⋮---- -export interface TradFiSymbolItem { - symbol?: string; - symbol_desc?: string; - category_id?: number; - status?: string; - trade_mode?: string; - icon_link?: string; - close_time?: number; - open_time?: number; - next_open_time?: number; - settlement_currency?: string; - settlement_currency_symbol?: string; - price_precision?: number; -} -⋮---- -export interface TradFiSymbolDetailItem { - symbol?: string; - symbol_desc?: string; - category_name?: string; - contract_volume?: string; - settlement_currency?: string; - max_order_volume?: string; - min_order_volume?: string; - leverage?: string; - price_precision?: number; - price_sl_level?: string; - swap_cost_type?: string; - buy_swap_cost_rate?: string; - sell_swap_cost_rate?: string; - swap_cost_3day?: string; - trade_timezone?: string; - trade_mode?: string; - icon_link?: string; - [key: string]: unknown; -} -⋮---- -export interface TradFiKlineItem { - o?: string; - c?: string; - h?: string; - l?: string; - t?: number; +export interface GetEarnFixedTermHistoryResponse { + code?: number; + message?: string; + data?: { + list?: FixedTermHistoryRecord[]; + total?: number; + }; + timestamp?: number; } + +================ +File: src/types/response/otc.ts +================ +/**========================================================================================================================== + * OTC + * ========================================================================================================================== + */ ⋮---- -export interface TradFiTicker { - highest_price?: string; - lowest_price?: string; - price_change?: string; - price_change_amount?: string; - today_open_price?: string; - last_today_close_price?: string; - last_price?: string; - bid_price?: string; - ask_price?: string; - favorite?: boolean; - status?: string; - close_time?: number; - open_time?: number; - next_open_time?: number; - trade_mode?: string; - category_name?: string; +export interface OTCActionResp { + code: number; + message: string; + timestamp: number; } ⋮---- -export interface TradFiCreateUserResult { - status?: number; - leverage?: number; - mt5_uid?: string; +export interface CreateOTCQuoteResp { + code: number; + message: string; + data: { + type: string; // BUY (on-ramp) or SELL (off-ramp) + pay_coin: string; + get_coin: string; + pay_amount: string; + get_amount: string; + rate: string; + rate_reci: string; // Reciprocal of the exchange rate + promotion_code: string; + side: string; + order_type: string; // FIAT or STABLE + quote_token: string; // Quote token required when placing an order + url?: string; + memo?: string; + has_signature?: string; + validity_period?: string; + ex_rate?: string; + usdc_rate?: string; + is_need_file?: string; + gate_bank_id?: string; + gate_bank_name?: string; + refresh_limit?: number; + refresh_limit_msg?: string; + }; + timestamp: number; } ⋮---- -export interface TradFiAssets { - equity?: string; - margin_level?: string; - balance?: string; - margin?: string; - margin_free?: string; - unrealized_pnl?: string; - mt5_uid?: string; -} +type: string; // BUY (on-ramp) or SELL (off-ramp) ⋮---- -export interface TradFiTransactionRecord { - asset?: string; - type?: string; - type_desc?: string; - change?: string; - balance?: string; - time?: number; -} +rate_reci: string; // Reciprocal of the exchange rate ⋮---- -export interface TradFiTransactionListData { - total?: number; - total_page?: number; - list?: TradFiTransactionRecord[]; -} +order_type: string; // FIAT or STABLE +quote_token: string; // Quote token required when placing an order ⋮---- -export interface TradFiCreateOrderResult { - id?: string; -} +export type CreateOTCFiatOrderResp = OTCActionResp; ⋮---- -export interface TradFiOrderItem { - order_id?: number; - symbol?: string; - symbol_desc?: string; - price_type?: string; - state?: number; - state_desc?: string; - finished?: number; - side?: number; - volume?: string; - price?: string; - price_tp?: string; - price_sl?: string; - time_setup?: number; +export interface CreateOTCStablecoinOrderResp { + code: number; + message: string; + timestamp: number; } ⋮---- -export interface TradFiOrderListData { - list?: TradFiOrderItem[]; - timestamp?: number; +export interface OTCBankListItem { + id: string; // Bank ID (required for order placement) + bank_account_name: string; + bank_name: string; + bank_country?: string; + bank_address?: string; + bank_code?: string; + branch_code?: string; + iban?: string; + swift?: string; + remittance_line_number?: string; + agent_bank_name?: string; + agent_bank_swift?: string; + submit_time?: string; + update_time?: string; + status?: string; + documentation_file_type?: string; + memo?: string; + /** 1 = default bank card, 0 = not default */ + is_default?: 0 | 1; + bank_id?: string; + documentation_file_key_url?: string; } ⋮---- -export interface TradFiModifyOrderResult { - order_id?: number; - symbol?: string; - state?: string; - volume?: string; - price?: string; - price_tp?: string; - price_sl?: string; -} +id: string; // Bank ID (required for order placement) ⋮---- -export interface TradFiOrderHistoryItem { - order_id?: number; - symbol?: string; - symbol_desc?: string; - price_type?: string; - order_opt_type?: number; - state?: number; - state_desc?: string; - side?: number; - volume?: string; - fill_volume?: string; - close_pnl?: string; - price?: string; - trigger_price?: string; - price_tp?: string; - price_sl?: string; - time_setup?: number; - time_done?: number; -} +/** 1 = default bank card, 0 = not default */ ⋮---- -export interface TradFiPositionItem { - position_id?: number; - symbol?: string; - symbol_desc?: string; - margin?: string; - unrealized_pnl?: string; - unrealized_pnl_rate?: string; - volume?: string; - price_open?: string; - position_dir?: string; - price_tp?: string; - price_sl?: string; - counterparty_price?: string; - time_create?: number; +export interface GetOTCBankListResp { + code: number; + message: string; + data: { + lists: OTCBankListItem[]; + }; + timestamp: number; } ⋮---- -export interface TradFiPositionListData { - list?: TradFiPositionItem[]; +export interface CreateOTCBankResp { + code: number; + message: string; + data: { + bank_id: number; + status: number; + }; timestamp?: number; } ⋮---- -export interface TradFiPositionHistoryItem { - position_id?: number; - symbol?: string; - realized_pnl?: string; - realized_pnl_rate?: string; - volume?: string; - volume_closed?: string; - price_open?: string; - position_dir?: string; - price_tp?: string; - price_sl?: string; - counterparty_price?: string; - close_price?: string; - time_create?: string; - time_close?: string; - position_status?: string; - close_detail?: Record | null; - realized_pnl_detail?: { - closed_pnl?: string; - swap?: string; - fee?: string; - }; +export interface OTCBankSupplementChecklistItem { + description: string; + code?: string; + zh?: string; + en?: string; + required?: boolean; } ⋮---- -/** GET /tradfi/orders/log/{log_id} — v4.106.94 */ -export interface TradFiOrderLog { - order_id?: number; - log_id?: number; - symbol?: string; - price_type?: 'market' | 'trigger'; - state?: number; - side?: number; - volume?: string; - price?: string; - [key: string]: unknown; +export interface GetOTCBankSupplementChecklistResp { + code: number; + message: string; + data: { + user_type: 'personal' | 'enterprise'; + items: OTCBankSupplementChecklistItem[]; + }; + timestamp?: number; } ⋮---- -export interface TradFiSymbolCommissionItem { - category_code?: string; - symbol?: string; - fee_per_lot?: string; -} - -================ -File: src/types/response/wallet.ts -================ -export interface CurrencyChain { - chain: string; - name_cn: string; - name_en: string; - contract_address: string; - is_disabled: number; - is_deposit_disabled: number; - is_withdraw_disabled: number; - decimal: string; +export type MarkOTCOrderAsPaidResp = OTCActionResp; +⋮---- +export type CancelOTCOrderResp = OTCActionResp; +⋮---- +export interface OTCFiatOrderListItem { + time: string; // Current time + timestamp: number; // Current timestamp + order_id: string; + trade_no: string; // Trade number + type: string; // Quote direction buy/sell/all + status: string; // Order Status (includes DISBURSED) + db_status: string; + fiat_currency: string; // Fiat type + fiat_currency_info: { + name: string; + icon: string; + }; + fiat_amount: string; // Fiat amount + crypto_currency: string; // Stablecoin + crypto_currency_info: { + name: string; + icon: string; + }; + crypto_amount: string; // Stablecoin amount + rate: string; // Exchange rate + transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) + reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders + gate_bank_account_iban: string; // Bank account + promotion_code: string; // Promotion code } ⋮---- -/** GET /wallet/sub_account_balances item */ -export interface SubAccountBalance { - uid: string; - available: { [key: string]: string }; - /** Locked amount per currency */ - locking?: { [key: string]: string }; -} +time: string; // Current time +timestamp: number; // Current timestamp ⋮---- -/** Locked amount per currency */ +trade_no: string; // Trade number +type: string; // Quote direction buy/sell/all +status: string; // Order Status (includes DISBURSED) ⋮---- -export interface DepositRecord { - id: string; - txid: string; - timestamp: string; - amount: string; - currency: string; - address: string; - memo?: string; - status: - | 'BLOCKED' // Deposit Blocked - | 'DEP_CREDITED' // Deposit Credited, Withdrawal Pending Unlock - | 'DONE' // Funds Credited to Spot Account - | 'INVALID' // Invalid Transaction - | 'MANUAL' // Manual Review Required - | 'PEND' // Processing - | 'REVIEW' // Under Compliance Review - | 'TRACK'; // Tracking Block Confirmations, Pending Spot Account Credit - chain: string; - refund_status?: // v4.106.95: Blocked deposit refund status - 'REFUNDING' | 'REFUNDED' | 'REFUND_FAILED' | 'REJECTED'; -} +fiat_currency: string; // Fiat type ⋮---- -| 'BLOCKED' // Deposit Blocked -| 'DEP_CREDITED' // Deposit Credited, Withdrawal Pending Unlock -| 'DONE' // Funds Credited to Spot Account -| 'INVALID' // Invalid Transaction -| 'MANUAL' // Manual Review Required -| 'PEND' // Processing -| 'REVIEW' // Under Compliance Review -| 'TRACK'; // Tracking Block Confirmations, Pending Spot Account Credit +fiat_amount: string; // Fiat amount +crypto_currency: string; // Stablecoin ⋮---- -refund_status?: // v4.106.95: Blocked deposit refund status +crypto_amount: string; // Stablecoin amount +rate: string; // Exchange rate +transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) +reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders +gate_bank_account_iban: string; // Bank account +promotion_code: string; // Promotion code ⋮---- -export interface CreateDepositAddressResp { - currency: string; - address: string; - multichain_addresses: { - chain: string; - address: string; - payment_id: string; - payment_name: string; - obtain_failed: number; - }[]; +export interface GetOTCFiatOrderListResp { + code: number; + message: string; + data: { + pn: number; + ps: number; + total_pn: number; + count: number; + list: OTCFiatOrderListItem[]; + }; } ⋮---- -export interface SubAccountTransferRecord { - currency: string; - sub_account: string; - direction: 'to' | 'from'; - amount: string; - uid: string; - client_order_id: string; - timest: string; - source: string; - sub_account_type: 'spot' | 'futures' | 'cross_margin' | 'delivery'; +export interface OTCStablecoinOrderListItem { + id: number; // Order ID + trade_no: string; // Transaction reference number + pay_coin: string; // Payment currency + pay_amount: string; // Payment amount + get_coin: string; // Received currency + get_amount: string; // Received amount + rate: string; // Exchange rate + rate_reci: string; // Reciprocal of the exchange rate + status: string; // PROCESSING: in progress / DONE: completed / FAILED: failed + create_timest: number; // Timestamp + create_time: string; // Created time + pay_icon?: string; + get_icon?: string; } ⋮---- -export interface WithdrawalStatus { - currency: string; - name: string; - name_cn: string; - deposit: string; - withdraw_percent: string; - withdraw_fix: string; - withdraw_day_limit: string; - withdraw_amount_mini: string; - withdraw_day_limit_remain: string; - withdraw_eachtime_limit: string; - withdraw_fix_on_chains: { [key: string]: string }; - withdraw_percent_on_chains: { [key: string]: string }; -} +id: number; // Order ID +trade_no: string; // Transaction reference number +pay_coin: string; // Payment currency +pay_amount: string; // Payment amount +get_coin: string; // Received currency +get_amount: string; // Received amount +rate: string; // Exchange rate +rate_reci: string; // Reciprocal of the exchange rate +status: string; // PROCESSING: in progress / DONE: completed / FAILED: failed +create_timest: number; // Timestamp +create_time: string; // Created time ⋮---- -export interface SubAccountMarginBalance { - currency_pair: string; - locked: boolean; - risk: string; - base: { - currency: string; - available: string; - locked: string; - borrowed: string; - interest: string; - }; - quote: { - currency: string; - available: string; - locked: string; - borrowed: string; - interest: string; +export interface GetOTCStablecoinOrderListResp { + code: number; + message: string; + data: { + total: number; + page_size: number; + page_number: number; + total_page: number; + list: OTCStablecoinOrderListItem[]; }; } ⋮---- -export interface SubAccountFuturesBalancesResp { - uid: string; - available: { - [key: string]: { - total: string; - unrealised_pnl: string; - position_margin: string; - order_margin: string; - available: string; - point: string; - currency: string; - in_dual_mode: boolean; - enable_credit: boolean; - position_initial_margin: string; - maintenance_margin: string; - bonus: string; - enable_evolved_classic: boolean; - cross_order_margin: string; - cross_initial_margin: string; - cross_maintenance_margin: string; - cross_unrealised_pnl: string; - cross_available: string; - isolated_position_margin: string; - history: { - dnw: string; - pnl: string; - fee: string; - refr: string; - fund: string; - point_dnw: string; - point_fee: string; - point_refr: string; - bonus_dnw: string; - bonus_offset: string; - }; - }; - }; +export interface OTCFiatOrderDetail { + order_id: string; // Order ID + uid: string; // User ID + type: string; // Order Type + fiat_currency: string; // Fiat type + fiat_amount: string; // Fiat amount + crypto_currency: string; // Stablecoin + crypto_amount: string; // Stablecoin amount + rate: string; // Exchange rate + transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) + reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders + status: string; // Status + db_status: string; + create_time: string; // Created time + memo: string; // Cancellation or rejection reason + side: string; // Quote direction + promotion_code: string; // Promotion code + trade_no: string; // Trade number } ⋮---- -export interface SubAccountCrossMarginBalancesResp { - uid: string; - available: { - user_id: number; - locked: boolean; - balances: { - [key: string]: { - available: string; - freeze: string; - borrowed: string; - interest: string; - }; - }; - total: string; - borrowed: string; - borrowed_net: string; - net: string; - leverage: string; - interest: string; - risk: string; - total_initial_margin: string; - total_margin_balance: string; - total_maintenance_margin: string; - total_initial_margin_rate: string; - total_maintenance_margin_rate: string; - total_available_margin: string; - }; -} +order_id: string; // Order ID +uid: string; // User ID +type: string; // Order Type +fiat_currency: string; // Fiat type +fiat_amount: string; // Fiat amount +crypto_currency: string; // Stablecoin +crypto_amount: string; // Stablecoin amount +rate: string; // Exchange rate +transfer_remark: string; // Remark; empty when reference_code is set (v4.106.95) +reference_code?: string; // v4.106.95: Unique bank transfer reference code for SGB deposit buy orders +status: string; // Status ⋮---- -export interface SavedAddress { - currency: string; - chain: string; - address: string; - name: string; - tag: string; - verified: string; -} +create_time: string; // Created time +memo: string; // Cancellation or rejection reason +side: string; // Quote direction +promotion_code: string; // Promotion code +trade_no: string; // Trade number ⋮---- -export interface TradingFees { - user_id: number; - taker_fee: string; - maker_fee: string; - gt_discount: boolean; - gt_taker_fee: string; - gt_maker_fee: string; - loan_fee: string; - point_type: string; - futures_taker_fee: string; - futures_maker_fee: string; - delivery_taker_fee: string; - delivery_maker_fee: string; - debit_fee: number; +export interface GetOTCFiatOrderDetailResp { + message: string; + code: number; + data: OTCFiatOrderDetail; } + +================ +File: src/types/response/tradfi.ts +================ +/** TradFi API response types */ ⋮---- -export interface GetBalancesResp { - total: { - amount: string; - currency: string; - unrealised_pnl?: string; - borrowed?: string; - }; - details: { - [key: string]: { - amount: string; - currency: string; - unrealised_pnl?: string; - borrowed?: string; - }; - }; +export interface TradFiApiResp { + timestamp?: number; + data?: T; + code?: number; + message?: string; + label?: string; } ⋮---- -export interface SmallBalanceRecord { - currency: string; - available_balance: string; - estimated_as_btc: string; - convertible_to_gt: string; +export interface TradFiListData { + list?: T[]; + total?: number; + total_page?: number; } ⋮---- -export interface SmallBalanceHistoryRecord { - id: string; - currency: string; - amount: string; - gt_amount: string; - create_time: number; +export interface TradFiMT5Account { + mt5_uid?: number; + leverage?: number; + stop_out_level?: string; + status?: number; } ⋮---- -export interface PushOrder { - id: string; - push_uid: number; - receive_uid: number; - currency: string; - amount: string; - create_time: number; - status: - | 'CREATING' - | 'PENDING' - | 'CANCELLING' - | 'CANCELLED' - | 'REFUSING' - | 'REFUSED' - | 'RECEIVING' - | 'RECEIVED'; - message: string; +export interface TradFiCategoryItem { + category_id?: number; + is_favorite?: boolean; + category_name?: string; } ⋮---- -/** GET /wallet/transfers — AccountTransferDetail */ -export interface AccountTransferDetail { - tx_id: string; - status: 'pending' | 'success' | 'fail'; - currency: string; - amount: string; - from_account: - | 'spot' - | 'margin' - | 'futures' - | 'delivery' - | 'options' - | 'unknown'; - to_account: - | 'spot' - | 'margin' - | 'futures' - | 'delivery' - | 'options' - | 'unknown'; - settle?: string | null; - currency_pair?: string | null; +export interface TradFiSymbolItem { + symbol?: string; + symbol_desc?: string; + category_id?: number; + status?: string; + trade_mode?: string; + icon_link?: string; + close_time?: number; + open_time?: number; + next_open_time?: number; + settlement_currency?: string; + settlement_currency_symbol?: string; + price_precision?: number; } - -================ -File: src/types/websockets/client.ts -================ -import type { ClientRequestArgs } from 'http'; -import WebSocket from 'isomorphic-ws'; -⋮---- -/** - * Event args for subscribing/unsubscribing - */ -⋮---- -// export type WsTopicSubscribePrivateArgsV2 = -// | WsTopicSubscribePrivateInstIdArgsV2 -// | WsTopicSubscribePrivateCoinArgsV2; ⋮---- -// export type WsTopicSubscribeEventArgsV2 = -// | WsTopicSubscribePublicArgsV2 -// | WsTopicSubscribePrivateArgsV2; +export interface TradFiSymbolDetailItem { + symbol?: string; + symbol_desc?: string; + category_name?: string; + contract_volume?: string; + settlement_currency?: string; + max_order_volume?: string; + min_order_volume?: string; + leverage?: string; + price_precision?: number; + price_sl_level?: string; + swap_cost_type?: string; + buy_swap_cost_rate?: string; + sell_swap_cost_rate?: string; + swap_cost_3day?: string; + trade_timezone?: string; + trade_mode?: string; + icon_link?: string; + [key: string]: unknown; +} ⋮---- -/** General configuration for the WebsocketClient */ -export interface WSClientConfigurableOptions { - /** Your API key */ - apiKey?: string; - - /** Your API secret */ - apiSecret?: string; - - useTestnet?: boolean; - - /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ - recvWindow?: number; - - /** How often to check if the connection is alive */ - pingInterval?: number; - - /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ - pongTimeout?: number; - - /** Delay in milliseconds before respawning the connection */ - reconnectTimeout?: number; - - requestOptions?: {}; - - wsUrl?: string; - - wsOptions?: { - protocols?: string[]; - agent?: any; - } & ( - | Omit, 'agent'> - | Omit, 'agent'> - ); - - /** - * 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; - - /** - * If you authenticated the WS API before, automatically try to re-authenticate the WS API if you're disconnected/reconnected for any reason. - */ - reauthWSAPIOnReconnect?: boolean; +export interface TradFiKlineItem { + o?: string; + c?: string; + h?: string; + l?: string; + t?: number; } ⋮---- -/** Your API key */ +export interface TradFiTicker { + highest_price?: string; + lowest_price?: string; + price_change?: string; + price_change_amount?: string; + today_open_price?: string; + last_today_close_price?: string; + last_price?: string; + bid_price?: string; + ask_price?: string; + favorite?: boolean; + status?: string; + close_time?: number; + open_time?: number; + next_open_time?: number; + trade_mode?: string; + category_name?: string; +} ⋮---- -/** Your API secret */ +export interface TradFiCreateUserResult { + status?: number; + leverage?: number; + mt5_uid?: string; +} ⋮---- -/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ +export interface TradFiAssets { + equity?: string; + margin_level?: string; + balance?: string; + margin?: string; + margin_free?: string; + unrealized_pnl?: string; + mt5_uid?: string; +} ⋮---- -/** How often to check if the connection is alive */ +export interface TradFiTransactionRecord { + asset?: string; + type?: string; + type_desc?: string; + change?: string; + balance?: string; + time?: number; +} ⋮---- -/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ +export interface TradFiTransactionListData { + total?: number; + total_page?: number; + list?: TradFiTransactionRecord[]; +} ⋮---- -/** Delay in milliseconds before respawning the connection */ +export interface TradFiCreateOrderResult { + id?: 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 TradFiOrderItem { + order_id?: number; + symbol?: string; + symbol_desc?: string; + price_type?: string; + state?: number; + state_desc?: string; + finished?: number; + side?: number; + volume?: string; + price?: string; + price_tp?: string; + price_sl?: string; + time_setup?: number; +} ⋮---- -/** - * If you authenticated the WS API before, automatically try to re-authenticate the WS API if you're disconnected/reconnected for any reason. - */ +export interface TradFiOrderListData { + list?: TradFiOrderItem[]; + timestamp?: number; +} ⋮---- -/** - * WS configuration that's always defined, regardless of user configuration - * (usually comes from defaults if there's no user-provided values) - */ -export interface WebsocketClientOptions extends WSClientConfigurableOptions { - pingInterval: number; - pongTimeout: number; - reconnectTimeout: number; - recvWindow: number; - authPrivateConnectionsOnConnect: boolean; - authPrivateRequests: boolean; - reauthWSAPIOnReconnect: boolean; +export interface TradFiModifyOrderResult { + order_id?: number; + symbol?: string; + state?: string; + volume?: string; + price?: string; + price_tp?: string; + price_sl?: string; } - -================ -File: src/index.ts -================ -// Request Types ⋮---- -// Response Types +export interface TradFiOrderHistoryItem { + order_id?: number; + symbol?: string; + symbol_desc?: string; + price_type?: string; + order_opt_type?: number; + state?: number; + state_desc?: string; + side?: number; + volume?: string; + fill_volume?: string; + close_pnl?: string; + price?: string; + trigger_price?: string; + price_tp?: string; + price_sl?: string; + time_setup?: number; + time_done?: number; +} ⋮---- -// Websockets Types +export interface TradFiPositionItem { + position_id?: number; + symbol?: string; + symbol_desc?: string; + margin?: string; + unrealized_pnl?: string; + unrealized_pnl_rate?: string; + volume?: string; + price_open?: string; + position_dir?: string; + price_tp?: string; + price_sl?: string; + counterparty_price?: string; + time_create?: number; +} ⋮---- -// Shared Types - -================ -File: webpack/webpack.config.cjs -================ -function generateConfig(name) +export interface TradFiPositionListData { + list?: TradFiPositionItem[]; + timestamp?: number; +} ⋮---- -// Add '.ts' and '.tsx' as resolvable extensions. +export interface TradFiPositionHistoryItem { + position_id?: number; + symbol?: string; + realized_pnl?: string; + realized_pnl_rate?: string; + volume?: string; + volume_closed?: string; + price_open?: string; + position_dir?: string; + price_tp?: string; + price_sl?: string; + counterparty_price?: string; + close_price?: string; + time_create?: string; + time_close?: string; + position_status?: string; + close_detail?: Record | null; + realized_pnl_detail?: { + closed_pnl?: string; + swap?: string; + fee?: 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 +/** GET /tradfi/orders/log/{log_id} — v4.106.94 */ +export interface TradFiOrderLog { + order_id?: number; + log_id?: number; + symbol?: string; + price_type?: 'market' | 'trigger'; + state?: number; + side?: number; + volume?: string; + price?: string; + [key: string]: unknown; +} ⋮---- -// Code is already transpiled from TypeScript, no additional loaders needed +export interface TradFiSymbolCommissionItem { + category_code?: string; + symbol?: string; + fee_per_lot?: string; +} ================ -File: src/types/response/earn.ts +File: src/types/response/wallet.ts ================ -/**========================================================================================================================== - * EARN - * ========================================================================================================================== - */ -⋮---- -export interface DualInvestmentProduct { - id: number; - instrument_name: string; - invest_currency: string; - exercise_currency: string; - exercise_price: number; - delivery_time: number; - min_amount?: string; - min_copies: number; - max_copies: number; - /** @deprecated */ - per_value: string; - apy_display: string; - start_time: number; - end_time: number; - status: 'NOTSTARTED' | 'ONGOING' | 'ENDED'; +export interface CurrencyChain { + chain: string; + name_cn: string; + name_en: string; + contract_address: string; + is_disabled: number; + is_deposit_disabled: number; + is_withdraw_disabled: number; + decimal: string; } ⋮---- -/** @deprecated */ -⋮---- -/** GET /earn/dual/order-refund-preview */ -export interface DualOrderRefundPreview { - create_timest: number; - delivery_timest: number; - exercise_price: string; - invest_amount: string; - invest_currency: string; - name: string; - order_id: number; - req_id: string; - refund_service_charge: number; - settle_price: string; - settlement_amount: string; - settlement_currency: string; - settlement_interest: string; - settlement_principle: string; - type: string; - money_back_timest: number; +/** GET /wallet/sub_account_balances item */ +export interface SubAccountBalance { + uid: string; + available: { [key: string]: string }; + /** Locked amount per currency */ + locking?: { [key: string]: string }; } ⋮---- -/** GET /earn/dual/project-recommend item */ -export interface DualProjectRecommend { - id: number; - category: number; - type: string; - invest_currency: string; - exercise_currency: string; - apy_display: string; - exercise_price: string; - delivery_timest: number; - min_amount: string; - max_amount: string; - min_copies: number; - max_copies: number; - invest_days: number; - invest_hours: string; -} +/** Locked amount per currency */ ⋮---- -export interface DualInvestmentOrder { - id: number; - plan_id: number; - copies: string; - invest_amount: string; - settlement_amount: string; - create_time: number; - complete_time: number; +export interface DepositRecord { + id: string; + txid: string; + timestamp: string; + amount: string; + currency: string; + address: string; + memo?: string; status: - | 'INIT' - | 'SETTLEMENT_SUCCESS' - | 'SETTLEMENT_PROCESSING' - | 'CANCELED' - | 'FAILED'; - invest_currency: string; - exercise_currency: string; - exercise_price: string; - settlement_price: string; - settlement_currency: string; - apy_display: string; - apy_settlement: string; - delivery_time: number; - text: string; + | 'BLOCKED' // Deposit Blocked + | 'DEP_CREDITED' // Deposit Credited, Withdrawal Pending Unlock + | 'DONE' // Funds Credited to Spot Account + | 'INVALID' // Invalid Transaction + | 'MANUAL' // Manual Review Required + | 'PEND' // Processing + | 'REVIEW' // Under Compliance Review + | 'TRACK'; // Tracking Block Confirmations, Pending Spot Account Credit + chain: string; + refund_status?: // v4.106.95: Blocked deposit refund status + 'REFUNDING' | 'REFUNDED' | 'REFUND_FAILED' | 'REJECTED'; } ⋮---- -/**========================================================================================================================== - * EARN FIXED-TERM - * ========================================================================================================================== - */ -⋮---- -export interface FixedTermLadderApr { - apr: string; - left: string; - right: string; -} +| 'BLOCKED' // Deposit Blocked +| 'DEP_CREDITED' // Deposit Credited, Withdrawal Pending Unlock +| 'DONE' // Funds Credited to Spot Account +| 'INVALID' // Invalid Transaction +| 'MANUAL' // Manual Review Required +| 'PEND' // Processing +| 'REVIEW' // Under Compliance Review +| 'TRACK'; // Tracking Block Confirmations, Pending Spot Account Credit ⋮---- -export interface FixedTermProductInfo { - pre_redeem: number; - reinvest: number; - redeem_account: number; - min_vip: number; - max_vip: number; -} +refund_status?: // v4.106.95: Blocked deposit refund status ⋮---- -export interface FixedTermBonusInfo { - id?: number; - product_id?: number; - asset?: string; - bonus_asset?: string; - kyc_limit?: string; - ladder_apr?: FixedTermLadderApr[]; - total_bonus_amount?: string; - user_total_bonus_amount?: string; - status?: number; - start_time?: string; - end_time?: string; - create_time?: string; - start_at?: number; - end_at?: number; - total_issued_amount?: string; - user_total_issued_amount?: string; - bonus_asset_price?: string; - product_asset_price?: string; - product_year_rate?: string; +export interface CreateDepositAddressResp { + currency: string; + address: string; + multichain_addresses: { + chain: string; + address: string; + payment_id: string; + payment_name: string; + obtain_failed: number; + }[]; } ⋮---- -export interface FixedTermCouponInfo { - id?: number; - business?: number; - user_id?: number; - asset?: string; - order_id?: number; - financial_rate_id?: number; - buy_limit_low?: string; - buy_limit_high?: string; - rate_day?: number; - rate_ratio?: string; - coupon_days?: number; - coupon_principal?: string; - coupon_year_rate?: string; - coupon_interest?: string; - status?: number; - finish_time?: string; - create_time?: string; +export interface SubAccountTransferRecord { + currency: string; + sub_account: string; + direction: 'to' | 'from'; + amount: string; + uid: string; + client_order_id: string; + timest: string; + source: string; + sub_account_type: 'spot' | 'futures' | 'cross_margin' | 'delivery'; } ⋮---- -export interface FixedTermLendOrder { - id?: number; - business?: number; - order_id?: number; - user_id?: number; - asset?: string; - product_id?: number; - lock_up_period?: number; - principal?: string; - year_rate?: string; - product_type?: number; - interest?: string; - status?: number; - reinvest_status?: number; - redeem_account_type?: number; - origin_order?: string; - redeem_type?: number; - redeem_time?: string; - finish_time?: string; - create_time?: string; - year_rate_perent?: string; - total_year_rate_percent?: string; - total_interest?: string; - product_info?: FixedTermProductInfo; - bonus_info?: FixedTermBonusInfo; - coupon_info?: FixedTermCouponInfo; - redeem_at?: number; - finish_at?: number; - create_at?: number; - icon?: string; +export interface WithdrawalStatus { + currency: string; + name: string; + name_cn: string; + deposit: string; + withdraw_percent: string; + withdraw_fix: string; + withdraw_day_limit: string; + withdraw_amount_mini: string; + withdraw_day_limit_remain: string; + withdraw_eachtime_limit: string; + withdraw_fix_on_chains: { [key: string]: string }; + withdraw_percent_on_chains: { [key: string]: string }; } ⋮---- -export interface FixedTermProduct { - id?: number; - name?: string; - asset?: string; - lock_up_period?: number; - min_lend_amount?: string; - user_max_lend_amount?: string; - total_lend_amount?: string; - year_rate?: string; - type?: number; - pre_redeem?: number; - reinvest?: number; - redeem_account?: number; - min_vip?: number; - max_vip?: number; - status?: number; - create_time?: string; - user_max_lend_volume?: string; - user_total_amount?: string; - sale_status?: number; +export interface SubAccountMarginBalance { + currency_pair: string; + locked: boolean; + risk: string; + base: { + currency: string; + available: string; + locked: string; + borrowed: string; + interest: string; + }; + quote: { + currency: string; + available: string; + locked: string; + borrowed: string; + interest: string; + }; } ⋮---- -export interface FixedTermProductSimple { - id?: number; - asset?: string; - lock_up_period?: number; - year_rate?: string; - type?: number; - pre_redeem?: number; - reinvest?: number; - simple_earn?: number; - min_vip?: number; - max_vip?: number; - sale_status?: number; +export interface SubAccountFuturesBalancesResp { + uid: string; + available: { + [key: string]: { + total: string; + unrealised_pnl: string; + position_margin: string; + order_margin: string; + available: string; + point: string; + currency: string; + in_dual_mode: boolean; + enable_credit: boolean; + position_initial_margin: string; + maintenance_margin: string; + bonus: string; + enable_evolved_classic: boolean; + cross_order_margin: string; + cross_initial_margin: string; + cross_maintenance_margin: string; + cross_unrealised_pnl: string; + cross_available: string; + isolated_position_margin: string; + history: { + dnw: string; + pnl: string; + fee: string; + refr: string; + fund: string; + point_dnw: string; + point_fee: string; + point_refr: string; + bonus_dnw: string; + bonus_offset: string; + }; + }; + }; } ⋮---- -export interface GetEarnFixedTermProductsResponse { - code: number; - message: string; - data: { - list: FixedTermProduct[]; - total: number; +export interface SubAccountCrossMarginBalancesResp { + uid: string; + available: { + user_id: number; + locked: boolean; + balances: { + [key: string]: { + available: string; + freeze: string; + borrowed: string; + interest: string; + }; + }; + total: string; + borrowed: string; + borrowed_net: string; + net: string; + leverage: string; + interest: string; + risk: string; + total_initial_margin: string; + total_margin_balance: string; + total_maintenance_margin: string; + total_initial_margin_rate: string; + total_maintenance_margin_rate: string; + total_available_margin: string; }; - timestamp: number; } ⋮---- -export interface GetEarnFixedTermProductsByAssetResponse { - code: number; - message: string; - data: { - list: FixedTermProductSimple[]; - }; - timestamp: number; +export interface SavedAddress { + currency: string; + chain: string; + address: string; + name: string; + tag: string; + verified: string; } ⋮---- -export interface CreateEarnFixedTermLendResponse { - code?: number; - message?: string; - data?: { - order_id?: number; - }; - timestamp?: number; +export interface TradingFees { + user_id: number; + taker_fee: string; + maker_fee: string; + gt_discount: boolean; + gt_taker_fee: string; + gt_maker_fee: string; + loan_fee: string; + point_type: string; + futures_taker_fee: string; + futures_maker_fee: string; + delivery_taker_fee: string; + delivery_maker_fee: string; + debit_fee: number; } ⋮---- -export interface GetEarnFixedTermLendsResponse { - code: number; - message: string; - data: { - list: FixedTermLendOrder[]; - total: number; +export interface GetBalancesResp { + total: { + amount: string; + currency: string; + unrealised_pnl?: string; + borrowed?: string; + }; + details: { + [key: string]: { + amount: string; + currency: string; + unrealised_pnl?: string; + borrowed?: string; + }; }; - timestamp: number; } ⋮---- -export interface CreateEarnFixedTermPreRedeemResponse { - code?: number; - message?: string; - data?: Record; - timestamp?: number; +export interface SmallBalanceRecord { + currency: string; + available_balance: string; + estimated_as_btc: string; + convertible_to_gt: string; } ⋮---- -export interface FixedTermHistoryRecord { - id?: number; - order_id?: number; - user_id?: number; - asset?: string; - uniq_time?: string; - bonus_id?: number; - product_id?: number; - bonus_asset?: string; - total_principal?: string; - amount?: string; - asset_price?: string; - status?: number; - detail?: string; - create_time?: string; - create_at?: number; - lock_up_period?: number; +export interface SmallBalanceHistoryRecord { + id: string; + currency: string; + amount: string; + gt_amount: string; + create_time: number; } ⋮---- -export interface GetEarnFixedTermHistoryResponse { - code?: number; - message?: string; - data?: { - list?: FixedTermHistoryRecord[]; - total?: number; - }; - timestamp?: number; +export interface PushOrder { + id: string; + push_uid: number; + receive_uid: number; + currency: string; + amount: string; + create_time: number; + status: + | 'CREATING' + | 'PENDING' + | 'CANCELLING' + | 'CANCELLED' + | 'REFUSING' + | 'REFUSED' + | 'RECEIVING' + | 'RECEIVED'; + message: string; +} +⋮---- +/** GET /wallet/transfers — AccountTransferDetail */ +export interface AccountTransferDetail { + tx_id: string; + status: 'pending' | 'success' | 'fail'; + currency: string; + amount: string; + from_account: + | 'spot' + | 'margin' + | 'futures' + | 'delivery' + | 'options' + | 'unknown'; + to_account: + | 'spot' + | 'margin' + | 'futures' + | 'delivery' + | 'options' + | 'unknown'; + settle?: string | null; + currency_pair?: string | null; } +================ +File: src/index.ts +================ +// Request Types +⋮---- +// Response Types +⋮---- +// Websockets Types +⋮---- +// Shared Types + ================ File: src/types/response/spot.ts ================ @@ -12608,1135 +12598,863 @@ export interface LeverageFailedCurrency { } ================ -File: src/types/request/futures.ts +File: src/lib/BaseRestClient.ts ================ -/**========================================================================================================================== - * FUTURES - * ========================================================================================================================== +import axios, { AxiosRequestConfig, AxiosResponse, Method } from 'axios'; +// NOTE: https.Agent is Node.js-only and not available in browser environments +// Browser builds (via webpack) exclude this module - see webpack.config.js fallback settings +import https from 'https'; +⋮---- +import { neverGuard } from './misc-util.js'; +import { + CHANNEL_ID, + getRestBaseUrl, + RestClientOptions, + serializeParams, +} from './requestUtils.js'; +import { + checkWebCryptoAPISupported, + hashMessage, + SignAlgorithm, + SignEncodeMethod, + signMessage, +} from './webCryptoAPI.js'; +⋮---- +/** + * Used to switch how authentication/requests work under the hood */ ⋮---- -export interface GetFuturesOrderBookReq { - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - interval?: string; - limit?: number; - with_id?: boolean; -} +export type RestClientType = + (typeof REST_CLIENT_TYPE_ENUM)[keyof typeof REST_CLIENT_TYPE_ENUM]; ⋮---- -export interface GetFuturesTradesReq { - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - limit?: number; - offset?: number; - last_id?: string; - from?: number; - to?: number; +interface SignedRequest { + originalParams: T; + paramsWithSign?: T & { sign: string }; + serializedParams: string; + sign: string; + queryParamsWithSign: string; + timestamp: number; + recvWindow: number; } ⋮---- -export interface GetFuturesCandlesReq { - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - from?: number; - to?: number; - limit?: number; - interval?: string; +interface UnsignedRequest { + originalParams: T; + paramsWithSign: T; } ⋮---- -export interface GetFuturesStatsReq { - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - from?: number; - interval?: string; - limit?: number; -} +type SignMethod = 'gateV4'; ⋮---- -export interface GetFundingRatesReq { - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - limit?: number; - from?: number; - to?: number; -} +/** + * Some requests require some params to be in the query string and some in the body. Some even support passing params via headers. + * This type anticipates these are possible in any combination. + * + * The request builder will automatically handle where parameters should go. + */ +type ParamsInQueryBodyOrHeader = { + query?: object; + body?: object; + headers?: object; + /** multipart/form-data body; mutually exclusive with `body` */ + multipart?: FormData; +}; ⋮---- -export interface BatchFundingRatesReq { - settle: 'btc' | 'usdt'; - contracts: string[]; -} +/** multipart/form-data body; mutually exclusive with `body` */ +⋮---- +/** + * Enables: + * - Detailed request/response logging + * - Full request dump in any exceptions thrown from API responses + */ +⋮---- +// request: { +// url: response.config.url, +// method: response.config.method, +// data: response.config.data, +// headers: response.config.headers, +// }, ⋮---- -export interface GetLiquidationHistoryReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - from?: number; - to?: number; - limit?: number; -} +/** + * Impure, mutates params to remove any values that have a key but are undefined. + */ +function deleteUndefinedValues(params?: any): void ⋮---- -export interface GetRiskLimitTiersReq { - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - limit?: number; - offset?: number; -} +export abstract class BaseRestClient ⋮---- -export interface GetRiskLimitTableReq { - settle: 'btc' | 'usdt' | 'usd'; - table_id: string; -} +/** Defines the client type (affecting how requests & signatures behave) */ +abstract getClientType(): RestClientType; ⋮---- -export interface GetFuturesAccountBookReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - limit?: number; - offset?: number; - from?: number; - to?: number; - type?: - | 'dnw' - | 'pnl' - | 'fee' - | 'refr' - | 'fund' - | 'point_dnw' - | 'point_fee' - | 'point_refr' - | 'bonus_offset'; -} +/** + * Create an instance of the REST client. Pass API credentials in the object in the first parameter. + * @param {RestClientOptions} [restClientOptions={}] options to configure REST API connectivity + * @param {AxiosRequestConfig} [networkOptions={}] HTTP networking options for axios + */ +constructor( + restClientOptions: RestClientOptions = {}, + networkOptions: AxiosRequestConfig = {}, +) ⋮---- -export interface GetFuturesPositionsReq { - settle: 'btc' | 'usdt' | 'usd'; - holding?: boolean; - limit?: number; // deprecated, use positions_limit instead - positions_limit?: number; // v4.106.104: Replaces limit; omit to return full list, explicit values capped at 1-100 - offset?: number; - position_side?: string; // v4.105.3: Add position_side parameter for hedge mode support - hedge_mode?: boolean; // v4.104.3: Add hedge_mode parameter -} +/** Throw errors if any request params are empty */ ⋮---- -limit?: number; // deprecated, use positions_limit instead -positions_limit?: number; // v4.106.104: Replaces limit; omit to return full list, explicit values capped at 1-100 +/** in ms == 5 minutes by default */ ⋮---- -position_side?: string; // v4.105.3: Add position_side parameter for hedge mode support -hedge_mode?: boolean; // v4.104.3: Add hedge_mode parameter +/** inject custom rquest options based on axios specs - see axios docs for more guidance on AxiosRequestConfig: https://github.com/axios/axios#request-config */ ⋮---- -export interface UpdateDualModePositionMarginReq { - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - change: string; - dual_side: 'dual_long' | 'dual_short'; -} +// If enabled, configure a https agent with keepAlive enabled +// NOTE: This is Node.js-only functionality. In browser environments, this code is skipped +// as the 'https' module is excluded via webpack fallback configuration. +// Browser connection pooling is handled automatically by the browser itself. ⋮---- -export interface UpdateDualModePositionLeverageReq { - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - leverage: string; - cross_leverage_limit?: string; -} +// Extract existing https agent parameters, if provided, to prevent the keepAlive flag from overwriting an existing https agent completely ⋮---- -export interface SubmitFuturesOrderReq { - xGateExptime?: number; - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - size: number; - iceberg?: number; - price?: string; - close?: boolean; - reduce_only?: boolean; - tif?: string; - text?: string; - auto_size?: string; - stp_act?: string; - action_mode?: 'ACK' | 'RESULT' | 'FULL'; - tpsl_tp_trigger_price?: string; - tpsl_sl_trigger_price?: string; - pos_margin_mode?: 'isolated' | 'cross'; -} +// For more advanced configuration, raise an issue on GitHub or use the "networkOptions" +// parameter to define a custom httpsAgent with the desired properties ⋮---- -export interface GetFuturesOrdersReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - status: string; - limit?: number; - offset?: number; - last_id?: string; -} +// Check Web Crypto API support when credentials are provided and no custom sign function is used ⋮---- -export interface DeleteAllFuturesOrdersReq { - xGateExptime?: number; - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - side?: string; - action_mode?: 'ACK' | 'RESULT' | 'FULL'; -} +// Throw if one of the 3 values is missing, but at least one of them is set ⋮---- -export interface GetFuturesOrdersByTimeRangeReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - from?: number; - to?: number; - limit?: number; - offset?: number; -} +/** + * Timestamp used to sign the request. Override this method to implement your own timestamp/sync mechanism + */ +getSignTimestampMs(): number ⋮---- -export interface UpdateFuturesOrderReq { - xGateExptime?: number; - settle: 'btc' | 'usdt' | 'usd'; - order_id: string; - size?: number; - price?: string; - amend_text?: string; -} +protected get(endpoint: string, params?: object) ⋮---- -export interface GetFuturesTradingHistoryReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - order?: number; - limit?: number; - offset?: number; - last_id?: string; -} +// GET only supports params in the query string ⋮---- -export interface GetFuturesTradingHistoryByTimeRangeReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - from?: number; - to?: number; - limit?: number; - offset?: number; - role?: 'maker' | 'taker'; -} +protected post(endpoint: string, params?: ParamsInQueryBodyOrHeader) ⋮---- -export interface GetFuturesPositionHistoryReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - limit?: number; - offset?: number; - from?: number; - to?: number; - side?: 'long' | 'short'; - pnl?: string; -} +protected getPrivate(endpoint: string, params?: object) ⋮---- -export interface GetFuturesLiquidationHistoryReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - limit?: number; - at?: number; -} +// GET only supports params in the query string ⋮---- -export interface SubmitFuturesTriggeredOrderReq { - initial: { - contract: string; - size?: number; - /** Decimal contract size; if both `size` and `amount` are set, `amount` takes precedence */ - amount?: string; - price: string; // Required: Order price. Set to 0 to use market price - close?: boolean; - tif?: 'gtc' | 'ioc'; - text?: string; - reduce_only?: boolean; - auto_size?: string; - }; - trigger: { - strategy_type?: 0 | 1; - price_type?: 0 | 1 | 2; - price: string; // Required: Price value for price trigger - rule: 1 | 2; // Required: Price Condition Type (1: >=, 2: <=) - expiration?: number; - }; - order_type?: - | 'close-long-order' - | 'close-short-order' - | 'close-long-position' - | 'close-short-position' - | 'plan-close-long-position' - | 'plan-close-short-position'; - settle: 'btc' | 'usdt' | 'usd'; -} +protected postPrivate(endpoint: string, params?: ParamsInQueryBodyOrHeader) ⋮---- -/** Decimal contract size; if both `size` and `amount` are set, `amount` takes precedence */ +/** POST private endpoint with multipart/form-data (empty body hash for signing) */ +protected postPrivateMultipart( + endpoint: string, + formData: FormData, + query?: object, +) ⋮---- -price: string; // Required: Order price. Set to 0 to use market price +protected deletePrivate( + endpoint: string, + params?: ParamsInQueryBodyOrHeader, +) ⋮---- -price: string; // Required: Price value for price trigger -rule: 1 | 2; // Required: Price Condition Type (1: >=, 2: <=) +protected putPrivate(endpoint: string, params?: ParamsInQueryBodyOrHeader) ⋮---- -export interface GetFuturesAutoOrdersReq { - settle: 'btc' | 'usdt' | 'usd'; - status: 'open' | 'finished'; - contract?: string; - limit?: number; - offset?: number; -} +// protected patchPrivate(endpoint: string, params?: any) { +protected patchPrivate(endpoint: string, params?: ParamsInQueryBodyOrHeader) ⋮---- /** - * Modify contract order parameters - */ -export interface BatchAmendOrderReq { - order_id?: number; // Order id, order_id and text must contain at least one - text?: string; // User-defined order text, at least one of order_id and text must be passed - size?: number; // The new order size, including the executed order size - price?: string; // New order price - amend_text?: string; // Custom info during amending order -} -⋮---- -order_id?: number; // Order id, order_id and text must contain at least one -text?: string; // User-defined order text, at least one of order_id and text must be passed -size?: number; // The new order size, including the executed order size -price?: string; // New order price -amend_text?: string; // Custom info during amending order + * @private Make a HTTP request to a specific endpoint. Private endpoint API calls are automatically signed. + */ +private async _call( + method: Method, + endpoint: string, + params?: ParamsInQueryBodyOrHeader, + isPublicApi?: boolean, +): Promise ⋮---- -// v4.105.8: New GET /futures/{settle}/position_close_history endpoint request -export interface GetFuturesPositionCloseHistoryReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - limit?: number; - offset?: number; - from?: number; - to?: number; -} +// Sanity check to make sure it's only ever prefixed by one forward slash ⋮---- -// v4.104.6: New GET /futures/{settle}/insurance endpoint request -export interface GetFuturesInsuranceReq { - settle: 'btc' | 'usdt' | 'usd'; - limit?: number; -} +// Build a request and handle signature process ⋮---- -export interface UpdateFuturesPriceTriggeredOrderReq { - settle: 'btc' | 'usdt' | 'usd'; - order_id: number | string; - contract?: string; - size?: number; - /** Same semantics as `size` (decimal contract size) */ - amount?: string; - price?: string; - /** When fully closing in single-position mode, set true */ - close?: boolean; - trigger_price?: string; - price_type?: 0 | 1 | 2; // 0 - Latest trade price, 1 - Mark price, 2 - Index price - auto_size?: string; // Not required in single position mode -} +// Dispatch request ⋮---- -/** Same semantics as `size` (decimal contract size) */ +// See: https://www.gate.io/docs/developers/apiv4/en/#return-format ⋮---- -/** When fully closing in single-position mode, set true */ +// Throw API rejections by parsing the response code from the body ⋮---- -price_type?: 0 | 1 | 2; // 0 - Latest trade price, 1 - Mark price, 2 - Index price -auto_size?: string; // Not required in single position mode +/** + * @private generic handler to parse request exceptions + */ +parseException(e: any, request: AxiosRequestConfig): unknown ⋮---- -/** GET /futures/{settle}/get_leverage/{contract} — v4.106.43: pos_margin_mode and dual_side required */ -export interface GetFuturesContractLeverageReq { - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - pos_margin_mode: 'isolated' | 'cross'; - dual_side: 'dual_long' | 'dual_short'; -} +// Something happened in setting up the request that triggered an error ⋮---- -/** Trail order (autoorder/v1/trail) request types */ -export interface CreateTrailOrderReq { - settle: 'btc' | 'usdt'; - contract: string; - amount: string; - activation_price?: string; - is_gte?: boolean; - price_type?: 1 | 2 | 3; - price_offset?: string; - reduce_only?: boolean; - position_related?: boolean; - text?: string; - pos_margin_mode?: string; - position_mode?: string; -} +// request made but no response received ⋮---- -export interface TerminateTrailOrderReq { - settle: 'btc' | 'usdt'; - id?: number; - text?: string; -} +// The request was made and the server responded with a status code +// that falls out of the range of 2xx ⋮---- -export interface BatchTerminateTrailOrdersReq { - settle: 'btc' | 'usdt'; - contract?: string; - related_position?: 1 | 2; -} +// console.error('err: ', response?.data); ⋮---- -export interface GetTrailOrderListReq { - settle: 'btc' | 'usdt'; - contract?: string; - is_finished?: boolean; - start_at?: number; - end_at?: number; - page_num?: number; - page_size?: number; - sort_by?: 1 | 2; - hide_cancel?: boolean; - related_position?: 1 | 2; - sort_by_trigger?: boolean; - reduce_only?: 1 | 2; - side?: 1 | 2; -} +// Prevent credentials from leaking into error messages ⋮---- -export interface GetTrailOrderDetailReq { - settle: 'btc' | 'usdt'; - id: number; -} +/** + * @private sign request and set recv window + */ +private async signRequest< + T extends ParamsInQueryBodyOrHeader | undefined = {}, + >( + data: T, + endpoint: string, + method: Method, + signMethod: SignMethod, +): Promise> ⋮---- -export interface UpdateTrailOrderReq { - settle: 'btc' | 'usdt'; - id: number; - amount?: string; - activation_price?: string; - is_gte_str?: string; - price_type?: 0 | 1 | 2 | 3; - price_offset?: string; -} +const timestamp = +(this.getSignTimestampMs() / 1000).toFixed(0); // in seconds ⋮---- -export interface GetTrailOrderChangeLogReq { - settle: 'btc' | 'usdt'; - id: number; - page_num?: number; - page_size?: number; -} +// recvWindow: this.options.recvWindow, ⋮---- -/** Chase limit order (autoorder/v1/chase) request types */ -export interface CreateChaseOrderReq { - settle: 'btc' | 'usdt' | 'usd'; - contract: string; - amount: string; - price_limit: string; - offset_limit?: string; - reduce_only?: boolean; - text?: string; - is_dual_mode?: boolean; - price_type?: number; - price_gap_type?: number; - price_gap_value?: string; - pos_margin_mode?: 'isolated' | 'cross' | string; - position_mode?: string; -} +// It's possible to override the recv window on a per rquest level ⋮---- -export interface StopChaseOrderReq { - settle: 'btc' | 'usdt' | 'usd'; - id?: string; - text?: string; -} +// console.log('sign params: ', { +// requestBodyToHash, +// paramsStr: toSign, +// url: this.baseUrl, +// urlPath: this.baseUrlPath, +// }); ⋮---- -export interface StopAllChaseOrdersReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - pos_margin_mode?: 'isolated' | 'cross' | string; -} +private async signMessage( + paramsStr: string, + secret: string, + method: 'hex' | 'base64', + algorithm: SignAlgorithm, +): Promise ⋮---- -export interface GetChaseOrdersReq { - settle: 'btc' | 'usdt' | 'usd'; - contract?: string; - is_finished?: boolean; - start_at?: number; - end_at?: number; - page_num?: number; - page_size?: number; - /** 1 ORDER_SORT_CREATED_AT, 2 ORDER_SORT_FINISHED_AT */ - sort_by: 1 | 2; - hide_cancel?: boolean; - reduce_only?: 0 | 1 | 2; - side?: 0 | 1 | 2; -} +private async prepareSignParams< + TParams extends ParamsInQueryBodyOrHeader | undefined, + >( + method: Method, + endpoint: string, + signMethod: SignMethod, + params?: TParams, + isPublicApi?: true, + ): Promise>; ⋮---- -/** 1 ORDER_SORT_CREATED_AT, 2 ORDER_SORT_FINISHED_AT */ +private async prepareSignParams< + TParams extends ParamsInQueryBodyOrHeader | undefined, + >( + method: Method, + endpoint: string, + signMethod: SignMethod, + params?: TParams, + isPublicApi?: false | undefined, + ): Promise>; ⋮---- -export interface GetChaseOrderDetailReq { - settle: 'btc' | 'usdt' | 'usd'; - id: string; -} +private async prepareSignParams< + TParams extends ParamsInQueryBodyOrHeader | undefined, + >( + method: Method, + endpoint: string, + signMethod: SignMethod, + params?: TParams, + isPublicApi?: boolean, +) +⋮---- +/** Returns an axios request object. Handles signing process automatically if this is a private API call */ +private async buildRequest( + method: Method, + endpoint: string, + url: string, + params?: ParamsInQueryBodyOrHeader, + isPublicApi?: boolean, +): Promise ================ -File: src/types/response/futures.ts +File: src/types/request/futures.ts ================ /**========================================================================================================================== * FUTURES - * ========================================================================================================================== - */ -⋮---- -export interface FuturesOrderBook { - id?: number; - current: number; - update: number; - asks: { p: string; s: number }[]; - bids: { p: string; s: number }[]; -} -⋮---- -export interface FuturesTrade { - id: number; - create_time: number; - create_time_ms: number; - contract: string; - size: number; - price: string; - is_internal?: boolean; // Deprecated -} -⋮---- -is_internal?: boolean; // Deprecated -⋮---- -export interface FuturesCandle { - t: number; - v?: number; - c: string; - h: string; - l: string; - o: string; - sum: string; -} + * ========================================================================================================================== + */ ⋮---- -export interface PremiumIndexKLine { - t: number; - c: string; - h: string; - l: string; - o: string; +export interface GetFuturesOrderBookReq { + settle: 'btc' | 'usdt' | 'usd'; + contract: string; + interval?: string; + limit?: number; + with_id?: boolean; } ⋮---- -export interface FuturesTicker { +export interface GetFuturesTradesReq { + settle: 'btc' | 'usdt' | 'usd'; contract: string; - last: string; - change_percentage: string; - total_size: string; - low_24h: string; - high_24h: string; - volume_24h: string; - volume_24h_btc?: string; - volume_24h_usd?: string; - volume_24h_base: string; - volume_24h_quote: string; - volume_24h_settle: string; - mark_price: string; - funding_rate: string; - funding_rate_indicative: string; - index_price: string; - quanto_base_rate?: string; // Deprecated - basis_rate: string; - basis_value: string; - lowest_ask: string; - highest_bid: string; - lowest_size: string; - highest_size: string; + limit?: number; + offset?: number; + last_id?: string; + from?: number; + to?: number; } ⋮---- -quanto_base_rate?: string; // Deprecated +export interface GetFuturesCandlesReq { + settle: 'btc' | 'usdt' | 'usd'; + contract: string; + from?: number; + to?: number; + limit?: number; + interval?: string; +} ⋮---- -export interface BatchFundingRatesResponse { - contract?: string; - data?: { t: number; r: string }[]; +export interface GetFuturesStatsReq { + settle: 'btc' | 'usdt' | 'usd'; + contract: string; + from?: number; + interval?: string; + limit?: number; } ⋮---- -export interface FuturesStats { - time: number; - lsr_taker: number; - lsr_account: number; - long_liq_size: number; - long_liq_amount: number; - long_liq_usd: number; - long_liq_usd_new?: number; - short_liq_size: number; - short_liq_amount: number; - short_liq_usd: number; - short_liq_usd_new?: number; - open_interest: number; - open_interest_usd: number; - top_lsr_account: number; - top_lsr_size: number; - top_long_size?: number; - top_short_size?: number; - long_taker_size?: number; - short_taker_size?: number; - top_long_account?: number; - top_short_account?: number; - long_users?: number; - short_users?: number; +export interface GetFundingRatesReq { + settle: 'btc' | 'usdt' | 'usd'; + contract: string; + limit?: number; + from?: number; + to?: number; } ⋮---- -export interface IndexConstituents { - index: string; - constituents: { - exchange: string; - symbols: string[]; - }[]; +export interface BatchFundingRatesReq { + settle: 'btc' | 'usdt'; + contracts: string[]; } ⋮---- -export interface LiquidationHistoryRecord { - time: number; - contract: string; - size: number; - order_size: number; - order_price: string; - fill_price: string; - left: number; +export interface GetLiquidationHistoryReq { + settle: 'btc' | 'usdt' | 'usd'; + contract?: string; + from?: number; + to?: number; + limit?: number; } ⋮---- -export interface RiskLimitTier { - tier: number; - risk_limit: string; - initial_rate: string; - maintenance_rate: string; // First-tier maintenance margin rate requirement - leverage_max: string; +export interface GetRiskLimitTiersReq { + settle: 'btc' | 'usdt' | 'usd'; contract: string; + limit?: number; + offset?: number; } ⋮---- -maintenance_rate: string; // First-tier maintenance margin rate requirement -⋮---- -export interface FuturesAccount { - total: string; // Balance, only applicable to classic contract account - unrealised_pnl: string; - position_margin?: string; // Deprecated - order_margin: string; // Initial margin for all pending orders - available: string; - point: string; - currency: string; - in_dual_mode: boolean; - position_mode?: string; // Position mode: single - one-way, dual - dual-side, split - sub-positions (in_dual_mode is deprecated) - enable_credit: boolean; - position_initial_margin: string; - maintenance_margin: string; - bonus: string; - enable_evolved_classic?: boolean; // Deprecated - cross_order_margin: string; - cross_initial_margin: string; - cross_maintenance_margin: string; - cross_unrealised_pnl: string; - cross_available: string; - cross_margin_balance: string; - cross_mmr: string; - cross_imr: string; - isolated_position_margin: string; - enable_new_dual_mode?: boolean; // Deprecated - margin_mode: number; // 0: classic future account or Classic Spot Margin Mode of unified account; 1: Multi-Currency Margin Mode; 2: Portfolio Margin Mode; 3: Single-Currency Margin Mode - history: { - dnw: string; - pnl: string; - fee: string; - refr: string; - fund: string; - point_dnw: string; - point_fee: string; - point_refr: string; - bonus_dnw: string; - bonus_offset: string; - }; - enable_tiered_mm: boolean; - funding_balance?: string; +export interface GetRiskLimitTableReq { + settle: 'btc' | 'usdt' | 'usd'; + table_id: string; } ⋮---- -total: string; // Balance, only applicable to classic contract account -⋮---- -position_margin?: string; // Deprecated -order_margin: string; // Initial margin for all pending orders +export interface GetFuturesAccountBookReq { + settle: 'btc' | 'usdt' | 'usd'; + contract?: string; + limit?: number; + offset?: number; + from?: number; + to?: number; + type?: + | 'dnw' + | 'pnl' + | 'fee' + | 'refr' + | 'fund' + | 'point_dnw' + | 'point_fee' + | 'point_refr' + | 'bonus_offset'; +} ⋮---- -position_mode?: string; // Position mode: single - one-way, dual - dual-side, split - sub-positions (in_dual_mode is deprecated) +export interface GetFuturesPositionsReq { + settle: 'btc' | 'usdt' | 'usd'; + holding?: boolean; + limit?: number; // deprecated, use positions_limit instead + positions_limit?: number; // v4.106.104: Replaces limit; omit to return full list, explicit values capped at 1-100 + offset?: number; + position_side?: string; // v4.105.3: Add position_side parameter for hedge mode support + hedge_mode?: boolean; // v4.104.3: Add hedge_mode parameter +} ⋮---- -enable_evolved_classic?: boolean; // Deprecated +limit?: number; // deprecated, use positions_limit instead +positions_limit?: number; // v4.106.104: Replaces limit; omit to return full list, explicit values capped at 1-100 ⋮---- -enable_new_dual_mode?: boolean; // Deprecated -margin_mode: number; // 0: classic future account or Classic Spot Margin Mode of unified account; 1: Multi-Currency Margin Mode; 2: Portfolio Margin Mode; 3: Single-Currency Margin Mode +position_side?: string; // v4.105.3: Add position_side parameter for hedge mode support +hedge_mode?: boolean; // v4.104.3: Add hedge_mode parameter ⋮---- -export interface FuturesAccountBookRecord { - time: number; +export interface UpdateDualModePositionMarginReq { + settle: 'btc' | 'usdt' | 'usd'; + contract: string; change: string; - balance: string; - type: string; - text: string; - contract?: string; - trade_id: string; - id: string; + dual_side: 'dual_long' | 'dual_short'; } ⋮---- -export interface FuturesOrder { - id?: number; - user?: number; - create_time?: number; - finish_time?: number; - /** - * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). - */ - finish_as?: - | 'filled' - | 'cancelled' - | 'liquidated' - | 'ioc' - | 'poc' - | 'auto_deleveraged' - | 'reduce_only' - | 'position_closed' - | 'stp'; - status?: 'open' | 'finished'; +export interface UpdateDualModePositionLeverageReq { + settle: 'btc' | 'usdt' | 'usd'; + contract: string; + leverage: string; + cross_leverage_limit?: string; +} +⋮---- +export interface SubmitFuturesOrderReq { + xGateExptime?: number; + settle: 'btc' | 'usdt' | 'usd'; contract: string; size: number; iceberg?: number; price?: string; close?: boolean; - is_close?: boolean; reduce_only?: boolean; - is_reduce_only?: boolean; - is_liq?: boolean; - tif?: 'gtc' | 'ioc' | 'poc' | 'fok'; - left?: number; - fill_price?: string; + tif?: string; text?: string; - tkfr?: string; - mkfr?: string; - refu?: number; - auto_size?: 'close_long' | 'close_short'; - stp_id?: number; - stp_act?: 'cn' | 'co' | 'cb' | '-'; - amend_text?: string; - biz_info?: string; - /** Read-only; order notional in settle currency (API response only; omit from order requests). */ - order_value?: string; - /** Read-only; traded value (API response only; omit from order requests). */ - trade_value?: string; + auto_size?: string; + stp_act?: string; action_mode?: 'ACK' | 'RESULT' | 'FULL'; tpsl_tp_trigger_price?: string; tpsl_sl_trigger_price?: string; - tpsl_tp_bbo_type?: string; // v4.106.93: BBO price type for take-profit leg - tpsl_sl_bbo_type?: string; // v4.106.93: BBO price type for stop-loss leg - pos_margin_mode?: string; + pos_margin_mode?: 'isolated' | 'cross'; } ⋮---- -/** - * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). - */ -⋮---- -/** Read-only; order notional in settle currency (API response only; omit from order requests). */ +export interface GetFuturesOrdersReq { + settle: 'btc' | 'usdt' | 'usd'; + contract?: string; + status: string; + limit?: number; + offset?: number; + last_id?: string; +} ⋮---- -/** Read-only; traded value (API response only; omit from order requests). */ +export interface DeleteAllFuturesOrdersReq { + xGateExptime?: number; + settle: 'btc' | 'usdt' | 'usd'; + contract: string; + side?: string; + action_mode?: 'ACK' | 'RESULT' | 'FULL'; +} ⋮---- -tpsl_tp_bbo_type?: string; // v4.106.93: BBO price type for take-profit leg -tpsl_sl_bbo_type?: string; // v4.106.93: BBO price type for stop-loss leg +export interface GetFuturesOrdersByTimeRangeReq { + settle: 'btc' | 'usdt' | 'usd'; + contract?: string; + from?: number; + to?: number; + limit?: number; + offset?: number; +} ⋮---- -/** Item shape for `GET /futures/{settle}/orders_timerange` (differs from {@link FuturesOrder} in field types). */ -export interface FuturesOrderTimerange { - id?: number; - user?: number; - create_time?: number; - update_time?: string; - finish_time?: string; - contract: string; - size: string; - iceberg?: string; - is_close?: boolean; - is_reduce_only?: boolean; - is_liq?: boolean; - left?: string; - fill_price?: string; - tkfr?: string; - mkfr?: string; - refu?: number; +export interface UpdateFuturesOrderReq { + xGateExptime?: number; + settle: 'btc' | 'usdt' | 'usd'; + order_id: string; + size?: number; + price?: string; amend_text?: string; - pid?: number; - market_order_slip_ratio?: string; - pos_margin_mode?: string; } ⋮---- -export interface FuturesPosition { - user?: number; +export interface GetFuturesTradingHistoryReq { + settle: 'btc' | 'usdt' | 'usd'; contract?: string; - size?: number; - leverage?: string; // Isolated margin leverage, 0 indicates cross margin mode - risk_limit?: string; - leverage_max?: string; // Max leverage based on current position size - maintenance_rate?: string; // Tiered maintenance margin rate calculation - value?: string; - margin?: string; - entry_price?: string; - liq_price?: string; // Estimated liquidation price for reference only - liquidation_price?: string; // v4.105.7: Add liquidation_price field for better risk management - mark_price?: string; - initial_margin?: string; // Expanded scope description - maintenance_margin?: string; // Expanded scope description - unrealised_pnl?: string; - realised_pnl?: string; // Detailed breakdown including settlement, funding fees, and trading fees - pnl_pnl?: string; // Settlement P&L - pnl_fund?: string; // Funding fee P&L - pnl_fee?: string; // Total trading fees - history_pnl?: string; // All historical settlement P&L - last_close_pnl?: string; - realised_point?: string; - history_point?: string; - adl_ranking?: number; - pending_orders?: number; - close_order?: { - id?: number; - price?: string; - is_liq?: boolean; - } | null; - mode?: 'single' | 'dual_long' | 'dual_short'; - cross_leverage_limit?: string; // Simplified description - update_time?: number; - update_id?: number; - open_time?: number; - settlement_currency?: string; // v4.105.9: Add settlement_currency field for multi-settlement support - isolated_margin?: string; // v4.104.6: Add isolated_margin field - pid?: number; // v4.106.0: Sub-position ID - hedge_status?: 'partial_hedged' | 'full_hedged'; // v4.106.97: Delta-neutral hedging status - hedged_size?: string; // v4.106.97: Hedged size under Delta-neutral strategy - unhedged_size?: string; // v4.106.97: Unhedged size under Delta-neutral strategy + order?: number; + limit?: number; + offset?: number; + last_id?: string; } ⋮---- -leverage?: string; // Isolated margin leverage, 0 indicates cross margin mode +export interface GetFuturesTradingHistoryByTimeRangeReq { + settle: 'btc' | 'usdt' | 'usd'; + contract?: string; + from?: number; + to?: number; + limit?: number; + offset?: number; + role?: 'maker' | 'taker'; +} ⋮---- -leverage_max?: string; // Max leverage based on current position size -maintenance_rate?: string; // Tiered maintenance margin rate calculation +export interface GetFuturesPositionHistoryReq { + settle: 'btc' | 'usdt' | 'usd'; + contract?: string; + limit?: number; + offset?: number; + from?: number; + to?: number; + side?: 'long' | 'short'; + pnl?: string; +} ⋮---- -liq_price?: string; // Estimated liquidation price for reference only -liquidation_price?: string; // v4.105.7: Add liquidation_price field for better risk management +export interface GetFuturesLiquidationHistoryReq { + settle: 'btc' | 'usdt' | 'usd'; + contract?: string; + limit?: number; + at?: number; +} ⋮---- -initial_margin?: string; // Expanded scope description -maintenance_margin?: string; // Expanded scope description +export interface SubmitFuturesTriggeredOrderReq { + initial: { + contract: string; + size?: number; + /** Decimal contract size; if both `size` and `amount` are set, `amount` takes precedence */ + amount?: string; + price: string; // Required: Order price. Set to 0 to use market price + close?: boolean; + tif?: 'gtc' | 'ioc'; + text?: string; + reduce_only?: boolean; + auto_size?: string; + }; + trigger: { + strategy_type?: 0 | 1; + price_type?: 0 | 1 | 2; + price: string; // Required: Price value for price trigger + rule: 1 | 2; // Required: Price Condition Type (1: >=, 2: <=) + expiration?: number; + }; + order_type?: + | 'close-long-order' + | 'close-short-order' + | 'close-long-position' + | 'close-short-position' + | 'plan-close-long-position' + | 'plan-close-short-position'; + settle: 'btc' | 'usdt' | 'usd'; +} ⋮---- -realised_pnl?: string; // Detailed breakdown including settlement, funding fees, and trading fees -pnl_pnl?: string; // Settlement P&L -pnl_fund?: string; // Funding fee P&L -pnl_fee?: string; // Total trading fees -history_pnl?: string; // All historical settlement P&L +/** Decimal contract size; if both `size` and `amount` are set, `amount` takes precedence */ ⋮---- -cross_leverage_limit?: string; // Simplified description +price: string; // Required: Order price. Set to 0 to use market price ⋮---- -settlement_currency?: string; // v4.105.9: Add settlement_currency field for multi-settlement support -isolated_margin?: string; // v4.104.6: Add isolated_margin field -pid?: number; // v4.106.0: Sub-position ID -hedge_status?: 'partial_hedged' | 'full_hedged'; // v4.106.97: Delta-neutral hedging status -hedged_size?: string; // v4.106.97: Hedged size under Delta-neutral strategy -unhedged_size?: string; // v4.106.97: Unhedged size under Delta-neutral strategy +price: string; // Required: Price value for price trigger +rule: 1 | 2; // Required: Price Condition Type (1: >=, 2: <=) ⋮---- -export interface FuturesTradingHistoryRecord { - id: number; - create_time: number; - contract: string; - order_id: string; - size: number; - price: string; - role: 'taker' | 'maker'; - text: string; - fee: string; - point_fee: string; - close_size: number; +export interface GetFuturesAutoOrdersReq { + settle: 'btc' | 'usdt' | 'usd'; + status: 'open' | 'finished'; + contract?: string; + limit?: number; + offset?: number; +} +⋮---- +/** + * Modify contract order parameters + */ +export interface BatchAmendOrderReq { + order_id?: number; // Order id, order_id and text must contain at least one + text?: string; // User-defined order text, at least one of order_id and text must be passed + size?: number; // The new order size, including the executed order size + price?: string; // New order price + amend_text?: string; // Custom info during amending order +} +⋮---- +order_id?: number; // Order id, order_id and text must contain at least one +text?: string; // User-defined order text, at least one of order_id and text must be passed +size?: number; // The new order size, including the executed order size +price?: string; // New order price +amend_text?: string; // Custom info during amending order +⋮---- +// v4.105.8: New GET /futures/{settle}/position_close_history endpoint request +export interface GetFuturesPositionCloseHistoryReq { + settle: 'btc' | 'usdt' | 'usd'; + contract?: string; + limit?: number; + offset?: number; + from?: number; + to?: number; +} +⋮---- +// v4.104.6: New GET /futures/{settle}/insurance endpoint request +export interface GetFuturesInsuranceReq { + settle: 'btc' | 'usdt' | 'usd'; + limit?: number; +} +⋮---- +export interface UpdateFuturesPriceTriggeredOrderReq { + settle: 'btc' | 'usdt' | 'usd'; + order_id: number | string; + contract?: string; + size?: number; + /** Same semantics as `size` (decimal contract size) */ + amount?: string; + price?: string; + /** When fully closing in single-position mode, set true */ + close?: boolean; + trigger_price?: string; + price_type?: 0 | 1 | 2; // 0 - Latest trade price, 1 - Mark price, 2 - Index price + auto_size?: string; // Not required in single position mode } ⋮---- -export interface FuturesPositionHistoryRecord { - time: number; - contract: string; - side: 'long' | 'short'; - pnl: string; - pnl_pnl: string; - pnl_fund: string; - pnl_fee: string; - text: string; - max_size: string; - first_open_time: number; - long_price: string; - short_price: string; - accum_size: string; -} +/** Same semantics as `size` (decimal contract size) */ ⋮---- -export interface FuturesLiquidationHistoryRecord { - time: number; +/** When fully closing in single-position mode, set true */ +⋮---- +price_type?: 0 | 1 | 2; // 0 - Latest trade price, 1 - Mark price, 2 - Index price +auto_size?: string; // Not required in single position mode +⋮---- +/** GET /futures/{settle}/get_leverage/{contract} — v4.106.43: pos_margin_mode and dual_side required */ +export interface GetFuturesContractLeverageReq { + settle: 'btc' | 'usdt' | 'usd'; contract: string; - leverage: string; - size: number; - margin: string; - entry_price: string; - liq_price: string; - mark_price: string; - order_id: number; - order_price: string; - fill_price: string; - left: number; + pos_margin_mode: 'isolated' | 'cross'; + dual_side: 'dual_long' | 'dual_short'; } -export interface FuturesAutoDeleveragingHistoryRecord { - time: number; - user: number; - order_id: number; +⋮---- +/** Trail order (autoorder/v1/trail) request types */ +export interface CreateTrailOrderReq { + settle: 'btc' | 'usdt'; contract: string; - leverage: string; // Clarified for better understanding of margin modes - cross_leverage_limit: string; // Clarified for better understanding of margin modes - entry_price: string; - fill_price: string; - trade_size: number; - position_size: number; + amount: string; + activation_price?: string; + is_gte?: boolean; + price_type?: 1 | 2 | 3; + price_offset?: string; + reduce_only?: boolean; + position_related?: boolean; + text?: string; + pos_margin_mode?: string; + position_mode?: string; } ⋮---- -leverage: string; // Clarified for better understanding of margin modes -cross_leverage_limit: string; // Clarified for better understanding of margin modes -⋮---- -export interface DeleteFuturesBatchOrdersResp { - user_id: number; - id: string; - succeeded: boolean; - message: string; +export interface TerminateTrailOrderReq { + settle: 'btc' | 'usdt'; + id?: number; + text?: string; } ⋮---- -export interface FuturesContract { - name?: string; - /** Contract classification (e.g. stocks, metals, indices, forex, commodities). */ - contract_type?: string; - type?: 'inverse' | 'direct'; - quanto_multiplier?: string; // Conceptually renamed to "contract multiplier" - leverage_min?: string; - leverage_max?: string; - maintenance_rate?: string; // First-tier maintenance margin rate requirement - mark_type?: 'internal' | 'index'; // Deprecated - mark_price?: string; - index_price?: string; - last_price?: string; - maker_fee_rate?: string; - taker_fee_rate?: string; - order_price_round?: string; - mark_price_round?: string; // Minimum unit of mark price - order_price_deviate?: string; - ref_discount_rate?: string; - ref_rebate_rate?: string; - funding_rate?: string; - funding_rate_indicative?: string; - funding_interval?: number; - funding_next_apply?: number; - funding_offset?: number; - /** Interest rate ratio (string); returned by GET /futures/{settle}/contracts and GET /futures/{settle}/contracts/{contract}. */ - interest_rate?: string; - risk_limit_base?: string; - risk_limit_step?: string; - risk_limit_max?: string; - order_size_min?: string | number; // API returns string e.g. "1" - order_size_max?: string | number; // API returns string e.g. "1000000" - orderbook_id?: number; - trade_id?: number; - trade_size?: string | number; // API returns string - position_size?: string | number; // API returns string - short_users?: number; - long_users?: number; - funding_impact_value?: string; - config_change_time?: number; - in_delisting?: boolean; - orders_limit?: number; - enable_bonus?: boolean; - enable_credit?: boolean; - /** When true, contract supports decimal contract size (size field can use decimal string). When false, size only supports integer type. */ - enable_decimal?: boolean; - /** Whether the newly listed contract uses the mark price circuit breaker */ - enable_circuit_breaker?: boolean; - create_time?: number; - launch_time?: number; - delisting_time?: number; - delisted_time?: number; - status?: string; // e.g. "trading" - funding_cap_ratio?: string; // Deprecated - funding_rate_limit?: string; // v4.106.4: Funding rate cap value - market_order_slip_ratio?: string; - market_order_size_max?: string; +export interface BatchTerminateTrailOrdersReq { + settle: 'btc' | 'usdt'; + contract?: string; + related_position?: 1 | 2; } ⋮---- -/** Contract classification (e.g. stocks, metals, indices, forex, commodities). */ +export interface GetTrailOrderListReq { + settle: 'btc' | 'usdt'; + contract?: string; + is_finished?: boolean; + start_at?: number; + end_at?: number; + page_num?: number; + page_size?: number; + sort_by?: 1 | 2; + hide_cancel?: boolean; + related_position?: 1 | 2; + sort_by_trigger?: boolean; + reduce_only?: 1 | 2; + side?: 1 | 2; +} ⋮---- -quanto_multiplier?: string; // Conceptually renamed to "contract multiplier" +export interface GetTrailOrderDetailReq { + settle: 'btc' | 'usdt'; + id: number; +} ⋮---- -maintenance_rate?: string; // First-tier maintenance margin rate requirement -mark_type?: 'internal' | 'index'; // Deprecated +export interface UpdateTrailOrderReq { + settle: 'btc' | 'usdt'; + id: number; + amount?: string; + activation_price?: string; + is_gte_str?: string; + price_type?: 0 | 1 | 2 | 3; + price_offset?: string; +} ⋮---- -mark_price_round?: string; // Minimum unit of mark price +export interface GetTrailOrderChangeLogReq { + settle: 'btc' | 'usdt'; + id: number; + page_num?: number; + page_size?: number; +} ⋮---- -/** Interest rate ratio (string); returned by GET /futures/{settle}/contracts and GET /futures/{settle}/contracts/{contract}. */ +/** Chase limit order (autoorder/v1/chase) request types */ +export interface CreateChaseOrderReq { + settle: 'btc' | 'usdt' | 'usd'; + contract: string; + amount: string; + price_limit: string; + offset_limit?: string; + reduce_only?: boolean; + text?: string; + is_dual_mode?: boolean; + price_type?: number; + price_gap_type?: number; + price_gap_value?: string; + pos_margin_mode?: 'isolated' | 'cross' | string; + position_mode?: string; +} ⋮---- -order_size_min?: string | number; // API returns string e.g. "1" -order_size_max?: string | number; // API returns string e.g. "1000000" +export interface StopChaseOrderReq { + settle: 'btc' | 'usdt' | 'usd'; + id?: string; + text?: string; +} ⋮---- -trade_size?: string | number; // API returns string -position_size?: string | number; // API returns string +export interface StopAllChaseOrdersReq { + settle: 'btc' | 'usdt' | 'usd'; + contract?: string; + pos_margin_mode?: 'isolated' | 'cross' | string; +} ⋮---- -/** When true, contract supports decimal contract size (size field can use decimal string). When false, size only supports integer type. */ +export interface GetChaseOrdersReq { + settle: 'btc' | 'usdt' | 'usd'; + contract?: string; + is_finished?: boolean; + start_at?: number; + end_at?: number; + page_num?: number; + page_size?: number; + /** 1 ORDER_SORT_CREATED_AT, 2 ORDER_SORT_FINISHED_AT */ + sort_by: 1 | 2; + hide_cancel?: boolean; + reduce_only?: 0 | 1 | 2; + side?: 0 | 1 | 2; +} ⋮---- -/** Whether the newly listed contract uses the mark price circuit breaker */ +/** 1 ORDER_SORT_CREATED_AT, 2 ORDER_SORT_FINISHED_AT */ ⋮---- -status?: string; // e.g. "trading" -funding_cap_ratio?: string; // Deprecated -funding_rate_limit?: string; // v4.106.4: Funding rate cap value +export interface GetChaseOrderDetailReq { + settle: 'btc' | 'usdt' | 'usd'; + id: string; +} + +================ +File: src/types/response/futures.ts +================ +/**========================================================================================================================== + * FUTURES + * ========================================================================================================================== + */ ⋮---- -/** GET /futures/{settle}/get_leverage/{contract} — API field name is `Lever` */ -export interface FuturesContractLeverageInfo { - Lever: string; +export interface FuturesOrderBook { + id?: number; + current: number; + update: number; + asks: { p: string; s: number }[]; + bids: { p: string; s: number }[]; } ⋮---- -/** Create/amend response for futures price-trigger orders (`/futures/{settle}/price_orders`). */ -export interface TriggerOrderResponse { - id?: number; - /** - * Same order as numeric `id`, as decimal string (int64-safe in JS); prefer for display or string keys. - */ - id_string?: string; +export interface FuturesTrade { + id: number; + create_time: number; + create_time_ms: number; + contract: string; + size: number; + price: string; + is_internal?: boolean; // Deprecated } ⋮---- -/** - * Same order as numeric `id`, as decimal string (int64-safe in JS); prefer for display or string keys. - */ +is_internal?: boolean; // Deprecated ⋮---- -export interface FuturesPriceTriggeredOrder { - initial: { - contract: string; - size?: number; - price?: string; - close?: boolean; - tif?: 'gtc' | 'ioc'; - text?: string; - reduce_only?: boolean; - auto_size?: string; - is_reduce_only?: boolean; - is_close?: boolean; - }; - trigger: { - strategy_type?: 0 | 1; - price_type?: 0 | 1 | 2; - price?: string; - rule?: 1 | 2; - expiration?: number; - }; - id?: number; // int64 price-triggered order id - /** - * Same order as numeric `id`, as decimal string (int64-safe in JS); prefer for display or string keys. - */ - id_string?: string; - user?: number; - create_time?: number; - finish_time?: number; - trade_id?: number; - status?: 'open' | 'finished' | 'inactive' | 'invalid'; - finish_as?: 'cancelled' | 'succeeded' | 'failed' | 'expired'; - reason?: string; - order_type?: - | 'close-long-order' - | 'close-short-order' - | 'close-long-position' - | 'close-short-position' - | 'plan-close-long-position' - | 'plan-close-short-position'; - me_order_id?: number; // int64 +export interface FuturesCandle { + t: number; + v?: number; + c: string; + h: string; + l: string; + o: string; + sum: string; } ⋮---- -id?: number; // int64 price-triggered order id -/** - * Same order as numeric `id`, as decimal string (int64-safe in JS); prefer for display or string keys. - */ -⋮---- -me_order_id?: number; // int64 +export interface PremiumIndexKLine { + t: number; + c: string; + h: string; + l: string; + o: string; +} ⋮---- -export interface FuturesDeliveryContract { - name?: string; - /** Contract classification (e.g. stocks, metals, indices, forex, commodities). */ - contract_type?: string; - underlying?: string; - cycle?: 'WEEKLY' | 'BI-WEEKLY' | 'QUARTERLY' | 'BI-QUARTERLY'; - type?: 'inverse' | 'direct'; - quanto_multiplier?: string; // Conceptually renamed to "contract multiplier" - leverage_min?: string; - leverage_max?: string; - maintenance_rate?: string; // First-tier maintenance margin rate requirement - mark_type?: 'internal' | 'index'; // Deprecated - mark_price?: string; - index_price?: string; - last_price?: string; - maker_fee_rate?: string; - taker_fee_rate?: string; - order_price_round?: string; - mark_price_round?: string; // Minimum unit of mark price - basis_rate?: string; - basis_value?: string; - basis_impact_value?: string; - settle_price?: string; - settle_price_interval?: number; - settle_price_duration?: number; - expire_time?: number; - risk_limit_base?: string; - risk_limit_step?: string; - risk_limit_max?: string; - order_size_min?: number; - order_size_max?: number; - order_price_deviate?: string; - ref_discount_rate?: string; - ref_rebate_rate?: string; - orderbook_id?: number; - trade_id?: number; - trade_size?: number; - position_size?: number; - config_change_time?: number; - in_delisting?: boolean; - orders_limit?: number; +export interface FuturesTicker { + contract: string; + last: string; + change_percentage: string; + total_size: string; + low_24h: string; + high_24h: string; + volume_24h: string; + volume_24h_btc?: string; + volume_24h_usd?: string; + volume_24h_base: string; + volume_24h_quote: string; + volume_24h_settle: string; + mark_price: string; + funding_rate: string; + funding_rate_indicative: string; + index_price: string; + quanto_base_rate?: string; // Deprecated + basis_rate: string; + basis_value: string; + lowest_ask: string; + highest_bid: string; + lowest_size: string; + highest_size: string; } ⋮---- -/** Contract classification (e.g. stocks, metals, indices, forex, commodities). */ +quanto_base_rate?: string; // Deprecated ⋮---- -quanto_multiplier?: string; // Conceptually renamed to "contract multiplier" +export interface BatchFundingRatesResponse { + contract?: string; + data?: { t: number; r: string }[]; +} ⋮---- -maintenance_rate?: string; // First-tier maintenance margin rate requirement -mark_type?: 'internal' | 'index'; // Deprecated +export interface FuturesStats { + time: number; + lsr_taker: number; + lsr_account: number; + long_liq_size: number; + long_liq_amount: number; + long_liq_usd: number; + long_liq_usd_new?: number; + short_liq_size: number; + short_liq_amount: number; + short_liq_usd: number; + short_liq_usd_new?: number; + open_interest: number; + open_interest_usd: number; + top_lsr_account: number; + top_lsr_size: number; + top_long_size?: number; + top_short_size?: number; + long_taker_size?: number; + short_taker_size?: number; + top_long_account?: number; + top_short_account?: number; + long_users?: number; + short_users?: number; +} ⋮---- -mark_price_round?: string; // Minimum unit of mark price +export interface IndexConstituents { + index: string; + constituents: { + exchange: string; + symbols: string[]; + }[]; +} ⋮---- -export interface BatchAmendOrderResp { - succeeded: boolean; - label?: string; - detail?: string; - id: number; - user: number; - create_time: number; - finish_time?: number; - /** - * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). - */ - finish_as?: - | 'filled' - | 'cancelled' - | 'liquidated' - | 'ioc' - | 'poc' - | 'auto_deleveraged' - | 'reduce_only' - | 'position_closed' - | 'reduce_out' - | 'stp'; - status: 'open' | 'finished'; +export interface LiquidationHistoryRecord { + time: number; contract: string; size: number; - iceberg: number; - price: string; - is_close: boolean; - is_reduce_only: boolean; - is_liq: boolean; - tif: 'gtc' | 'ioc' | 'poc' | 'fok'; - left: number; + order_size: number; + order_price: string; fill_price: string; - text: string; - tkfr: string; - mkfr: string; - refu: number; - stp_act: 'co' | 'cn' | 'cb' | '-'; - stp_id: number; + left: number; } ⋮---- -/** - * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). - */ +export interface RiskLimitTier { + tier: number; + risk_limit: string; + initial_rate: string; + maintenance_rate: string; // First-tier maintenance margin rate requirement + leverage_max: string; + contract: string; +} ⋮---- -/** - * @deprecated - Use FuturesAccount instead - */ -export interface UpdateFuturesDualModeResp { - total: string; +maintenance_rate: string; // First-tier maintenance margin rate requirement +⋮---- +export interface FuturesAccount { + total: string; // Balance, only applicable to classic contract account unrealised_pnl: string; - position_margin: string; - order_margin: string; + position_margin?: string; // Deprecated + order_margin: string; // Initial margin for all pending orders available: string; point: string; currency: string; in_dual_mode: boolean; + position_mode?: string; // Position mode: single - one-way, dual - dual-side, split - sub-positions (in_dual_mode is deprecated) enable_credit: boolean; position_initial_margin: string; maintenance_margin: string; bonus: string; - enable_evolved_classic: boolean; + enable_evolved_classic?: boolean; // Deprecated + cross_order_margin: string; + cross_initial_margin: string; + cross_maintenance_margin: string; + cross_unrealised_pnl: string; + cross_available: string; + cross_margin_balance: string; + cross_mmr: string; + cross_imr: string; + isolated_position_margin: string; + enable_new_dual_mode?: boolean; // Deprecated + margin_mode: number; // 0: classic future account or Classic Spot Margin Mode of unified account; 1: Multi-Currency Margin Mode; 2: Portfolio Margin Mode; 3: Single-Currency Margin Mode history: { dnw: string; pnl: string; @@ -13749,393 +13467,665 @@ export interface UpdateFuturesDualModeResp { bonus_dnw: string; bonus_offset: string; }; + enable_tiered_mm: boolean; + funding_balance?: string; } ⋮---- -export interface RiskLimitTableTier { - tier: number; - risk_limit: string; - initial_rate: string; - maintenance_rate: string; // First-tier maintenance margin rate requirement - leverage_max: string; - deduction: string; -} +total: string; // Balance, only applicable to classic contract account ⋮---- -maintenance_rate: string; // First-tier maintenance margin rate requirement +position_margin?: string; // Deprecated +order_margin: string; // Initial margin for all pending orders ⋮---- -// v4.104.6: New GET /futures/{settle}/insurance endpoint types -export interface FuturesInsuranceHistory { - t: number; - b: string; -} +position_mode?: string; // Position mode: single - one-way, dual - dual-side, split - sub-positions (in_dual_mode is deprecated) ⋮---- -/** Trail order (autoorder/v1/trail) response types */ -export interface TrailOrder { - id?: number | string; - user_id?: number | string; - user?: number | string; - contract?: string; - settle?: string; - amount?: string; - is_gte?: boolean; - activation_price?: string; - price_type?: number; - price_offset?: string; - text?: string; - reduce_only?: boolean; - position_related?: boolean; - created_at?: number | string; - activated_at?: number | string; - finished_at?: number | string; - create_time?: number | string; - active_time?: number | string; - finish_time?: number | string; - reason?: string; - suborder_text?: string; - is_dual_mode?: boolean; - trigger_price?: string; - suborder_id?: number | string; - side_label?: string; - original_status?: number; - status?: string; - position_side_output?: string; - updated_at?: number | string; - extremum_price?: string; - status_code?: string; - created_at_precise?: string; - finished_at_precise?: string; - activated_at_precise?: string; - status_label?: string; - pos_margin_mode?: string; - position_mode?: string; - error_label?: string; - leverage?: string; - [key: string]: unknown; -} +enable_evolved_classic?: boolean; // Deprecated ⋮---- -export interface TrailChangeLog { - updated_at?: number; - amount?: string; - is_gte?: boolean; - activation_price?: string; - price_type?: number; - price_offset?: string; - is_create?: boolean; -} +enable_new_dual_mode?: boolean; // Deprecated +margin_mode: number; // 0: classic future account or Classic Spot Margin Mode of unified account; 1: Multi-Currency Margin Mode; 2: Portfolio Margin Mode; 3: Single-Currency Margin Mode ⋮---- -export interface ChaseOrder { - id?: string; - user?: string; +export interface FuturesAccountBookRecord { + time: number; + change: string; + balance: string; + type: string; + text: string; contract?: string; - settle?: string; - amount?: string; - price_limit?: string; - reduce_only?: boolean; - text?: string; + trade_id: string; + id: string; +} +⋮---- +export interface FuturesOrder { + id?: number; + user?: number; create_time?: number; finish_time?: number; - original_status?: number; - status?: string; - reason?: string; - fill_amount?: string; - average_fill_price?: string; - suborder_id?: string; - is_dual_mode?: boolean; - side_label?: string; - position_side_output?: string; - chase_price?: string; - interval_sec?: number; - updated_at?: number; - suborder_price?: string; - suborder_ongoing?: boolean; - suborder_finish_as?: string; - price_type?: number; - price_gap_type?: string; - price_gap_value?: string; - status_code?: string; - create_time_precise?: string; - finish_time_precise?: string; + /** + * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). + */ + finish_as?: + | 'filled' + | 'cancelled' + | 'liquidated' + | 'ioc' + | 'poc' + | 'auto_deleveraged' + | 'reduce_only' + | 'position_closed' + | 'stp'; + status?: 'open' | 'finished'; + contract: string; + size: number; + iceberg?: number; + price?: string; + close?: boolean; + is_close?: boolean; + reduce_only?: boolean; + is_reduce_only?: boolean; + is_liq?: boolean; + tif?: 'gtc' | 'ioc' | 'poc' | 'fok'; + left?: number; + fill_price?: string; + text?: string; + tkfr?: string; + mkfr?: string; + refu?: number; + auto_size?: 'close_long' | 'close_short'; + stp_id?: number; + stp_act?: 'cn' | 'co' | 'cb' | '-'; + amend_text?: string; + biz_info?: string; + /** Read-only; order notional in settle currency (API response only; omit from order requests). */ + order_value?: string; + /** Read-only; traded value (API response only; omit from order requests). */ + trade_value?: string; + action_mode?: 'ACK' | 'RESULT' | 'FULL'; + tpsl_tp_trigger_price?: string; + tpsl_sl_trigger_price?: string; + tpsl_tp_bbo_type?: string; // v4.106.93: BBO price type for take-profit leg + tpsl_sl_bbo_type?: string; // v4.106.93: BBO price type for stop-loss leg pos_margin_mode?: string; - position_mode?: string; - leverage?: string; - error_label?: string; -} -⋮---- -export interface CreateChaseOrderResp { - id?: string; -} -⋮---- -export interface StopChaseOrderResp { - order?: ChaseOrder; -} -⋮---- -export interface StopAllChaseOrdersResp { - orders?: ChaseOrder[]; -} -⋮---- -export interface GetChaseOrdersResp { - orders?: ChaseOrder[]; } ⋮---- -export interface GetChaseOrderDetailResp { - order?: ChaseOrder; -} - -================ -File: src/lib/BaseRestClient.ts -================ -import axios, { AxiosRequestConfig, AxiosResponse, Method } from 'axios'; -// NOTE: https.Agent is Node.js-only and not available in browser environments -// Browser builds (via webpack) exclude this module - see webpack.config.js fallback settings -import https from 'https'; -⋮---- -import { neverGuard } from './misc-util.js'; -import { - CHANNEL_ID, - getRestBaseUrl, - RestClientOptions, - serializeParams, -} from './requestUtils.js'; -import { - checkWebCryptoAPISupported, - hashMessage, - SignAlgorithm, - SignEncodeMethod, - signMessage, -} from './webCryptoAPI.js'; -⋮---- -/** - * Used to switch how authentication/requests work under the hood - */ -⋮---- -export type RestClientType = - (typeof REST_CLIENT_TYPE_ENUM)[keyof typeof REST_CLIENT_TYPE_ENUM]; -⋮---- -interface SignedRequest { - originalParams: T; - paramsWithSign?: T & { sign: string }; - serializedParams: string; - sign: string; - queryParamsWithSign: string; - timestamp: number; - recvWindow: number; -} -⋮---- -interface UnsignedRequest { - originalParams: T; - paramsWithSign: T; -} -⋮---- -type SignMethod = 'gateV4'; -⋮---- /** - * Some requests require some params to be in the query string and some in the body. Some even support passing params via headers. - * This type anticipates these are possible in any combination. - * - * The request builder will automatically handle where parameters should go. - */ -type ParamsInQueryBodyOrHeader = { - query?: object; - body?: object; - headers?: object; - /** multipart/form-data body; mutually exclusive with `body` */ - multipart?: FormData; -}; + * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). + */ ⋮---- -/** multipart/form-data body; mutually exclusive with `body` */ +/** Read-only; order notional in settle currency (API response only; omit from order requests). */ ⋮---- -/** - * Enables: - * - Detailed request/response logging - * - Full request dump in any exceptions thrown from API responses - */ +/** Read-only; traded value (API response only; omit from order requests). */ ⋮---- -// request: { -// url: response.config.url, -// method: response.config.method, -// data: response.config.data, -// headers: response.config.headers, -// }, +tpsl_tp_bbo_type?: string; // v4.106.93: BBO price type for take-profit leg +tpsl_sl_bbo_type?: string; // v4.106.93: BBO price type for stop-loss leg ⋮---- -/** - * Impure, mutates params to remove any values that have a key but are undefined. - */ -function deleteUndefinedValues(params?: any): void +/** Item shape for `GET /futures/{settle}/orders_timerange` (differs from {@link FuturesOrder} in field types). */ +export interface FuturesOrderTimerange { + id?: number; + user?: number; + create_time?: number; + update_time?: string; + finish_time?: string; + contract: string; + size: string; + iceberg?: string; + is_close?: boolean; + is_reduce_only?: boolean; + is_liq?: boolean; + left?: string; + fill_price?: string; + tkfr?: string; + mkfr?: string; + refu?: number; + amend_text?: string; + pid?: number; + market_order_slip_ratio?: string; + pos_margin_mode?: string; +} ⋮---- -export abstract class BaseRestClient +export interface FuturesPosition { + user?: number; + contract?: string; + size?: number; + leverage?: string; // Isolated margin leverage, 0 indicates cross margin mode + risk_limit?: string; + leverage_max?: string; // Max leverage based on current position size + maintenance_rate?: string; // Tiered maintenance margin rate calculation + value?: string; + margin?: string; + entry_price?: string; + liq_price?: string; // Estimated liquidation price for reference only + liquidation_price?: string; // v4.105.7: Add liquidation_price field for better risk management + mark_price?: string; + initial_margin?: string; // Expanded scope description + maintenance_margin?: string; // Expanded scope description + unrealised_pnl?: string; + realised_pnl?: string; // Detailed breakdown including settlement, funding fees, and trading fees + pnl_pnl?: string; // Settlement P&L + pnl_fund?: string; // Funding fee P&L + pnl_fee?: string; // Total trading fees + history_pnl?: string; // All historical settlement P&L + last_close_pnl?: string; + realised_point?: string; + history_point?: string; + adl_ranking?: number; + pending_orders?: number; + close_order?: { + id?: number; + price?: string; + is_liq?: boolean; + } | null; + mode?: 'single' | 'dual_long' | 'dual_short'; + cross_leverage_limit?: string; // Simplified description + update_time?: number; + update_id?: number; + open_time?: number; + settlement_currency?: string; // v4.105.9: Add settlement_currency field for multi-settlement support + isolated_margin?: string; // v4.104.6: Add isolated_margin field + pid?: number; // v4.106.0: Sub-position ID + hedge_status?: 'partial_hedged' | 'full_hedged'; // v4.106.97: Delta-neutral hedging status + hedged_size?: string; // v4.106.97: Hedged size under Delta-neutral strategy + unhedged_size?: string; // v4.106.97: Unhedged size under Delta-neutral strategy +} ⋮---- -/** Defines the client type (affecting how requests & signatures behave) */ -abstract getClientType(): RestClientType; +leverage?: string; // Isolated margin leverage, 0 indicates cross margin mode ⋮---- -/** - * Create an instance of the REST client. Pass API credentials in the object in the first parameter. - * @param {RestClientOptions} [restClientOptions={}] options to configure REST API connectivity - * @param {AxiosRequestConfig} [networkOptions={}] HTTP networking options for axios - */ -constructor( - restClientOptions: RestClientOptions = {}, - networkOptions: AxiosRequestConfig = {}, -) +leverage_max?: string; // Max leverage based on current position size +maintenance_rate?: string; // Tiered maintenance margin rate calculation ⋮---- -/** Throw errors if any request params are empty */ +liq_price?: string; // Estimated liquidation price for reference only +liquidation_price?: string; // v4.105.7: Add liquidation_price field for better risk management ⋮---- -/** in ms == 5 minutes by default */ +initial_margin?: string; // Expanded scope description +maintenance_margin?: string; // Expanded scope description ⋮---- -/** inject custom rquest options based on axios specs - see axios docs for more guidance on AxiosRequestConfig: https://github.com/axios/axios#request-config */ +realised_pnl?: string; // Detailed breakdown including settlement, funding fees, and trading fees +pnl_pnl?: string; // Settlement P&L +pnl_fund?: string; // Funding fee P&L +pnl_fee?: string; // Total trading fees +history_pnl?: string; // All historical settlement P&L ⋮---- -// If enabled, configure a https agent with keepAlive enabled -// NOTE: This is Node.js-only functionality. In browser environments, this code is skipped -// as the 'https' module is excluded via webpack fallback configuration. -// Browser connection pooling is handled automatically by the browser itself. +cross_leverage_limit?: string; // Simplified description ⋮---- -// Extract existing https agent parameters, if provided, to prevent the keepAlive flag from overwriting an existing https agent completely +settlement_currency?: string; // v4.105.9: Add settlement_currency field for multi-settlement support +isolated_margin?: string; // v4.104.6: Add isolated_margin field +pid?: number; // v4.106.0: Sub-position ID +hedge_status?: 'partial_hedged' | 'full_hedged'; // v4.106.97: Delta-neutral hedging status +hedged_size?: string; // v4.106.97: Hedged size under Delta-neutral strategy +unhedged_size?: string; // v4.106.97: Unhedged size under Delta-neutral strategy ⋮---- -// For more advanced configuration, raise an issue on GitHub or use the "networkOptions" -// parameter to define a custom httpsAgent with the desired properties +export interface FuturesTradingHistoryRecord { + id: number; + create_time: number; + contract: string; + order_id: string; + size: number; + price: string; + role: 'taker' | 'maker'; + text: string; + fee: string; + point_fee: string; + close_size: number; +} ⋮---- -// Check Web Crypto API support when credentials are provided and no custom sign function is used +export interface FuturesPositionHistoryRecord { + time: number; + contract: string; + side: 'long' | 'short'; + pnl: string; + pnl_pnl: string; + pnl_fund: string; + pnl_fee: string; + text: string; + max_size: string; + first_open_time: number; + long_price: string; + short_price: string; + accum_size: string; +} ⋮---- -// Throw if one of the 3 values is missing, but at least one of them is set +export interface FuturesLiquidationHistoryRecord { + time: number; + contract: string; + leverage: string; + size: number; + margin: string; + entry_price: string; + liq_price: string; + mark_price: string; + order_id: number; + order_price: string; + fill_price: string; + left: number; +} +export interface FuturesAutoDeleveragingHistoryRecord { + time: number; + user: number; + order_id: number; + contract: string; + leverage: string; // Clarified for better understanding of margin modes + cross_leverage_limit: string; // Clarified for better understanding of margin modes + entry_price: string; + fill_price: string; + trade_size: number; + position_size: number; +} ⋮---- -/** - * Timestamp used to sign the request. Override this method to implement your own timestamp/sync mechanism - */ -getSignTimestampMs(): number +leverage: string; // Clarified for better understanding of margin modes +cross_leverage_limit: string; // Clarified for better understanding of margin modes ⋮---- -protected get(endpoint: string, params?: object) +export interface DeleteFuturesBatchOrdersResp { + user_id: number; + id: string; + succeeded: boolean; + message: string; +} ⋮---- -// GET only supports params in the query string +export interface FuturesContract { + name?: string; + /** Contract classification (e.g. stocks, metals, indices, forex, commodities). */ + contract_type?: string; + type?: 'inverse' | 'direct'; + quanto_multiplier?: string; // Conceptually renamed to "contract multiplier" + leverage_min?: string; + leverage_max?: string; + maintenance_rate?: string; // First-tier maintenance margin rate requirement + mark_type?: 'internal' | 'index'; // Deprecated + mark_price?: string; + index_price?: string; + last_price?: string; + maker_fee_rate?: string; + taker_fee_rate?: string; + order_price_round?: string; + mark_price_round?: string; // Minimum unit of mark price + order_price_deviate?: string; + ref_discount_rate?: string; + ref_rebate_rate?: string; + funding_rate?: string; + funding_rate_indicative?: string; + funding_interval?: number; + funding_next_apply?: number; + funding_offset?: number; + /** Interest rate ratio (string); returned by GET /futures/{settle}/contracts and GET /futures/{settle}/contracts/{contract}. */ + interest_rate?: string; + risk_limit_base?: string; + risk_limit_step?: string; + risk_limit_max?: string; + order_size_min?: string | number; // API returns string e.g. "1" + order_size_max?: string | number; // API returns string e.g. "1000000" + orderbook_id?: number; + trade_id?: number; + trade_size?: string | number; // API returns string + position_size?: string | number; // API returns string + short_users?: number; + long_users?: number; + funding_impact_value?: string; + config_change_time?: number; + in_delisting?: boolean; + orders_limit?: number; + enable_bonus?: boolean; + enable_credit?: boolean; + /** When true, contract supports decimal contract size (size field can use decimal string). When false, size only supports integer type. */ + enable_decimal?: boolean; + /** Whether the newly listed contract uses the mark price circuit breaker */ + enable_circuit_breaker?: boolean; + create_time?: number; + launch_time?: number; + delisting_time?: number; + delisted_time?: number; + status?: string; // e.g. "trading" + funding_cap_ratio?: string; // Deprecated + funding_rate_limit?: string; // v4.106.4: Funding rate cap value + market_order_slip_ratio?: string; + market_order_size_max?: string; +} ⋮---- -protected post(endpoint: string, params?: ParamsInQueryBodyOrHeader) +/** Contract classification (e.g. stocks, metals, indices, forex, commodities). */ ⋮---- -protected getPrivate(endpoint: string, params?: object) +quanto_multiplier?: string; // Conceptually renamed to "contract multiplier" ⋮---- -// GET only supports params in the query string +maintenance_rate?: string; // First-tier maintenance margin rate requirement +mark_type?: 'internal' | 'index'; // Deprecated ⋮---- -protected postPrivate(endpoint: string, params?: ParamsInQueryBodyOrHeader) +mark_price_round?: string; // Minimum unit of mark price ⋮---- -/** POST private endpoint with multipart/form-data (empty body hash for signing) */ -protected postPrivateMultipart( - endpoint: string, - formData: FormData, - query?: object, -) +/** Interest rate ratio (string); returned by GET /futures/{settle}/contracts and GET /futures/{settle}/contracts/{contract}. */ ⋮---- -protected deletePrivate( - endpoint: string, - params?: ParamsInQueryBodyOrHeader, -) +order_size_min?: string | number; // API returns string e.g. "1" +order_size_max?: string | number; // API returns string e.g. "1000000" ⋮---- -protected putPrivate(endpoint: string, params?: ParamsInQueryBodyOrHeader) +trade_size?: string | number; // API returns string +position_size?: string | number; // API returns string ⋮---- -// protected patchPrivate(endpoint: string, params?: any) { -protected patchPrivate(endpoint: string, params?: ParamsInQueryBodyOrHeader) +/** When true, contract supports decimal contract size (size field can use decimal string). When false, size only supports integer type. */ ⋮---- -/** - * @private Make a HTTP request to a specific endpoint. Private endpoint API calls are automatically signed. - */ -private async _call( - method: Method, - endpoint: string, - params?: ParamsInQueryBodyOrHeader, - isPublicApi?: boolean, -): Promise +/** Whether the newly listed contract uses the mark price circuit breaker */ ⋮---- -// Sanity check to make sure it's only ever prefixed by one forward slash +status?: string; // e.g. "trading" +funding_cap_ratio?: string; // Deprecated +funding_rate_limit?: string; // v4.106.4: Funding rate cap value ⋮---- -// Build a request and handle signature process +/** GET /futures/{settle}/get_leverage/{contract} — API field name is `Lever` */ +export interface FuturesContractLeverageInfo { + Lever: string; +} ⋮---- -// Dispatch request +/** Create/amend response for futures price-trigger orders (`/futures/{settle}/price_orders`). */ +export interface TriggerOrderResponse { + id?: number; + /** + * Same order as numeric `id`, as decimal string (int64-safe in JS); prefer for display or string keys. + */ + id_string?: string; +} ⋮---- -// See: https://www.gate.io/docs/developers/apiv4/en/#return-format +/** + * Same order as numeric `id`, as decimal string (int64-safe in JS); prefer for display or string keys. + */ ⋮---- -// Throw API rejections by parsing the response code from the body +export interface FuturesPriceTriggeredOrder { + initial: { + contract: string; + size?: number; + price?: string; + close?: boolean; + tif?: 'gtc' | 'ioc'; + text?: string; + reduce_only?: boolean; + auto_size?: string; + is_reduce_only?: boolean; + is_close?: boolean; + }; + trigger: { + strategy_type?: 0 | 1; + price_type?: 0 | 1 | 2; + price?: string; + rule?: 1 | 2; + expiration?: number; + }; + id?: number; // int64 price-triggered order id + /** + * Same order as numeric `id`, as decimal string (int64-safe in JS); prefer for display or string keys. + */ + id_string?: string; + user?: number; + create_time?: number; + finish_time?: number; + trade_id?: number; + status?: 'open' | 'finished' | 'inactive' | 'invalid'; + finish_as?: 'cancelled' | 'succeeded' | 'failed' | 'expired'; + reason?: string; + order_type?: + | 'close-long-order' + | 'close-short-order' + | 'close-long-position' + | 'close-short-position' + | 'plan-close-long-position' + | 'plan-close-short-position'; + me_order_id?: number; // int64 +} ⋮---- +id?: number; // int64 price-triggered order id /** - * @private generic handler to parse request exceptions + * Same order as numeric `id`, as decimal string (int64-safe in JS); prefer for display or string keys. */ -parseException(e: any, request: AxiosRequestConfig): unknown ⋮---- -// Something happened in setting up the request that triggered an error +me_order_id?: number; // int64 ⋮---- -// request made but no response received +export interface FuturesDeliveryContract { + name?: string; + /** Contract classification (e.g. stocks, metals, indices, forex, commodities). */ + contract_type?: string; + underlying?: string; + cycle?: 'WEEKLY' | 'BI-WEEKLY' | 'QUARTERLY' | 'BI-QUARTERLY'; + type?: 'inverse' | 'direct'; + quanto_multiplier?: string; // Conceptually renamed to "contract multiplier" + leverage_min?: string; + leverage_max?: string; + maintenance_rate?: string; // First-tier maintenance margin rate requirement + mark_type?: 'internal' | 'index'; // Deprecated + mark_price?: string; + index_price?: string; + last_price?: string; + maker_fee_rate?: string; + taker_fee_rate?: string; + order_price_round?: string; + mark_price_round?: string; // Minimum unit of mark price + basis_rate?: string; + basis_value?: string; + basis_impact_value?: string; + settle_price?: string; + settle_price_interval?: number; + settle_price_duration?: number; + expire_time?: number; + risk_limit_base?: string; + risk_limit_step?: string; + risk_limit_max?: string; + order_size_min?: number; + order_size_max?: number; + order_price_deviate?: string; + ref_discount_rate?: string; + ref_rebate_rate?: string; + orderbook_id?: number; + trade_id?: number; + trade_size?: number; + position_size?: number; + config_change_time?: number; + in_delisting?: boolean; + orders_limit?: number; +} ⋮---- -// The request was made and the server responded with a status code -// that falls out of the range of 2xx +/** Contract classification (e.g. stocks, metals, indices, forex, commodities). */ ⋮---- -// console.error('err: ', response?.data); +quanto_multiplier?: string; // Conceptually renamed to "contract multiplier" ⋮---- -// Prevent credentials from leaking into error messages +maintenance_rate?: string; // First-tier maintenance margin rate requirement +mark_type?: 'internal' | 'index'; // Deprecated +⋮---- +mark_price_round?: string; // Minimum unit of mark price +⋮---- +export interface BatchAmendOrderResp { + succeeded: boolean; + label?: string; + detail?: string; + id: number; + user: number; + create_time: number; + finish_time?: number; + /** + * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). + */ + finish_as?: + | 'filled' + | 'cancelled' + | 'liquidated' + | 'ioc' + | 'poc' + | 'auto_deleveraged' + | 'reduce_only' + | 'position_closed' + | 'reduce_out' + | 'stp'; + status: 'open' | 'finished'; + contract: string; + size: number; + iceberg: number; + price: string; + is_close: boolean; + is_reduce_only: boolean; + is_liq: boolean; + tif: 'gtc' | 'ioc' | 'poc' | 'fok'; + left: number; + fill_price: string; + text: string; + tkfr: string; + mkfr: string; + refu: number; + stp_act: 'co' | 'cn' | 'cb' | '-'; + stp_id: number; +} ⋮---- /** - * @private sign request and set recv window + * Final state; **ioc** / **poc** reflect unfilled remainder cancelled by TIF (IOC vs post-only / maker). */ -private async signRequest< - T extends ParamsInQueryBodyOrHeader | undefined = {}, - >( - data: T, - endpoint: string, - method: Method, - signMethod: SignMethod, -): Promise> ⋮---- -const timestamp = +(this.getSignTimestampMs() / 1000).toFixed(0); // in seconds +/** + * @deprecated - Use FuturesAccount instead + */ +export interface UpdateFuturesDualModeResp { + total: string; + unrealised_pnl: string; + position_margin: string; + order_margin: string; + available: string; + point: string; + currency: string; + in_dual_mode: boolean; + enable_credit: boolean; + position_initial_margin: string; + maintenance_margin: string; + bonus: string; + enable_evolved_classic: boolean; + history: { + dnw: string; + pnl: string; + fee: string; + refr: string; + fund: string; + point_dnw: string; + point_fee: string; + point_refr: string; + bonus_dnw: string; + bonus_offset: string; + }; +} +⋮---- +export interface RiskLimitTableTier { + tier: number; + risk_limit: string; + initial_rate: string; + maintenance_rate: string; // First-tier maintenance margin rate requirement + leverage_max: string; + deduction: string; +} +⋮---- +maintenance_rate: string; // First-tier maintenance margin rate requirement +⋮---- +// v4.104.6: New GET /futures/{settle}/insurance endpoint types +export interface FuturesInsuranceHistory { + t: number; + b: string; +} ⋮---- -// recvWindow: this.options.recvWindow, +/** Trail order (autoorder/v1/trail) response types */ +export interface TrailOrder { + id?: number | string; + user_id?: number | string; + user?: number | string; + contract?: string; + settle?: string; + amount?: string; + is_gte?: boolean; + activation_price?: string; + price_type?: number; + price_offset?: string; + text?: string; + reduce_only?: boolean; + position_related?: boolean; + created_at?: number | string; + activated_at?: number | string; + finished_at?: number | string; + create_time?: number | string; + active_time?: number | string; + finish_time?: number | string; + reason?: string; + suborder_text?: string; + is_dual_mode?: boolean; + trigger_price?: string; + suborder_id?: number | string; + side_label?: string; + original_status?: number; + status?: string; + position_side_output?: string; + updated_at?: number | string; + extremum_price?: string; + status_code?: string; + created_at_precise?: string; + finished_at_precise?: string; + activated_at_precise?: string; + status_label?: string; + pos_margin_mode?: string; + position_mode?: string; + error_label?: string; + leverage?: string; + [key: string]: unknown; +} ⋮---- -// It's possible to override the recv window on a per rquest level +export interface TrailChangeLog { + updated_at?: number; + amount?: string; + is_gte?: boolean; + activation_price?: string; + price_type?: number; + price_offset?: string; + is_create?: boolean; +} ⋮---- -// console.log('sign params: ', { -// requestBodyToHash, -// paramsStr: toSign, -// url: this.baseUrl, -// urlPath: this.baseUrlPath, -// }); +export interface ChaseOrder { + id?: string; + user?: string; + contract?: string; + settle?: string; + amount?: string; + price_limit?: string; + reduce_only?: boolean; + text?: string; + create_time?: number; + finish_time?: number; + original_status?: number; + status?: string; + reason?: string; + fill_amount?: string; + average_fill_price?: string; + suborder_id?: string; + is_dual_mode?: boolean; + side_label?: string; + position_side_output?: string; + chase_price?: string; + interval_sec?: number; + updated_at?: number; + suborder_price?: string; + suborder_ongoing?: boolean; + suborder_finish_as?: string; + price_type?: number; + price_gap_type?: string; + price_gap_value?: string; + status_code?: string; + create_time_precise?: string; + finish_time_precise?: string; + pos_margin_mode?: string; + position_mode?: string; + leverage?: string; + error_label?: string; +} ⋮---- -private async signMessage( - paramsStr: string, - secret: string, - method: 'hex' | 'base64', - algorithm: SignAlgorithm, -): Promise +export interface CreateChaseOrderResp { + id?: string; +} ⋮---- -private async prepareSignParams< - TParams extends ParamsInQueryBodyOrHeader | undefined, - >( - method: Method, - endpoint: string, - signMethod: SignMethod, - params?: TParams, - isPublicApi?: true, - ): Promise>; +export interface StopChaseOrderResp { + order?: ChaseOrder; +} ⋮---- -private async prepareSignParams< - TParams extends ParamsInQueryBodyOrHeader | undefined, - >( - method: Method, - endpoint: string, - signMethod: SignMethod, - params?: TParams, - isPublicApi?: false | undefined, - ): Promise>; +export interface StopAllChaseOrdersResp { + orders?: ChaseOrder[]; +} ⋮---- -private async prepareSignParams< - TParams extends ParamsInQueryBodyOrHeader | undefined, - >( - method: Method, - endpoint: string, - signMethod: SignMethod, - params?: TParams, - isPublicApi?: boolean, -) +export interface GetChaseOrdersResp { + orders?: ChaseOrder[]; +} ⋮---- -/** Returns an axios request object. Handles signing process automatically if this is a private API call */ -private async buildRequest( - method: Method, - endpoint: string, - url: string, - params?: ParamsInQueryBodyOrHeader, - isPublicApi?: boolean, -): Promise +export interface GetChaseOrderDetailResp { + order?: ChaseOrder; +} ================ File: README.md @@ -15454,6 +15444,14 @@ getDepositRecords( */ submitTransfer(params: SubmitTransferReq): Promise< ⋮---- +/** + * Get trading account transfer details + * + * Retrieve the current user's trading account transfer details by tx_id. Response includes transfer status, currency, amount, source and destination account types, and applicable settlement currency or margin currency pair. + * + * @param params Parameters containing the transfer transaction ID + * @returns Promise + */ getTransfer(params: GetTransferReq): Promise ⋮---- /** @@ -15918,6 +15916,14 @@ portfolioMarginCalculate( params: PortfolioMarginCalculatorReq, ): Promise ⋮---- +/** + * Set leverage for all borrowed currencies + * + * Set leverage for all of a user's borrowed currencies. Currencies with outstanding loans cannot be changed. Values above a currency's leverage limit are capped. The response lists currencies whose updates failed together with the failure reason. + * + * @param params Parameters containing the leverage value + * @returns Promise + */ setUserLeverage( params: SetUserLeverageReq, ): Promise @@ -16404,16 +16410,56 @@ cancelSpotTriggeredOrder(params: { order_id: string; }): Promise ⋮---- +/** + * List Spot POV orders + * + * List percentage-of-volume strategy orders. Status defaults to open when listing active orders. + * + * @param params Parameters for listing Spot POV orders + * @returns Promise + */ listSpotPovOrders(params: GetSpotPovOrdersReq): Promise ⋮---- +/** + * Create a Spot POV order + * + * Create a percentage-of-volume strategy order with a target participation rate, validity period, and optional limit/trigger prices. + * + * @param params Parameters for creating a Spot POV order + * @returns Promise + */ createSpotPovOrder(params: CreateSpotPovOrderReq): Promise ⋮---- +/** + * Cancel Spot POV orders + * + * Cancel Spot POV orders in bulk. Optionally filter by currency pair. + * + * @param params Optional parameters for cancelling Spot POV orders + * @returns Promise + */ cancelSpotPovOrders( params?: CancelSpotPovOrdersReq, ): Promise ⋮---- +/** + * Query Spot POV order details + * + * Supports the order ID returned after creation, or the custom ID specified in the text field. + * + * @param params Parameters containing the order ID + * @returns Promise + */ getSpotPovOrder(params: ⋮---- +/** + * Cancel a Spot POV order + * + * Supports the order ID returned after creation, or the custom ID specified in the text field. + * + * @param params Parameters containing the order ID + * @returns Promise + */ cancelSpotPovOrder(params: ⋮---- /** @@ -19233,6 +19279,14 @@ createCrossExOrder( params: CreateCrossExOrderReq, ): Promise ⋮---- +/** + * Batch cancel CrossEx orders + * + * Cancel multiple CrossEx orders by order_id or custom text. When both are provided, order_id takes precedence. Each result reports whether the request was accepted plus any error label and message. Rate Limit: 100 requests per 10 seconds + * + * @param params Array of cancel requests (order_id and/or text) + * @returns Promise with array of batch cancel results + */ cancelBatchCrossExOrders( params: CancelBatchCrossExOrdersReq[], ): Promise @@ -19528,10 +19582,26 @@ getCrossExCoinDiscountRate( params?: GetCrossExCoinDiscountRateReq, ): Promise ⋮---- +/** + * Query CrossEx market tickers + * + * Query exchange market tickers, optionally filtered by a comma-separated list of symbols. + * + * @param params Optional parameters to filter symbols + * @returns Promise with array of market tickers + */ listCrossExMarketTickers( params?: GetCrossExMarketTickersReq, ): Promise ⋮---- +/** + * Query CrossEx market funding info + * + * Query futures funding rates, funding intervals, and next funding timestamps across exchanges. + * + * @param params Optional parameters to filter symbols + * @returns Promise with array of funding info records + */ listCrossExMarketFundingInfo( params?: GetCrossExMarketFundingInfoReq, ): Promise @@ -19633,6 +19703,14 @@ getTradFiSymbolCategories(): Promise< ⋮---- getTradFiSymbols(): Promise>> ⋮---- +/** + * Query CFD symbol commission rates + * + * At least one of symbols or category_code is required. When both are provided, symbols are filtered by category. + * + * @param params Optional filters for symbols and/or category codes + * @returns Promise with list of symbol commission rates + */ getTradFiSymbolCommissions( params?: TradFiGetSymbolCommissionsParams, ): Promise>> @@ -19705,61 +19783,161 @@ getTradFiOrderLog(params: { ⋮---- // ============ Stock ============ ⋮---- +/** + * Query user stock assets + * + * @param params Optional PnL calculation parameters + * @returns Promise with user asset details + */ getStockUserAssets( params?: GetStockUserAssetsReq, ): Promise> ⋮---- +/** + * Query stock symbol list + * + * @param params Optional filters for symbols, exchange, and pagination + * @returns Promise with paginated symbol list + */ getStockSymbols( params?: GetStockSymbolsReq, ): Promise>> ⋮---- +/** + * Query stock symbol details + * + * @param params Optional filters for symbols, exchange, and pagination + * @returns Promise with paginated symbol detail list + */ getStockSymbolDetail( params?: GetStockSymbolDetailReq, ): Promise>> ⋮---- +/** + * Query stock market order book + * + * @param symbol Symbol + * @returns Promise with order book data + */ getStockOrderBook(symbol: string): Promise> ⋮---- +/** + * Query open stock orders + * + * @param params Optional symbol filter + * @returns Promise with open order list + */ getStockOrders( params?: GetStockOrdersReq, ): Promise>> ⋮---- +/** + * Create a stock order + * + * Limit orders support only the all trading session; market orders support only regular. time_in_force supports day only. + * + * @param params Order parameters + * @returns Promise with created order ID + */ createStockOrder( params: CreateStockOrderReq, ): Promise> ⋮---- +/** + * Cancel all open stock orders + * + * @returns Promise with empty data on success + */ cancelAllStockOrders(): Promise>> ⋮---- +/** + * Query stock order history + * + * @param params Optional filters for symbol, order IDs, time range, side, and pagination + * @returns Promise with paginated historical order list + */ getStockOrderHistory( params?: GetStockOrderHistoryReq, ): Promise>> ⋮---- +/** + * Modify a stock order + * + * @param orderId Order ID + * @param params Modified volume and price + * @returns Promise with updated order ID + */ updateStockOrder( orderId: number, params: UpdateStockOrderReq, ): Promise> ⋮---- +/** + * Cancel a stock order + * + * @param orderId Order ID + * @returns Promise with empty data on success + */ cancelStockOrder( orderId: number, ): Promise>> ⋮---- +/** + * Query current stock positions + * + * @param params Optional filters for PnL calc, symbol, and exchange + * @returns Promise with position list + */ getStockPositions( params?: GetStockPositionsReq, ): Promise>> ⋮---- +/** + * Close a stock position + * + * @param params Close parameters (partial or full) + * @returns Promise with close order ID + */ closeStockPosition( params: CloseStockPositionReq, ): Promise> ⋮---- +/** + * Query stock transaction records + * + * @param params Optional filters for time range, ref_id, type, and pagination + * @returns Promise with paginated transaction list + */ getStockTransactions( params?: GetStockTransactionsReq, ): Promise>> ⋮---- +/** + * Fund transfer for stock account + * + * Transfer funds in or out of the stock account (USDT only). + * + * @param params Transfer parameters including ref_id for idempotency + * @returns Promise with empty data on success + */ createStockTransaction( params: CreateStockTransactionReq, ): Promise>> ⋮---- +/** + * Query supported stock exchanges + * + * @returns Promise with exchange list + */ getStockExchanges(): Promise>> ⋮---- +/** + * Query stock fee rates + * + * Maker/taker fee fields apply to Japanese and Korean stocks. + * + * @returns Promise with fee rate list by VIP level + */ getStockFeeRate(): Promise>> ================ From a5ae4e0a61d8a765149eec49d6cc67b4132b81d5 Mon Sep 17 00:00:00 2001 From: JJ-Cro Date: Wed, 12 Aug 2026 14:14:08 +0200 Subject: [PATCH 3/3] refactor: rename API methods for consistency and clarity - Renamed methods in RestClient from list* to get* for better clarity and consistency with naming conventions. - Updated corresponding documentation and example files to reflect these changes. - Added new example files for the updated API methods: getSpotPovOrders, getCrossExMarketTickers, and getCrossExMarketFundingInfo. --- docs/endpointFunctionList.md | 936 +++++++++--------- ...Info.js => getCrossExMarketFundingInfo.js} | 2 +- ...tTickers.js => getCrossExMarketTickers.js} | 2 +- ...stSpotPovOrders.js => getSpotPovOrders.js} | 2 +- llms.txt | 6 +- src/RestClient.ts | 6 +- 6 files changed, 476 insertions(+), 478 deletions(-) rename examples/apidoc/RestClient/{listCrossExMarketFundingInfo.js => getCrossExMarketFundingInfo.js} (93%) rename examples/apidoc/RestClient/{listCrossExMarketTickers.js => getCrossExMarketTickers.js} (94%) rename examples/apidoc/RestClient/{listSpotPovOrders.js => getSpotPovOrders.js} (95%) diff --git a/docs/endpointFunctionList.md b/docs/endpointFunctionList.md index b805f76..b90b254 100644 --- a/docs/endpointFunctionList.md +++ b/docs/endpointFunctionList.md @@ -1,4 +1,3 @@ - # Endpoint maps

@@ -10,7 +9,7 @@

-Each REST client is a JavaScript class, which provides functions individually mapped to each endpoint available in the exchange's API offering. +Each REST client is a JavaScript class, which provides functions individually mapped to each endpoint available in the exchange's API offering. The following table shows all methods available in each REST client, whether the method requires authentication (automatically handled if API keys are provided), as well as the exact endpoint each method is connected to. @@ -19,10 +18,10 @@ This can be used to easily find which method to call, once you have [found which All REST clients are in the [src](/src) folder. For usage examples, make sure to check the [examples](/examples) folder. List of clients: + - [RestClient](#RestClientts) - [WebsocketAPIClient](#WebsocketAPIClientts) - If anything is missing or wrong, please open an issue or let us know in our [Node.js Traders](https://t.me/nodetraders) telegram group! ## How to use table @@ -42,478 +41,477 @@ Table consists of 4 parts: **Endpoint** is the URL that the function uses to call the endpoint. Best way to find exact function you need for the endpoint is to search for URL in this table and find corresponding function name. - # RestClient.ts -This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in [RestClient.ts](/src/RestClient.ts). +This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in [RestClient.ts](/src/RestClient.ts). -| Function | AUTH | HTTP Method | Endpoint | -| -------- | :------: | :------: | -------- | -| [getSystemMaintenanceStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L703) | | GET | `/v1/public/system_info` | -| [submitWithdrawal()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L720) | :closed_lock_with_key: | POST | `/withdrawals` | -| [submitSpotMainAccountTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L734) | :closed_lock_with_key: | POST | `/withdrawals/push` | -| [cancelWithdrawal()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L750) | :closed_lock_with_key: | DELETE | `/withdrawals/{withdrawal_id}` | -| [getCurrencyChains()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L767) | | GET | `/wallet/currency_chains` | -| [createDepositAddress()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L777) | :closed_lock_with_key: | GET | `/wallet/deposit_address` | -| [getWithdrawalRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L791) | :closed_lock_with_key: | GET | `/wallet/withdrawals` | -| [getDepositRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L805) | :closed_lock_with_key: | GET | `/wallet/deposits` | -| [submitTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L824) | :closed_lock_with_key: | POST | `/wallet/transfers` | -| [getTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L836) | :closed_lock_with_key: | GET | `/wallet/transfers` | -| [submitMainSubTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L848) | :closed_lock_with_key: | POST | `/wallet/sub_account_transfers` | -| [getMainSubTransfers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L862) | :closed_lock_with_key: | GET | `/wallet/sub_account_transfers` | -| [submitSubToSubTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L876) | :closed_lock_with_key: | POST | `/wallet/sub_account_to_sub_account` | -| [getTransferStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L891) | :closed_lock_with_key: | GET | `/wallet/order_status` | -| [getWithdrawalStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L907) | :closed_lock_with_key: | GET | `/wallet/withdraw_status` | -| [getSubBalance()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L919) | :closed_lock_with_key: | GET | `/wallet/sub_account_balances` | -| [getSubMarginBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L931) | :closed_lock_with_key: | GET | `/wallet/sub_account_margin_balances` | -| [getSubFuturesBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L943) | :closed_lock_with_key: | GET | `/wallet/sub_account_futures_balances` | -| [getSubCrossMarginBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L956) | :closed_lock_with_key: | GET | `/wallet/sub_account_cross_margin_balances` | -| [getSavedAddresses()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L968) | :closed_lock_with_key: | GET | `/wallet/saved_address` | -| [getTradingFees()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L978) | :closed_lock_with_key: | GET | `/wallet/fee` | -| [getBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L999) | :closed_lock_with_key: | GET | `/wallet/total_balance` | -| [getSmallBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1008) | :closed_lock_with_key: | GET | `/wallet/small_balance` | -| [convertSmallBalance()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1018) | :closed_lock_with_key: | POST | `/wallet/small_balance` | -| [getSmallBalanceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1031) | :closed_lock_with_key: | GET | `/wallet/small_balance_history` | -| [getPushOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1043) | :closed_lock_with_key: | GET | `/wallet/push` | -| [getLowCapExchangeList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1052) | :closed_lock_with_key: | GET | `/wallet/getLowCapExchangeList` | -| [createSubAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1067) | :closed_lock_with_key: | POST | `/sub_accounts` | -| [getSubAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1078) | :closed_lock_with_key: | GET | `/sub_accounts` | -| [getSubAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1088) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}` | -| [createSubAccountApiKey()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1098) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/keys` | -| [getSubAccountApiKeys()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1111) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}/keys` | -| [updateSubAccountApiKey()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1125) | :closed_lock_with_key: | PUT | `/sub_accounts/{user_id}/keys/{key}` | -| [deleteSubAccountApiKey()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1136) | :closed_lock_with_key: | DELETE | `/sub_accounts/{user_id}/keys/{key}` | -| [getSubAccountApiKey()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1151) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}/keys/{key}` | -| [lockSubAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1166) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/lock` | -| [unlockSubAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1176) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/unlock` | -| [getSubAccountMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1190) | :closed_lock_with_key: | GET | `/sub_accounts/unified_mode` | -| [getUnifiedAccountInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1209) | :closed_lock_with_key: | GET | `/unified/accounts` | -| [getUnifiedMaxBorrow()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1225) | :closed_lock_with_key: | GET | `/unified/borrowable` | -| [getUnifiedMaxTransferable()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1241) | :closed_lock_with_key: | GET | `/unified/transferable` | -| [getUnifiedMaxTransferables()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1256) | :closed_lock_with_key: | GET | `/unified/transferables` | -| [getUnifiedBatchMaxBorrowable()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1265) | :closed_lock_with_key: | GET | `/unified/batch_borrowable` | -| [submitUnifiedBorrowOrRepay()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1283) | :closed_lock_with_key: | POST | `/unified/loans` | -| [getUnifiedLoans()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1295) | :closed_lock_with_key: | GET | `/unified/loans` | -| [getUnifiedLoanRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1305) | :closed_lock_with_key: | GET | `/unified/loan_records` | -| [getUnifiedInterestRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1317) | :closed_lock_with_key: | GET | `/unified/interest_records` | -| [getUnifiedRiskUnitDetails()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1328) | :closed_lock_with_key: | GET | `/unified/risk_units` | -| [setUnifiedAccountMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1340) | :closed_lock_with_key: | PUT | `/unified/unified_mode` | -| [getUnifiedAccountMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1349) | :closed_lock_with_key: | GET | `/unified/unified_mode` | -| [getUnifiedEstimateRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1361) | :closed_lock_with_key: | GET | `/unified/estimate_rate` | -| [getUnifiedCurrencyDiscountTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1372) | | GET | `/unified/currency_discount_tiers` | -| [getLoanMarginTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1384) | | GET | `/unified/loan_margin_tiers` | -| [portfolioMarginCalculate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1401) | | POST | `/unified/portfolio_calculator` | -| [setUserLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1415) | :closed_lock_with_key: | POST | `/unified/leverage/user_setting` | -| [getUserCurrencyLeverageConfig()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1429) | :closed_lock_with_key: | GET | `/unified/leverage/user_currency_config` | -| [getUserCurrencyLeverageSettings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1443) | :closed_lock_with_key: | GET | `/unified/leverage/user_currency_setting` | -| [updateUserCurrencyLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1458) | :closed_lock_with_key: | POST | `/unified/leverage/user_currency_setting` | -| [getUnifiedLoanCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1473) | :closed_lock_with_key: | GET | `/unified/currencies` | -| [getHistoricalLendingRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1485) | :closed_lock_with_key: | GET | `/unified/history_loan_rate` | -| [submitUnifiedLoanRepay()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1491) | :closed_lock_with_key: | POST | `/unified/loans/repay` | -| [getEstimatedQuickRepayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1498) | :closed_lock_with_key: | GET | `/unified/estimated_quick_repayment` | -| [createQuickRepayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1505) | :closed_lock_with_key: | POST | `/unified/quick_repayment` | -| [setUnifiedDeltaNeutral()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1516) | :closed_lock_with_key: | POST | `/unified/delta_neutral` | -| [getUnifiedDeltaNeutral()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1525) | :closed_lock_with_key: | GET | `/unified/delta_neutral` | -| [getSpotCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1545) | | GET | `/spot/currencies` | -| [getSpotCurrency()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1555) | | GET | `/spot/currencies/{currency}` | -| [getSpotCurrencyPairs()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1564) | | GET | `/spot/currency_pairs` | -| [getSpotCurrencyPair()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1574) | | GET | `/spot/currency_pairs/{currency_pair}` | -| [getSpotTicker()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1588) | | GET | `/spot/tickers` | -| [getSpotOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1603) | | GET | `/spot/order_book` | -| [getSpotTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1616) | | GET | `/spot/trades` | -| [getSpotCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1628) | | GET | `/spot/candlesticks` | -| [getSpotFeeRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1640) | :closed_lock_with_key: | GET | `/spot/fee` | -| [getSpotBatchFeeRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1649) | :closed_lock_with_key: | GET | `/spot/batch_fee` | -| [getSpotAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1661) | :closed_lock_with_key: | GET | `/spot/accounts` | -| [getSpotAccountBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1673) | :closed_lock_with_key: | GET | `/spot/account_book` | -| [submitSpotBatchOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1692) | :closed_lock_with_key: | POST | `/spot/batch_orders` | -| [getSpotOpenOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1719) | :closed_lock_with_key: | GET | `/spot/open_orders` | -| [submitSpotClosePosCrossDisabled()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1735) | :closed_lock_with_key: | POST | `/spot/cross_liquidate_orders` | -| [submitSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1751) | :closed_lock_with_key: | POST | `/spot/orders` | -| [getSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1768) | :closed_lock_with_key: | GET | `/spot/orders` | -| [cancelSpotOpenOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1783) | :closed_lock_with_key: | DELETE | `/spot/orders` | -| [batchCancelSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1811) | :closed_lock_with_key: | POST | `/spot/cancel_batch_orders` | -| [getSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1836) | :closed_lock_with_key: | GET | `/spot/orders/{order_id}` | -| [updateSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1853) | :closed_lock_with_key: | PATCH | `/spot/orders/{order_id}` | -| [cancelSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1881) | :closed_lock_with_key: | DELETE | `/spot/orders/{order_id}` | -| [getSpotTradingHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1910) | :closed_lock_with_key: | GET | `/spot/my_trades` | -| [submitSpotCountdownOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1939) | :closed_lock_with_key: | POST | `/spot/countdown_cancel_all` | -| [batchUpdateSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1958) | :closed_lock_with_key: | POST | `/spot/amend_batch_orders` | -| [getSpotInsuranceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1985) | :closed_lock_with_key: | GET | `/spot/insurance_history` | -| [submitSpotPriceTriggerOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1999) | :closed_lock_with_key: | POST | `/spot/price_orders` | -| [getSpotAutoOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2011) | :closed_lock_with_key: | GET | `/spot/price_orders` | -| [cancelAllOpenSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2023) | :closed_lock_with_key: | DELETE | `/spot/price_orders` | -| [getPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2036) | :closed_lock_with_key: | GET | `/spot/price_orders/{order_id}` | -| [cancelSpotTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2048) | :closed_lock_with_key: | DELETE | `/spot/price_orders/{order_id}` | -| [listSpotPovOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2062) | :closed_lock_with_key: | GET | `/spot/pov_orders` | -| [createSpotPovOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2074) | :closed_lock_with_key: | POST | `/spot/pov_orders` | -| [cancelSpotPovOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2086) | :closed_lock_with_key: | POST | `/spot/pov_orders/cancel` | -| [getSpotPovOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2100) | :closed_lock_with_key: | GET | `/spot/pov_orders/{order_id}` | -| [cancelSpotPovOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2112) | :closed_lock_with_key: | POST | `/spot/pov_orders/{order_id}/cancel` | -| [setCollateralCurrency()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2124) | :closed_lock_with_key: | POST | `/unified/collateral_currencies` | -| [getMarginAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2145) | :closed_lock_with_key: | GET | `/margin/accounts` | -| [getMarginBalanceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2159) | :closed_lock_with_key: | GET | `/margin/account_book` | -| [getFundingAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2177) | :closed_lock_with_key: | GET | `/margin/funding_accounts` | -| [updateAutoRepaymentSetting()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2195) | :closed_lock_with_key: | POST | `/margin/auto_repay` | -| [getAutoRepaymentSetting()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2206) | :closed_lock_with_key: | GET | `/margin/auto_repay` | -| [getMarginTransferableAmount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2220) | :closed_lock_with_key: | GET | `/margin/transferable` | -| [getCrossMarginCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2237) | | GET | `/margin/cross/currencies` | -| [getCrossMarginCurrency()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2248) | | GET | `/margin/cross/currencies/{currency}` | -| [getCrossMarginAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2260) | :closed_lock_with_key: | GET | `/margin/cross/accounts` | -| [getCrossMarginAccountHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2273) | :closed_lock_with_key: | GET | `/margin/cross/account_book` | -| [submitCrossMarginBorrowLoan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2290) | :closed_lock_with_key: | POST | `/margin/cross/loans` | -| [getCrossMarginBorrowHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2305) | :closed_lock_with_key: | GET | `/margin/cross/loans` | -| [getCrossMarginBorrowLoan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2318) | :closed_lock_with_key: | GET | `/margin/cross/loans/{loan_id}` | -| [submitCrossMarginRepayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2333) | :closed_lock_with_key: | POST | `/margin/cross/repayments` | -| [getCrossMarginRepayments()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2349) | :closed_lock_with_key: | GET | `/margin/cross/repayments` | -| [getCrossMarginInterestRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2362) | :closed_lock_with_key: | GET | `/margin/cross/interest_records` | -| [getCrossMarginTransferableAmount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2378) | :closed_lock_with_key: | GET | `/margin/cross/transferable` | -| [getEstimatedInterestRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2394) | :closed_lock_with_key: | GET | `/margin/cross/estimate_rate` | -| [getCrossMarginBorrowableAmount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2408) | :closed_lock_with_key: | GET | `/margin/cross/borrowable` | -| [getMarginUserLoanTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2421) | :closed_lock_with_key: | GET | `/margin/user/loan_margin_tiers` | -| [getMarginPublicLoanTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2437) | | GET | `/margin/loan_margin_tiers` | -| [setMarginUserLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2453) | :closed_lock_with_key: | POST | `/margin/leverage/user_market_setting` | -| [getMarginUserAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2470) | :closed_lock_with_key: | GET | `/margin/user/account` | -| [getLendingMarkets()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2485) | | GET | `/margin/uni/currency_pairs` | -| [getLendingMarket()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2500) | | GET | `/margin/uni/currency_pairs/{currency_pair}` | -| [getEstimatedInterestRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2512) | :closed_lock_with_key: | GET | `/margin/uni/estimate_rate` | -| [submitMarginUNIBorrowOrRepay()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2522) | :closed_lock_with_key: | POST | `/margin/uni/loans` | -| [getMarginUNILoans()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2538) | :closed_lock_with_key: | GET | `/margin/uni/loans` | -| [getMarginUNILoanRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2548) | :closed_lock_with_key: | GET | `/margin/uni/loan_records` | -| [getMarginUNIInterestRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2560) | :closed_lock_with_key: | GET | `/margin/uni/interest_records` | -| [getMarginUNIMaxBorrow()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2572) | :closed_lock_with_key: | GET | `/margin/uni/borrowable` | -| [getFlashSwapCurrencyPairs()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2588) | | GET | `/flash_swap/currency_pairs` | -| [submitFlashSwapOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2604) | :closed_lock_with_key: | POST | `/flash_swap/orders` | -| [getFlashSwapOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2616) | :closed_lock_with_key: | GET | `/flash_swap/orders` | -| [getFlashSwapOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2628) | :closed_lock_with_key: | GET | `/flash_swap/orders/{order_id}` | -| [submitFlashSwapOrderPreview()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2638) | :closed_lock_with_key: | POST | `/flash_swap/orders/preview` | -| [getFuturesContracts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2655) | | GET | `/futures/{settle}/contracts` | -| [getFuturesContract()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2670) | | GET | `/futures/{settle}/contracts/{contract}` | -| [getFuturesOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2685) | | GET | `/futures/{settle}/order_book` | -| [getFuturesTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2698) | | GET | `/futures/{settle}/trades` | -| [getFuturesCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2713) | | GET | `/futures/{settle}/candlesticks` | -| [getPremiumIndexKLines()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2726) | | GET | `/futures/{settle}/premium_index` | -| [getFuturesTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2739) | | GET | `/futures/{settle}/tickers` | -| [getFundingRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2756) | | GET | `/futures/{settle}/funding_rate` | -| [getBatchFundingRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2772) | | POST | `/futures/{settle}/funding_rates` | -| [getFuturesInsuranceBalanceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2790) | | GET | `/futures/{settle}/insurance` | -| [getFuturesStats()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2809) | | GET | `/futures/{settle}/contract_stats` | -| [getIndexConstituents()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2820) | | GET | `/futures/{settle}/index_constituents/{index}` | -| [getLiquidationHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2837) | | GET | `/futures/{settle}/liq_orders` | -| [getRiskLimitTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2854) | | GET | `/futures/{settle}/risk_limit_tiers` | -| [getFuturesAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2867) | :closed_lock_with_key: | GET | `/futures/{settle}/accounts` | -| [getFuturesAccountBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2881) | :closed_lock_with_key: | GET | `/futures/{settle}/account_book` | -| [getFuturesPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2894) | :closed_lock_with_key: | GET | `/futures/{settle}/positions` | -| [getFuturesPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2909) | :closed_lock_with_key: | GET | `/futures/{settle}/positions/{contract}` | -| [updateFuturesMargin()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2926) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/margin` | -| [updateFuturesLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2954) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/leverage` | -| [getFuturesContractLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2974) | :closed_lock_with_key: | GET | `/futures/{settle}/get_leverage/{contract}` | -| [updateFuturesPositionMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2990) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/cross_mode` | -| [updatePositionRiskLimit()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3007) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/risk_limit` | -| [updateFuturesDualMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3027) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_mode` | -| [getDualModePosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3043) | :closed_lock_with_key: | GET | `/futures/{settle}/dual_comp/positions/{contract}` | -| [updateDualModePositionMargin()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3058) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/margin` | -| [updateDualModePositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3074) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/leverage` | -| [updateDualModePositionRiskLimit()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3098) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/risk_limit` | -| [submitFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3125) | :closed_lock_with_key: | POST | `/futures/{settle}/orders` | -| [getFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3146) | :closed_lock_with_key: | GET | `/futures/{settle}/orders` | -| [cancelAllFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3161) | :closed_lock_with_key: | DELETE | `/futures/{settle}/orders` | -| [getFuturesOrdersByTimeRange()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3181) | :closed_lock_with_key: | GET | `/futures/{settle}/orders_timerange` | -| [submitFuturesBatchOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3204) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_orders` | -| [getFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3229) | :closed_lock_with_key: | GET | `/futures/{settle}/orders/{order_id}` | -| [cancelFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3246) | :closed_lock_with_key: | DELETE | `/futures/{settle}/orders/{order_id}` | -| [updateFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3271) | :closed_lock_with_key: | PUT | `/futures/{settle}/orders/{order_id}` | -| [getFuturesTradingHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3292) | :closed_lock_with_key: | GET | `/futures/{settle}/my_trades` | -| [getFuturesTradingHistoryByTimeRange()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3307) | :closed_lock_with_key: | GET | `/futures/{settle}/my_trades_timerange` | -| [getFuturesPositionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3320) | :closed_lock_with_key: | GET | `/futures/{settle}/position_close` | -| [getFuturesLiquidationHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3333) | :closed_lock_with_key: | GET | `/futures/{settle}/liquidates` | -| [getFuturesAutoDeleveragingHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3346) | :closed_lock_with_key: | GET | `/futures/{settle}/auto_deleverages` | -| [setFuturesOrderCancelCountdown()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3363) | :closed_lock_with_key: | POST | `/futures/{settle}/countdown_cancel_all` | -| [getFuturesUserTradingFees()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3380) | :closed_lock_with_key: | GET | `/futures/{settle}/fee` | -| [batchCancelFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3398) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_cancel_orders` | -| [batchUpdateFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3425) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_amend_orders` | -| [getRiskLimitTable()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3447) | | GET | `/futures/{settle}/risk_limit_table` | -| [submitFuturesPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3460) | :closed_lock_with_key: | POST | `/futures/{settle}/price_orders` | -| [getFuturesAutoOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3473) | :closed_lock_with_key: | GET | `/futures/{settle}/price_orders` | -| [cancelAllOpenFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3486) | :closed_lock_with_key: | DELETE | `/futures/{settle}/price_orders` | -| [getFuturesPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3502) | :closed_lock_with_key: | GET | `/futures/{settle}/price_orders/{order_id}` | -| [cancelFuturesPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3517) | :closed_lock_with_key: | DELETE | `/futures/{settle}/price_orders/{order_id}` | -| [updateFuturesPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3532) | :closed_lock_with_key: | PUT | `/futures/{settle}/price_orders/amend` | -| [createTrailOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3547) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/create` | -| [terminateTrailOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3565) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/stop` | -| [batchTerminateTrailOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3578) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/stop_all` | -| [getTrailOrderList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3593) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/list` | -| [getTrailOrderDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3606) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/detail` | -| [updateTrailOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3624) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/update` | -| [getTrailOrderChangeLog()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3637) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/change_log` | -| [createChaseOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3650) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/create` | -| [stopChaseOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3660) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/stop` | -| [stopAllChaseOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3670) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/stop_all` | -| [getChaseOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3682) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/chase/list` | -| [getChaseOrderDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3690) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/chase/detail` | -| [getFuturesPositionCloseHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3699) | :closed_lock_with_key: | GET | `/futures/{settle}/position_close_history` | -| [getFuturesInsuranceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3708) | :closed_lock_with_key: | GET | `/futures/{settle}/insurance` | -| [getAllDeliveryContracts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3725) | | GET | `/delivery/{settle}/contracts` | -| [getDeliveryContract()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3737) | | GET | `/delivery/{settle}/contracts/{contract}` | -| [getDeliveryOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3752) | | GET | `/delivery/{settle}/order_book` | -| [getDeliveryTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3765) | | GET | `/delivery/{settle}/trades` | -| [getDeliveryCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3779) | | GET | `/delivery/{settle}/candlesticks` | -| [getDeliveryTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3790) | | GET | `/delivery/{settle}/tickers` | -| [getDeliveryInsuranceBalanceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3807) | | GET | `/delivery/{settle}/insurance` | -| [getDeliveryAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3826) | :closed_lock_with_key: | GET | `/delivery/{settle}/accounts` | -| [getDeliveryBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3837) | :closed_lock_with_key: | GET | `/delivery/{settle}/account_book` | -| [getDeliveryPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3848) | :closed_lock_with_key: | GET | `/delivery/{settle}/positions` | -| [getDeliveryPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3858) | :closed_lock_with_key: | GET | `/delivery/{settle}/positions/{contract}` | -| [updateDeliveryMargin()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3873) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/margin` | -| [updateDeliveryLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3891) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/leverage` | -| [updateDeliveryRiskLimit()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3909) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/risk_limit` | -| [submitDeliveryOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3929) | :closed_lock_with_key: | POST | `/delivery/{settle}/orders` | -| [getDeliveryOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3944) | :closed_lock_with_key: | GET | `/delivery/{settle}/orders` | -| [cancelAllDeliveryOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3957) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/orders` | -| [getDeliveryOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3976) | :closed_lock_with_key: | GET | `/delivery/{settle}/orders/{order_id}` | -| [cancelDeliveryOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3991) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/orders/{order_id}` | -| [getDeliveryTradingHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4006) | :closed_lock_with_key: | GET | `/delivery/{settle}/my_trades` | -| [getDeliveryClosedPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4019) | :closed_lock_with_key: | GET | `/delivery/{settle}/position_close` | -| [getDeliveryLiquidationHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4032) | :closed_lock_with_key: | GET | `/delivery/{settle}/liquidates` | -| [getDeliverySettlementHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4045) | :closed_lock_with_key: | GET | `/delivery/{settle}/settlements` | -| [submitDeliveryTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4058) | :closed_lock_with_key: | POST | `/delivery/{settle}/price_orders` | -| [getDeliveryAutoOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4073) | :closed_lock_with_key: | GET | `/delivery/{settle}/price_orders` | -| [cancelAllOpenDeliveryOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4086) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/price_orders` | -| [getDeliveryTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4102) | :closed_lock_with_key: | GET | `/delivery/{settle}/price_orders/{order_id}` | -| [cancelTriggeredDeliveryOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4117) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/price_orders/{order_id}` | -| [getOptionsUnderlyings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4136) | | GET | `/options/underlyings` | -| [getOptionsExpirationTimes()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4146) | | GET | `/options/expirations` | -| [getOptionsContracts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4156) | | GET | `/options/contracts` | -| [getOptionsContract()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4169) | | GET | `/options/contracts/{contract}` | -| [getOptionsSettlementHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4179) | | GET | `/options/settlements` | -| [getOptionsContractSettlement()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4191) | | GET | `/options/settlements/{contract}` | -| [getOptionsMySettlements()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4206) | :closed_lock_with_key: | GET | `/options/my_settlements` | -| [getOptionsOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4220) | | GET | `/options/order_book` | -| [getOptionsTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4232) | | GET | `/options/tickers` | -| [getOptionsUnderlyingTicker()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4246) | | GET | `/options/underlying/tickers/{underlying}` | -| [getOptionsCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4260) | | GET | `/options/candlesticks` | -| [getOptionsUnderlyingCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4270) | | GET | `/options/underlying/candlesticks` | -| [getOptionsTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4282) | | GET | `/options/trades` | -| [getOptionsAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4293) | :closed_lock_with_key: | GET | `/options/accounts` | -| [getOptionsAccountChange()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4303) | :closed_lock_with_key: | GET | `/options/account_book` | -| [getOptionsPositionsUnderlying()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4315) | :closed_lock_with_key: | GET | `/options/positions` | -| [getOptionsPositionContract()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4327) | :closed_lock_with_key: | GET | `/options/positions/{contract}` | -| [getOptionsLiquidation()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4339) | :closed_lock_with_key: | GET | `/options/position_close` | -| [submitOptionsOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4352) | :closed_lock_with_key: | POST | `/options/orders` | -| [getOptionsOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4364) | :closed_lock_with_key: | GET | `/options/orders` | -| [cancelAllOpenOptionsOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4376) | :closed_lock_with_key: | DELETE | `/options/orders` | -| [getOptionsOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4390) | :closed_lock_with_key: | GET | `/options/orders/{order_id}` | -| [amendOptionsOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4402) | :closed_lock_with_key: | PUT | `/options/orders/{order_id}` | -| [cancelOptionsOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4417) | :closed_lock_with_key: | DELETE | `/options/orders/{order_id}` | -| [submitOptionsCountdownCancel()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4436) | :closed_lock_with_key: | POST | `/options/countdown_cancel_all` | -| [getOptionsPersonalHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4452) | :closed_lock_with_key: | GET | `/options/my_trades` | -| [setOptionsMMPSettings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4464) | :closed_lock_with_key: | POST | `/options/mmp` | -| [getOptionsMMPSettings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4476) | :closed_lock_with_key: | GET | `/options/mmp` | -| [resetOptionsMMPSettings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4488) | :closed_lock_with_key: | POST | `/options/mmp/reset` | -| [getLendingCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4504) | | GET | `/earn/uni/currencies` | -| [getLendingCurrency()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4514) | | GET | `/earn/uni/currencies/{currency}` | -| [submitLendOrRedeemOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4524) | :closed_lock_with_key: | POST | `/earn/uni/lends` | -| [getLendingOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4534) | :closed_lock_with_key: | GET | `/earn/uni/lends` | -| [updateLendingOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4546) | :closed_lock_with_key: | PATCH | `/earn/uni/lends` | -| [getLendingRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4559) | :closed_lock_with_key: | GET | `/earn/uni/lend_records` | -| [getLendingTotalInterest()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4572) | :closed_lock_with_key: | GET | `/earn/uni/interests/{currency}` | -| [getLendingInterestRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4585) | :closed_lock_with_key: | GET | `/earn/uni/interest_records` | -| [updateInterestReinvestment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4598) | :closed_lock_with_key: | PUT | `/earn/uni/interest_reinvest` | -| [getLendingInterestStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4614) | :closed_lock_with_key: | GET | `/earn/uni/interest_status/{currency}` | -| [getLendingAnnualizedTrendChart()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4629) | :closed_lock_with_key: | GET | `/earn/uni/chart` | -| [getLendingEstimatedRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4637) | :closed_lock_with_key: | GET | `/earn/uni/rate` | -| [submitMultiLoanOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4654) | :closed_lock_with_key: | POST | `/loan/multi_collateral/orders` | -| [getMultiLoanOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4666) | :closed_lock_with_key: | GET | `/loan/multi_collateral/orders` | -| [getMultiLoanOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4678) | :closed_lock_with_key: | GET | `/loan/multi_collateral/orders/{order_id}` | -| [repayMultiLoan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4688) | :closed_lock_with_key: | POST | `/loan/multi_collateral/repay` | -| [getMultiLoanRepayRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4698) | :closed_lock_with_key: | GET | `/loan/multi_collateral/repay` | -| [updateMultiLoan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4710) | :closed_lock_with_key: | POST | `/loan/multi_collateral/mortgage` | -| [getMultiLoanAdjustmentRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4722) | :closed_lock_with_key: | GET | `/loan/multi_collateral/mortgage` | -| [getMultiLoanCurrencyQuota()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4734) | :closed_lock_with_key: | GET | `/loan/multi_collateral/currency_quota` | -| [getMultiLoanSupportedCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4746) | | GET | `/loan/multi_collateral/currencies` | -| [getMultiLoanRatio()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4755) | | GET | `/loan/multi_collateral/ltv` | -| [getMultiLoanFixedRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4764) | | GET | `/loan/multi_collateral/fixed_rate` | -| [getMultiLoanCurrentRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4777) | | GET | `/loan/multi_collateral/current_rate` | -| [getDualInvestmentProducts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4799) | | GET | `/earn/dual/investment_plan` | -| [getDualInvestmentOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4810) | :closed_lock_with_key: | GET | `/earn/dual/orders` | -| [submitDualInvestmentOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4822) | :closed_lock_with_key: | POST | `/earn/dual/orders` | -| [getDualOrderRefundPreview()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4831) | :closed_lock_with_key: | GET | `/earn/dual/order-refund-preview` | -| [submitDualOrderRefund()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4840) | :closed_lock_with_key: | POST | `/earn/dual/order-refund` | -| [updateDualOrderReinvest()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4849) | :closed_lock_with_key: | POST | `/earn/dual/modify-order-reinvest` | -| [getDualProjectRecommend()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4860) | :closed_lock_with_key: | GET | `/earn/dual/project-recommend` | -| [getEarnFixedTermProducts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4869) | | GET | `/earn/fixed-term/product` | -| [getEarnFixedTermProductsByAsset()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4878) | | GET | `/earn/fixed-term/product/{asset}/list` | -| [createEarnFixedTermLend()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4888) | :closed_lock_with_key: | POST | `/earn/fixed-term/user/lend` | -| [getEarnFixedTermLends()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4897) | :closed_lock_with_key: | GET | `/earn/fixed-term/user/lend` | -| [createEarnFixedTermPreRedeem()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4906) | :closed_lock_with_key: | POST | `/earn/fixed-term/user/pre-redeem` | -| [getEarnFixedTermHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4917) | :closed_lock_with_key: | GET | `/earn/fixed-term/user/history` | -| [createAutoInvestPlan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4926) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/create` | -| [updateAutoInvestPlan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4935) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/update` | -| [stopAutoInvestPlan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4942) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/stop` | -| [addAutoInvestPlanPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4949) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/add_position` | -| [getAutoInvestCoins()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4960) | :closed_lock_with_key: | GET | `/earn/autoinvest/coins` | -| [getAutoInvestMinAmount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4969) | :closed_lock_with_key: | POST | `/earn/autoinvest/min_invest_amount` | -| [getAutoInvestPlanRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4980) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/records` | -| [getAutoInvestOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4989) | :closed_lock_with_key: | GET | `/earn/autoinvest/orders` | -| [getAutoInvestConfig()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4998) | :closed_lock_with_key: | GET | `/earn/autoinvest/config` | -| [getAutoInvestPlanDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5005) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/detail` | -| [getAutoInvestPlans()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5014) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/list_info` | -| [getStakingCoins()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5026) | :closed_lock_with_key: | GET | `/earn/staking/coins` | -| [submitStakingSwap()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5039) | :closed_lock_with_key: | POST | `/earn/staking/swap` | -| [getAccountDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5058) | :closed_lock_with_key: | GET | `/account/detail` | -| [getAccountRateLimit()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5067) | :closed_lock_with_key: | GET | `/account/rate_limit` | -| [createStpGroup()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5077) | :closed_lock_with_key: | POST | `/account/stp_groups` | -| [getStpGroups()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5087) | :closed_lock_with_key: | GET | `/account/stp_groups` | -| [getStpGroupUsers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5097) | :closed_lock_with_key: | GET | `/account/stp_groups/{stp_id}/users` | -| [addUsersToStpGroup()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5107) | :closed_lock_with_key: | POST | `/account/stp_groups/{stp_id}/users` | -| [deleteUserFromStpGroup()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5123) | :closed_lock_with_key: | DELETE | `/account/stp_groups/{stp_id}/users` | -| [setGTDeduction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5141) | :closed_lock_with_key: | POST | `/account/debit_fee` | -| [getGTDeduction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5152) | :closed_lock_with_key: | GET | `/account/debit_fee` | -| [getAccountMainKeys()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5161) | :closed_lock_with_key: | GET | `/account/main_keys` | -| [getAgencyTransactionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5177) | :closed_lock_with_key: | GET | `/rebate/agency/transaction_history` | -| [getAgencyCommissionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5190) | :closed_lock_with_key: | GET | `/rebate/agency/commission_history` | -| [getPartnerTransactionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5204) | :closed_lock_with_key: | GET | `/rebate/partner/transaction_history` | -| [getPartnerCommissionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5219) | :closed_lock_with_key: | GET | `/rebate/partner/commission_history` | -| [getPartnerSubordinateList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5242) | :closed_lock_with_key: | GET | `/rebate/partner/sub_list` | -| [getPartnerAgentDataAggregated()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5252) | :closed_lock_with_key: | GET | `/rebate/partner/data/aggregated` | -| [getBrokerCommissionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5265) | :closed_lock_with_key: | GET | `/rebate/broker/commission_history` | -| [getBrokerTransactionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5278) | :closed_lock_with_key: | GET | `/rebate/broker/transaction_history` | -| [getUserRebateInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5287) | :closed_lock_with_key: | GET | `/rebate/user/info` | -| [createOTCQuote()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5322) | :closed_lock_with_key: | POST | `/otc/quote` | -| [createOTCFiatOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5334) | :closed_lock_with_key: | POST | `/otc/order/create` | -| [createOTCStablecoinOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5348) | :closed_lock_with_key: | POST | `/otc/stable_coin/order/create` | -| [getOTCBankList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5357) | :closed_lock_with_key: | GET | `/otc/bank/list` | -| [getOTCBankListLegacy()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5364) | :closed_lock_with_key: | GET | `/otc/bank_list` | -| [createOTCBank()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5371) | :closed_lock_with_key: | POST | `/otc/bank/delete` | -| [deleteOTCBank()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5382) | :closed_lock_with_key: | POST | `/otc/bank/delete` | -| [setDefaultOTCBank()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5389) | :closed_lock_with_key: | POST | `/otc/bank/set_default` | -| [getOTCBankSupplementChecklist()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5396) | :closed_lock_with_key: | GET | `/otc/bank/bank_supplement_checklist` | -| [submitOTCBankPersonalSupplement()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5405) | :closed_lock_with_key: | POST | `/otc/order/paid` | -| [submitOTCBankEnterpriseSupplement()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5424) | :closed_lock_with_key: | POST | `/otc/order/paid` | -| [markOTCOrderAsPaid()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5460) | :closed_lock_with_key: | POST | `/otc/order/paid` | -| [cancelOTCOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5474) | :closed_lock_with_key: | POST | `/otc/order/cancel` | -| [getOTCFiatOrderList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5486) | :closed_lock_with_key: | GET | `/otc/order/list` | -| [getOTCStablecoinOrderList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5500) | :closed_lock_with_key: | GET | `/otc/stable_coin/order/list` | -| [getOTCFiatOrderDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5514) | :closed_lock_with_key: | GET | `/otc/order/detail` | -| [getP2PMerchantUserInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5528) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_user_info` | -| [getP2PMerchantCounterpartyUserInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5537) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_counterparty_user_info` | -| [getP2PMerchantMyselfPayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5549) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_myself_payment` | -| [getP2PMerchantSpotBalance()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5562) | :closed_lock_with_key: | POST | `/p2p/merchant/account/set_merchant_work_hours` | -| [setP2PMerchantWorkHours()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5571) | :closed_lock_with_key: | POST | `/p2p/merchant/account/set_merchant_work_hours` | -| [getP2PMerchantPendingTransactionList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5582) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_pending_transaction_list` | -| [getP2PMerchantCompletedTransactionList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5594) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_completed_transaction_list` | -| [getP2PMerchantTransactionDetails()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5606) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_transaction_details` | -| [confirmP2PMerchantPayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5618) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/confirm-payment` | -| [confirmP2PMerchantReceipt()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5629) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/confirm-receipt` | -| [cancelP2PMerchantTransaction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5640) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/cancel` | -| [placeP2PMerchantBizPushOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5651) | :closed_lock_with_key: | POST | `/p2p/merchant/books/place_biz_push_order` | -| [updateP2PMerchantAdsStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5662) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_update_status` | -| [getP2PMerchantAdsDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5675) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_detail` | -| [getP2PMerchantMyAdsList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5684) | :closed_lock_with_key: | POST | `/p2p/merchant/books/my_ads_list` | -| [getP2PMerchantAdsList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5695) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_list` | -| [getP2PMerchantChatsList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5704) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/get_chats_list` | -| [sendP2PMerchantChatMessage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5715) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/send_chat_message` | -| [uploadP2PMerchantChatFile()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5726) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/upload_chat_file` | -| [getCrossExSymbols()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5747) | | GET | `/crossex/rule/symbols` | -| [getCrossExRiskLimits()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5759) | | GET | `/crossex/rule/risk_limits` | -| [getCrossExTransferCoins()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5773) | | GET | `/crossex/transfers/coin` | -| [createCrossExTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5787) | :closed_lock_with_key: | POST | `/crossex/transfers` | -| [getCrossExTransferHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5801) | :closed_lock_with_key: | GET | `/crossex/transfers` | -| [createCrossExOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5815) | :closed_lock_with_key: | POST | `/crossex/orders` | -| [cancelBatchCrossExOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5829) | :closed_lock_with_key: | POST | `/crossex/batch_cancel_orders` | -| [cancelCrossExOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5843) | :closed_lock_with_key: | DELETE | `/crossex/orders/{order_id}` | -| [modifyCrossExOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5856) | :closed_lock_with_key: | PUT | `/crossex/orders/{order_id}` | -| [getCrossExOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5871) | :closed_lock_with_key: | GET | `/crossex/orders/{order_id}` | -| [createCrossExConvertQuote()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5883) | :closed_lock_with_key: | POST | `/crossex/convert/quote` | -| [createCrossExConvertOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5897) | :closed_lock_with_key: | POST | `/crossex/convert/orders` | -| [updateCrossExAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5911) | :closed_lock_with_key: | PUT | `/crossex/accounts` | -| [getCrossExAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5925) | :closed_lock_with_key: | GET | `/crossex/accounts` | -| [setCrossExPositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5937) | :closed_lock_with_key: | POST | `/crossex/positions/leverage` | -| [getCrossExPositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5951) | :closed_lock_with_key: | GET | `/crossex/positions/leverage` | -| [setCrossExMarginPositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5965) | :closed_lock_with_key: | POST | `/crossex/margin_positions/leverage` | -| [getCrossExMarginPositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5981) | :closed_lock_with_key: | GET | `/crossex/margin_positions/leverage` | -| [closeCrossExPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5995) | :closed_lock_with_key: | POST | `/crossex/position` | -| [getCrossExInterestRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6009) | :closed_lock_with_key: | GET | `/crossex/interest_rate` | -| [getCrossExFeeRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6022) | :closed_lock_with_key: | GET | `/crossex/fee` | -| [getCrossExPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6034) | :closed_lock_with_key: | GET | `/crossex/positions` | -| [getCrossExMarginPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6048) | :closed_lock_with_key: | GET | `/crossex/margin_positions` | -| [getCrossExAdlRank()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6062) | :closed_lock_with_key: | GET | `/crossex/adl_rank` | -| [getCrossExOpenOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6074) | :closed_lock_with_key: | GET | `/crossex/open_orders` | -| [getCrossExHistoryOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6088) | :closed_lock_with_key: | GET | `/crossex/history_orders` | -| [getCrossExHistoryPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6102) | :closed_lock_with_key: | GET | `/crossex/history_positions` | -| [getCrossExHistoryMarginPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6116) | :closed_lock_with_key: | GET | `/crossex/history_margin_positions` | -| [getCrossExHistoryMarginInterests()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6130) | :closed_lock_with_key: | GET | `/crossex/history_margin_interests` | -| [getCrossExHistoryTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6144) | :closed_lock_with_key: | GET | `/crossex/history_trades` | -| [getCrossExAccountBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6158) | :closed_lock_with_key: | GET | `/crossex/account_book` | -| [getCrossExCoinDiscountRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6172) | :closed_lock_with_key: | GET | `/crossex/coin_discount_rate` | -| [listCrossExMarketTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6186) | | GET | `/crossex/market/tickers` | -| [listCrossExMarketFundingInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6200) | | GET | `/crossex/market/funding_info` | -| [getAlphaAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6218) | :closed_lock_with_key: | GET | `/alpha/accounts` | -| [getAlphaAccountBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6230) | :closed_lock_with_key: | GET | `/alpha/account_book` | -| [createAlphaQuote()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6244) | :closed_lock_with_key: | POST | `/alpha/quote` | -| [createAlphaOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6256) | :closed_lock_with_key: | POST | `/alpha/orders` | -| [getAlphaOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6268) | :closed_lock_with_key: | GET | `/alpha/orders` | -| [getAlphaOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6280) | :closed_lock_with_key: | GET | `/alpha/order` | -| [getAlphaCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6292) | | GET | `/alpha/currencies` | -| [getAlphaTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6304) | | GET | `/alpha/tickers` | -| [getTradFiMT5Account()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6310) | :closed_lock_with_key: | GET | `/tradfi/users/mt5-account` | -| [getTradFiSymbolCategories()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6314) | | GET | `/tradfi/symbols/categories` | -| [getTradFiSymbols()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6320) | | GET | `/tradfi/symbols` | -| [getTradFiSymbolCommissions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6332) | | GET | `/tradfi/symbols/commissions` | -| [getTradFiSymbolDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6338) | :closed_lock_with_key: | GET | `/tradfi/symbols/detail` | -| [getTradFiKlines()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6344) | | GET | `/tradfi/symbols/{symbol}/klines` | -| [getTradFiTicker()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6351) | | GET | `/tradfi/symbols/{symbol}/tickers` | -| [createTradFiUser()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6355) | :closed_lock_with_key: | POST | `/tradfi/users` | -| [getTradFiAssets()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6359) | :closed_lock_with_key: | GET | `/tradfi/users/assets` | -| [createTradFiTransaction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6363) | :closed_lock_with_key: | POST | `/tradfi/transactions` | -| [getTradFiTransactions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6369) | :closed_lock_with_key: | GET | `/tradfi/transactions` | -| [createTradFiOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6375) | :closed_lock_with_key: | POST | `/tradfi/orders` | -| [getTradFiOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6381) | :closed_lock_with_key: | GET | `/tradfi/orders` | -| [modifyTradFiOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6385) | :closed_lock_with_key: | PUT | `/tradfi/orders/{orderId}` | -| [cancelTradFiOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6392) | :closed_lock_with_key: | DELETE | `/tradfi/orders/{orderId}` | -| [getTradFiOrderHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6396) | :closed_lock_with_key: | GET | `/tradfi/orders/history` | -| [getTradFiPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6402) | :closed_lock_with_key: | GET | `/tradfi/positions` | -| [modifyTradFiPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6408) | :closed_lock_with_key: | PUT | `/tradfi/positions/{positionId}` | -| [closeTradFiPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6417) | :closed_lock_with_key: | POST | `/tradfi/positions/{positionId}/close` | -| [getTradFiPositionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6426) | :closed_lock_with_key: | GET | `/tradfi/positions/history` | -| [getTradFiOrderLog()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6435) | :closed_lock_with_key: | GET | `/tradfi/orders/log/{log_id}` | -| [getStockUserAssets()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6449) | :closed_lock_with_key: | GET | `/stock/users/assets` | -| [getStockSymbols()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6461) | | GET | `/stock/symbols` | -| [getStockSymbolDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6473) | :closed_lock_with_key: | GET | `/stock/symbols/detail` | -| [getStockOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6485) | | GET | `/stock/market/{symbol}/orderbook` | -| [getStockOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6495) | :closed_lock_with_key: | GET | `/stock/orders` | -| [createStockOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6509) | :closed_lock_with_key: | POST | `/stock/orders` | -| [cancelAllStockOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6520) | :closed_lock_with_key: | DELETE | `/stock/orders` | -| [getStockOrderHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6530) | :closed_lock_with_key: | GET | `/stock/orders/history` | -| [updateStockOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6543) | :closed_lock_with_key: | PUT | `/stock/orders/{orderId}` | -| [cancelStockOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6556) | :closed_lock_with_key: | DELETE | `/stock/orders/{orderId}` | -| [getStockPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6568) | :closed_lock_with_key: | GET | `/stock/positions` | -| [closeStockPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6580) | :closed_lock_with_key: | POST | `/stock/positions/close` | -| [getStockTransactions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6592) | :closed_lock_with_key: | GET | `/stock/transactions` | -| [createStockTransaction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6606) | :closed_lock_with_key: | POST | `/stock/transactions` | -| [getStockExchanges()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6617) | | GET | `/stock/exchanges` | -| [getStockFeeRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6628) | | GET | `/stock/fee-rate` | +| Function | AUTH | HTTP Method | Endpoint | +| ---------------------------------------------------------------------------------------------------------------------- | :--------------------: | :---------: | ------------------------------------------------------------- | +| [getSystemMaintenanceStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L703) | | GET | `/v1/public/system_info` | +| [submitWithdrawal()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L720) | :closed_lock_with_key: | POST | `/withdrawals` | +| [submitSpotMainAccountTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L734) | :closed_lock_with_key: | POST | `/withdrawals/push` | +| [cancelWithdrawal()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L750) | :closed_lock_with_key: | DELETE | `/withdrawals/{withdrawal_id}` | +| [getCurrencyChains()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L767) | | GET | `/wallet/currency_chains` | +| [createDepositAddress()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L777) | :closed_lock_with_key: | GET | `/wallet/deposit_address` | +| [getWithdrawalRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L791) | :closed_lock_with_key: | GET | `/wallet/withdrawals` | +| [getDepositRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L805) | :closed_lock_with_key: | GET | `/wallet/deposits` | +| [submitTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L824) | :closed_lock_with_key: | POST | `/wallet/transfers` | +| [getTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L836) | :closed_lock_with_key: | GET | `/wallet/transfers` | +| [submitMainSubTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L848) | :closed_lock_with_key: | POST | `/wallet/sub_account_transfers` | +| [getMainSubTransfers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L862) | :closed_lock_with_key: | GET | `/wallet/sub_account_transfers` | +| [submitSubToSubTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L876) | :closed_lock_with_key: | POST | `/wallet/sub_account_to_sub_account` | +| [getTransferStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L891) | :closed_lock_with_key: | GET | `/wallet/order_status` | +| [getWithdrawalStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L907) | :closed_lock_with_key: | GET | `/wallet/withdraw_status` | +| [getSubBalance()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L919) | :closed_lock_with_key: | GET | `/wallet/sub_account_balances` | +| [getSubMarginBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L931) | :closed_lock_with_key: | GET | `/wallet/sub_account_margin_balances` | +| [getSubFuturesBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L943) | :closed_lock_with_key: | GET | `/wallet/sub_account_futures_balances` | +| [getSubCrossMarginBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L956) | :closed_lock_with_key: | GET | `/wallet/sub_account_cross_margin_balances` | +| [getSavedAddresses()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L968) | :closed_lock_with_key: | GET | `/wallet/saved_address` | +| [getTradingFees()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L978) | :closed_lock_with_key: | GET | `/wallet/fee` | +| [getBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L999) | :closed_lock_with_key: | GET | `/wallet/total_balance` | +| [getSmallBalances()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1008) | :closed_lock_with_key: | GET | `/wallet/small_balance` | +| [convertSmallBalance()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1018) | :closed_lock_with_key: | POST | `/wallet/small_balance` | +| [getSmallBalanceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1031) | :closed_lock_with_key: | GET | `/wallet/small_balance_history` | +| [getPushOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1043) | :closed_lock_with_key: | GET | `/wallet/push` | +| [getLowCapExchangeList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1052) | :closed_lock_with_key: | GET | `/wallet/getLowCapExchangeList` | +| [createSubAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1067) | :closed_lock_with_key: | POST | `/sub_accounts` | +| [getSubAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1078) | :closed_lock_with_key: | GET | `/sub_accounts` | +| [getSubAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1088) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}` | +| [createSubAccountApiKey()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1098) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/keys` | +| [getSubAccountApiKeys()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1111) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}/keys` | +| [updateSubAccountApiKey()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1125) | :closed_lock_with_key: | PUT | `/sub_accounts/{user_id}/keys/{key}` | +| [deleteSubAccountApiKey()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1136) | :closed_lock_with_key: | DELETE | `/sub_accounts/{user_id}/keys/{key}` | +| [getSubAccountApiKey()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1151) | :closed_lock_with_key: | GET | `/sub_accounts/{user_id}/keys/{key}` | +| [lockSubAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1166) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/lock` | +| [unlockSubAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1176) | :closed_lock_with_key: | POST | `/sub_accounts/{user_id}/unlock` | +| [getSubAccountMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1190) | :closed_lock_with_key: | GET | `/sub_accounts/unified_mode` | +| [getUnifiedAccountInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1209) | :closed_lock_with_key: | GET | `/unified/accounts` | +| [getUnifiedMaxBorrow()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1225) | :closed_lock_with_key: | GET | `/unified/borrowable` | +| [getUnifiedMaxTransferable()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1241) | :closed_lock_with_key: | GET | `/unified/transferable` | +| [getUnifiedMaxTransferables()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1256) | :closed_lock_with_key: | GET | `/unified/transferables` | +| [getUnifiedBatchMaxBorrowable()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1265) | :closed_lock_with_key: | GET | `/unified/batch_borrowable` | +| [submitUnifiedBorrowOrRepay()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1283) | :closed_lock_with_key: | POST | `/unified/loans` | +| [getUnifiedLoans()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1295) | :closed_lock_with_key: | GET | `/unified/loans` | +| [getUnifiedLoanRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1305) | :closed_lock_with_key: | GET | `/unified/loan_records` | +| [getUnifiedInterestRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1317) | :closed_lock_with_key: | GET | `/unified/interest_records` | +| [getUnifiedRiskUnitDetails()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1328) | :closed_lock_with_key: | GET | `/unified/risk_units` | +| [setUnifiedAccountMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1340) | :closed_lock_with_key: | PUT | `/unified/unified_mode` | +| [getUnifiedAccountMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1349) | :closed_lock_with_key: | GET | `/unified/unified_mode` | +| [getUnifiedEstimateRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1361) | :closed_lock_with_key: | GET | `/unified/estimate_rate` | +| [getUnifiedCurrencyDiscountTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1372) | | GET | `/unified/currency_discount_tiers` | +| [getLoanMarginTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1384) | | GET | `/unified/loan_margin_tiers` | +| [portfolioMarginCalculate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1401) | | POST | `/unified/portfolio_calculator` | +| [setUserLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1415) | :closed_lock_with_key: | POST | `/unified/leverage/user_setting` | +| [getUserCurrencyLeverageConfig()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1429) | :closed_lock_with_key: | GET | `/unified/leverage/user_currency_config` | +| [getUserCurrencyLeverageSettings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1443) | :closed_lock_with_key: | GET | `/unified/leverage/user_currency_setting` | +| [updateUserCurrencyLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1458) | :closed_lock_with_key: | POST | `/unified/leverage/user_currency_setting` | +| [getUnifiedLoanCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1473) | :closed_lock_with_key: | GET | `/unified/currencies` | +| [getHistoricalLendingRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1485) | :closed_lock_with_key: | GET | `/unified/history_loan_rate` | +| [submitUnifiedLoanRepay()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1491) | :closed_lock_with_key: | POST | `/unified/loans/repay` | +| [getEstimatedQuickRepayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1498) | :closed_lock_with_key: | GET | `/unified/estimated_quick_repayment` | +| [createQuickRepayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1505) | :closed_lock_with_key: | POST | `/unified/quick_repayment` | +| [setUnifiedDeltaNeutral()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1516) | :closed_lock_with_key: | POST | `/unified/delta_neutral` | +| [getUnifiedDeltaNeutral()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1525) | :closed_lock_with_key: | GET | `/unified/delta_neutral` | +| [getSpotCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1545) | | GET | `/spot/currencies` | +| [getSpotCurrency()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1555) | | GET | `/spot/currencies/{currency}` | +| [getSpotCurrencyPairs()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1564) | | GET | `/spot/currency_pairs` | +| [getSpotCurrencyPair()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1574) | | GET | `/spot/currency_pairs/{currency_pair}` | +| [getSpotTicker()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1588) | | GET | `/spot/tickers` | +| [getSpotOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1603) | | GET | `/spot/order_book` | +| [getSpotTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1616) | | GET | `/spot/trades` | +| [getSpotCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1628) | | GET | `/spot/candlesticks` | +| [getSpotFeeRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1640) | :closed_lock_with_key: | GET | `/spot/fee` | +| [getSpotBatchFeeRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1649) | :closed_lock_with_key: | GET | `/spot/batch_fee` | +| [getSpotAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1661) | :closed_lock_with_key: | GET | `/spot/accounts` | +| [getSpotAccountBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1673) | :closed_lock_with_key: | GET | `/spot/account_book` | +| [submitSpotBatchOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1692) | :closed_lock_with_key: | POST | `/spot/batch_orders` | +| [getSpotOpenOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1719) | :closed_lock_with_key: | GET | `/spot/open_orders` | +| [submitSpotClosePosCrossDisabled()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1735) | :closed_lock_with_key: | POST | `/spot/cross_liquidate_orders` | +| [submitSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1751) | :closed_lock_with_key: | POST | `/spot/orders` | +| [getSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1768) | :closed_lock_with_key: | GET | `/spot/orders` | +| [cancelSpotOpenOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1783) | :closed_lock_with_key: | DELETE | `/spot/orders` | +| [batchCancelSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1811) | :closed_lock_with_key: | POST | `/spot/cancel_batch_orders` | +| [getSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1836) | :closed_lock_with_key: | GET | `/spot/orders/{order_id}` | +| [updateSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1853) | :closed_lock_with_key: | PATCH | `/spot/orders/{order_id}` | +| [cancelSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1881) | :closed_lock_with_key: | DELETE | `/spot/orders/{order_id}` | +| [getSpotTradingHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1910) | :closed_lock_with_key: | GET | `/spot/my_trades` | +| [submitSpotCountdownOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1939) | :closed_lock_with_key: | POST | `/spot/countdown_cancel_all` | +| [batchUpdateSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1958) | :closed_lock_with_key: | POST | `/spot/amend_batch_orders` | +| [getSpotInsuranceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1985) | :closed_lock_with_key: | GET | `/spot/insurance_history` | +| [submitSpotPriceTriggerOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L1999) | :closed_lock_with_key: | POST | `/spot/price_orders` | +| [getSpotAutoOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2011) | :closed_lock_with_key: | GET | `/spot/price_orders` | +| [cancelAllOpenSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2023) | :closed_lock_with_key: | DELETE | `/spot/price_orders` | +| [getPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2036) | :closed_lock_with_key: | GET | `/spot/price_orders/{order_id}` | +| [cancelSpotTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2048) | :closed_lock_with_key: | DELETE | `/spot/price_orders/{order_id}` | +| [getSpotPovOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2062) | :closed_lock_with_key: | GET | `/spot/pov_orders` | +| [createSpotPovOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2074) | :closed_lock_with_key: | POST | `/spot/pov_orders` | +| [cancelSpotPovOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2086) | :closed_lock_with_key: | POST | `/spot/pov_orders/cancel` | +| [getSpotPovOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2100) | :closed_lock_with_key: | GET | `/spot/pov_orders/{order_id}` | +| [cancelSpotPovOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2112) | :closed_lock_with_key: | POST | `/spot/pov_orders/{order_id}/cancel` | +| [setCollateralCurrency()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2124) | :closed_lock_with_key: | POST | `/unified/collateral_currencies` | +| [getMarginAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2145) | :closed_lock_with_key: | GET | `/margin/accounts` | +| [getMarginBalanceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2159) | :closed_lock_with_key: | GET | `/margin/account_book` | +| [getFundingAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2177) | :closed_lock_with_key: | GET | `/margin/funding_accounts` | +| [updateAutoRepaymentSetting()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2195) | :closed_lock_with_key: | POST | `/margin/auto_repay` | +| [getAutoRepaymentSetting()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2206) | :closed_lock_with_key: | GET | `/margin/auto_repay` | +| [getMarginTransferableAmount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2220) | :closed_lock_with_key: | GET | `/margin/transferable` | +| [getCrossMarginCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2237) | | GET | `/margin/cross/currencies` | +| [getCrossMarginCurrency()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2248) | | GET | `/margin/cross/currencies/{currency}` | +| [getCrossMarginAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2260) | :closed_lock_with_key: | GET | `/margin/cross/accounts` | +| [getCrossMarginAccountHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2273) | :closed_lock_with_key: | GET | `/margin/cross/account_book` | +| [submitCrossMarginBorrowLoan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2290) | :closed_lock_with_key: | POST | `/margin/cross/loans` | +| [getCrossMarginBorrowHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2305) | :closed_lock_with_key: | GET | `/margin/cross/loans` | +| [getCrossMarginBorrowLoan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2318) | :closed_lock_with_key: | GET | `/margin/cross/loans/{loan_id}` | +| [submitCrossMarginRepayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2333) | :closed_lock_with_key: | POST | `/margin/cross/repayments` | +| [getCrossMarginRepayments()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2349) | :closed_lock_with_key: | GET | `/margin/cross/repayments` | +| [getCrossMarginInterestRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2362) | :closed_lock_with_key: | GET | `/margin/cross/interest_records` | +| [getCrossMarginTransferableAmount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2378) | :closed_lock_with_key: | GET | `/margin/cross/transferable` | +| [getEstimatedInterestRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2394) | :closed_lock_with_key: | GET | `/margin/cross/estimate_rate` | +| [getCrossMarginBorrowableAmount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2408) | :closed_lock_with_key: | GET | `/margin/cross/borrowable` | +| [getMarginUserLoanTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2421) | :closed_lock_with_key: | GET | `/margin/user/loan_margin_tiers` | +| [getMarginPublicLoanTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2437) | | GET | `/margin/loan_margin_tiers` | +| [setMarginUserLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2453) | :closed_lock_with_key: | POST | `/margin/leverage/user_market_setting` | +| [getMarginUserAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2470) | :closed_lock_with_key: | GET | `/margin/user/account` | +| [getLendingMarkets()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2485) | | GET | `/margin/uni/currency_pairs` | +| [getLendingMarket()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2500) | | GET | `/margin/uni/currency_pairs/{currency_pair}` | +| [getEstimatedInterestRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2512) | :closed_lock_with_key: | GET | `/margin/uni/estimate_rate` | +| [submitMarginUNIBorrowOrRepay()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2522) | :closed_lock_with_key: | POST | `/margin/uni/loans` | +| [getMarginUNILoans()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2538) | :closed_lock_with_key: | GET | `/margin/uni/loans` | +| [getMarginUNILoanRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2548) | :closed_lock_with_key: | GET | `/margin/uni/loan_records` | +| [getMarginUNIInterestRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2560) | :closed_lock_with_key: | GET | `/margin/uni/interest_records` | +| [getMarginUNIMaxBorrow()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2572) | :closed_lock_with_key: | GET | `/margin/uni/borrowable` | +| [getFlashSwapCurrencyPairs()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2588) | | GET | `/flash_swap/currency_pairs` | +| [submitFlashSwapOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2604) | :closed_lock_with_key: | POST | `/flash_swap/orders` | +| [getFlashSwapOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2616) | :closed_lock_with_key: | GET | `/flash_swap/orders` | +| [getFlashSwapOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2628) | :closed_lock_with_key: | GET | `/flash_swap/orders/{order_id}` | +| [submitFlashSwapOrderPreview()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2638) | :closed_lock_with_key: | POST | `/flash_swap/orders/preview` | +| [getFuturesContracts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2655) | | GET | `/futures/{settle}/contracts` | +| [getFuturesContract()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2670) | | GET | `/futures/{settle}/contracts/{contract}` | +| [getFuturesOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2685) | | GET | `/futures/{settle}/order_book` | +| [getFuturesTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2698) | | GET | `/futures/{settle}/trades` | +| [getFuturesCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2713) | | GET | `/futures/{settle}/candlesticks` | +| [getPremiumIndexKLines()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2726) | | GET | `/futures/{settle}/premium_index` | +| [getFuturesTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2739) | | GET | `/futures/{settle}/tickers` | +| [getFundingRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2756) | | GET | `/futures/{settle}/funding_rate` | +| [getBatchFundingRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2772) | | POST | `/futures/{settle}/funding_rates` | +| [getFuturesInsuranceBalanceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2790) | | GET | `/futures/{settle}/insurance` | +| [getFuturesStats()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2809) | | GET | `/futures/{settle}/contract_stats` | +| [getIndexConstituents()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2820) | | GET | `/futures/{settle}/index_constituents/{index}` | +| [getLiquidationHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2837) | | GET | `/futures/{settle}/liq_orders` | +| [getRiskLimitTiers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2854) | | GET | `/futures/{settle}/risk_limit_tiers` | +| [getFuturesAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2867) | :closed_lock_with_key: | GET | `/futures/{settle}/accounts` | +| [getFuturesAccountBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2881) | :closed_lock_with_key: | GET | `/futures/{settle}/account_book` | +| [getFuturesPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2894) | :closed_lock_with_key: | GET | `/futures/{settle}/positions` | +| [getFuturesPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2909) | :closed_lock_with_key: | GET | `/futures/{settle}/positions/{contract}` | +| [updateFuturesMargin()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2926) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/margin` | +| [updateFuturesLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2954) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/leverage` | +| [getFuturesContractLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2974) | :closed_lock_with_key: | GET | `/futures/{settle}/get_leverage/{contract}` | +| [updateFuturesPositionMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L2990) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/cross_mode` | +| [updatePositionRiskLimit()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3007) | :closed_lock_with_key: | POST | `/futures/{settle}/positions/{contract}/risk_limit` | +| [updateFuturesDualMode()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3027) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_mode` | +| [getDualModePosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3043) | :closed_lock_with_key: | GET | `/futures/{settle}/dual_comp/positions/{contract}` | +| [updateDualModePositionMargin()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3058) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/margin` | +| [updateDualModePositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3074) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/leverage` | +| [updateDualModePositionRiskLimit()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3098) | :closed_lock_with_key: | POST | `/futures/{settle}/dual_comp/positions/{contract}/risk_limit` | +| [submitFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3125) | :closed_lock_with_key: | POST | `/futures/{settle}/orders` | +| [getFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3146) | :closed_lock_with_key: | GET | `/futures/{settle}/orders` | +| [cancelAllFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3161) | :closed_lock_with_key: | DELETE | `/futures/{settle}/orders` | +| [getFuturesOrdersByTimeRange()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3181) | :closed_lock_with_key: | GET | `/futures/{settle}/orders_timerange` | +| [submitFuturesBatchOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3204) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_orders` | +| [getFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3229) | :closed_lock_with_key: | GET | `/futures/{settle}/orders/{order_id}` | +| [cancelFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3246) | :closed_lock_with_key: | DELETE | `/futures/{settle}/orders/{order_id}` | +| [updateFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3271) | :closed_lock_with_key: | PUT | `/futures/{settle}/orders/{order_id}` | +| [getFuturesTradingHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3292) | :closed_lock_with_key: | GET | `/futures/{settle}/my_trades` | +| [getFuturesTradingHistoryByTimeRange()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3307) | :closed_lock_with_key: | GET | `/futures/{settle}/my_trades_timerange` | +| [getFuturesPositionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3320) | :closed_lock_with_key: | GET | `/futures/{settle}/position_close` | +| [getFuturesLiquidationHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3333) | :closed_lock_with_key: | GET | `/futures/{settle}/liquidates` | +| [getFuturesAutoDeleveragingHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3346) | :closed_lock_with_key: | GET | `/futures/{settle}/auto_deleverages` | +| [setFuturesOrderCancelCountdown()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3363) | :closed_lock_with_key: | POST | `/futures/{settle}/countdown_cancel_all` | +| [getFuturesUserTradingFees()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3380) | :closed_lock_with_key: | GET | `/futures/{settle}/fee` | +| [batchCancelFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3398) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_cancel_orders` | +| [batchUpdateFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3425) | :closed_lock_with_key: | POST | `/futures/{settle}/batch_amend_orders` | +| [getRiskLimitTable()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3447) | | GET | `/futures/{settle}/risk_limit_table` | +| [submitFuturesPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3460) | :closed_lock_with_key: | POST | `/futures/{settle}/price_orders` | +| [getFuturesAutoOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3473) | :closed_lock_with_key: | GET | `/futures/{settle}/price_orders` | +| [cancelAllOpenFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3486) | :closed_lock_with_key: | DELETE | `/futures/{settle}/price_orders` | +| [getFuturesPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3502) | :closed_lock_with_key: | GET | `/futures/{settle}/price_orders/{order_id}` | +| [cancelFuturesPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3517) | :closed_lock_with_key: | DELETE | `/futures/{settle}/price_orders/{order_id}` | +| [updateFuturesPriceTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3532) | :closed_lock_with_key: | PUT | `/futures/{settle}/price_orders/amend` | +| [createTrailOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3547) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/create` | +| [terminateTrailOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3565) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/stop` | +| [batchTerminateTrailOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3578) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/stop_all` | +| [getTrailOrderList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3593) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/list` | +| [getTrailOrderDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3606) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/detail` | +| [updateTrailOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3624) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/trail/update` | +| [getTrailOrderChangeLog()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3637) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/trail/change_log` | +| [createChaseOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3650) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/create` | +| [stopChaseOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3660) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/stop` | +| [stopAllChaseOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3670) | :closed_lock_with_key: | POST | `/futures/{settle}/autoorder/v1/chase/stop_all` | +| [getChaseOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3682) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/chase/list` | +| [getChaseOrderDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3690) | :closed_lock_with_key: | GET | `/futures/{settle}/autoorder/v1/chase/detail` | +| [getFuturesPositionCloseHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3699) | :closed_lock_with_key: | GET | `/futures/{settle}/position_close_history` | +| [getFuturesInsuranceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3708) | :closed_lock_with_key: | GET | `/futures/{settle}/insurance` | +| [getAllDeliveryContracts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3725) | | GET | `/delivery/{settle}/contracts` | +| [getDeliveryContract()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3737) | | GET | `/delivery/{settle}/contracts/{contract}` | +| [getDeliveryOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3752) | | GET | `/delivery/{settle}/order_book` | +| [getDeliveryTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3765) | | GET | `/delivery/{settle}/trades` | +| [getDeliveryCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3779) | | GET | `/delivery/{settle}/candlesticks` | +| [getDeliveryTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3790) | | GET | `/delivery/{settle}/tickers` | +| [getDeliveryInsuranceBalanceHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3807) | | GET | `/delivery/{settle}/insurance` | +| [getDeliveryAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3826) | :closed_lock_with_key: | GET | `/delivery/{settle}/accounts` | +| [getDeliveryBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3837) | :closed_lock_with_key: | GET | `/delivery/{settle}/account_book` | +| [getDeliveryPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3848) | :closed_lock_with_key: | GET | `/delivery/{settle}/positions` | +| [getDeliveryPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3858) | :closed_lock_with_key: | GET | `/delivery/{settle}/positions/{contract}` | +| [updateDeliveryMargin()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3873) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/margin` | +| [updateDeliveryLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3891) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/leverage` | +| [updateDeliveryRiskLimit()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3909) | :closed_lock_with_key: | POST | `/delivery/{settle}/positions/{contract}/risk_limit` | +| [submitDeliveryOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3929) | :closed_lock_with_key: | POST | `/delivery/{settle}/orders` | +| [getDeliveryOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3944) | :closed_lock_with_key: | GET | `/delivery/{settle}/orders` | +| [cancelAllDeliveryOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3957) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/orders` | +| [getDeliveryOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3976) | :closed_lock_with_key: | GET | `/delivery/{settle}/orders/{order_id}` | +| [cancelDeliveryOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L3991) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/orders/{order_id}` | +| [getDeliveryTradingHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4006) | :closed_lock_with_key: | GET | `/delivery/{settle}/my_trades` | +| [getDeliveryClosedPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4019) | :closed_lock_with_key: | GET | `/delivery/{settle}/position_close` | +| [getDeliveryLiquidationHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4032) | :closed_lock_with_key: | GET | `/delivery/{settle}/liquidates` | +| [getDeliverySettlementHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4045) | :closed_lock_with_key: | GET | `/delivery/{settle}/settlements` | +| [submitDeliveryTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4058) | :closed_lock_with_key: | POST | `/delivery/{settle}/price_orders` | +| [getDeliveryAutoOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4073) | :closed_lock_with_key: | GET | `/delivery/{settle}/price_orders` | +| [cancelAllOpenDeliveryOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4086) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/price_orders` | +| [getDeliveryTriggeredOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4102) | :closed_lock_with_key: | GET | `/delivery/{settle}/price_orders/{order_id}` | +| [cancelTriggeredDeliveryOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4117) | :closed_lock_with_key: | DELETE | `/delivery/{settle}/price_orders/{order_id}` | +| [getOptionsUnderlyings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4136) | | GET | `/options/underlyings` | +| [getOptionsExpirationTimes()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4146) | | GET | `/options/expirations` | +| [getOptionsContracts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4156) | | GET | `/options/contracts` | +| [getOptionsContract()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4169) | | GET | `/options/contracts/{contract}` | +| [getOptionsSettlementHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4179) | | GET | `/options/settlements` | +| [getOptionsContractSettlement()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4191) | | GET | `/options/settlements/{contract}` | +| [getOptionsMySettlements()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4206) | :closed_lock_with_key: | GET | `/options/my_settlements` | +| [getOptionsOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4220) | | GET | `/options/order_book` | +| [getOptionsTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4232) | | GET | `/options/tickers` | +| [getOptionsUnderlyingTicker()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4246) | | GET | `/options/underlying/tickers/{underlying}` | +| [getOptionsCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4260) | | GET | `/options/candlesticks` | +| [getOptionsUnderlyingCandles()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4270) | | GET | `/options/underlying/candlesticks` | +| [getOptionsTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4282) | | GET | `/options/trades` | +| [getOptionsAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4293) | :closed_lock_with_key: | GET | `/options/accounts` | +| [getOptionsAccountChange()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4303) | :closed_lock_with_key: | GET | `/options/account_book` | +| [getOptionsPositionsUnderlying()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4315) | :closed_lock_with_key: | GET | `/options/positions` | +| [getOptionsPositionContract()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4327) | :closed_lock_with_key: | GET | `/options/positions/{contract}` | +| [getOptionsLiquidation()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4339) | :closed_lock_with_key: | GET | `/options/position_close` | +| [submitOptionsOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4352) | :closed_lock_with_key: | POST | `/options/orders` | +| [getOptionsOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4364) | :closed_lock_with_key: | GET | `/options/orders` | +| [cancelAllOpenOptionsOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4376) | :closed_lock_with_key: | DELETE | `/options/orders` | +| [getOptionsOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4390) | :closed_lock_with_key: | GET | `/options/orders/{order_id}` | +| [amendOptionsOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4402) | :closed_lock_with_key: | PUT | `/options/orders/{order_id}` | +| [cancelOptionsOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4417) | :closed_lock_with_key: | DELETE | `/options/orders/{order_id}` | +| [submitOptionsCountdownCancel()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4436) | :closed_lock_with_key: | POST | `/options/countdown_cancel_all` | +| [getOptionsPersonalHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4452) | :closed_lock_with_key: | GET | `/options/my_trades` | +| [setOptionsMMPSettings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4464) | :closed_lock_with_key: | POST | `/options/mmp` | +| [getOptionsMMPSettings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4476) | :closed_lock_with_key: | GET | `/options/mmp` | +| [resetOptionsMMPSettings()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4488) | :closed_lock_with_key: | POST | `/options/mmp/reset` | +| [getLendingCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4504) | | GET | `/earn/uni/currencies` | +| [getLendingCurrency()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4514) | | GET | `/earn/uni/currencies/{currency}` | +| [submitLendOrRedeemOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4524) | :closed_lock_with_key: | POST | `/earn/uni/lends` | +| [getLendingOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4534) | :closed_lock_with_key: | GET | `/earn/uni/lends` | +| [updateLendingOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4546) | :closed_lock_with_key: | PATCH | `/earn/uni/lends` | +| [getLendingRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4559) | :closed_lock_with_key: | GET | `/earn/uni/lend_records` | +| [getLendingTotalInterest()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4572) | :closed_lock_with_key: | GET | `/earn/uni/interests/{currency}` | +| [getLendingInterestRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4585) | :closed_lock_with_key: | GET | `/earn/uni/interest_records` | +| [updateInterestReinvestment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4598) | :closed_lock_with_key: | PUT | `/earn/uni/interest_reinvest` | +| [getLendingInterestStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4614) | :closed_lock_with_key: | GET | `/earn/uni/interest_status/{currency}` | +| [getLendingAnnualizedTrendChart()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4629) | :closed_lock_with_key: | GET | `/earn/uni/chart` | +| [getLendingEstimatedRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4637) | :closed_lock_with_key: | GET | `/earn/uni/rate` | +| [submitMultiLoanOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4654) | :closed_lock_with_key: | POST | `/loan/multi_collateral/orders` | +| [getMultiLoanOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4666) | :closed_lock_with_key: | GET | `/loan/multi_collateral/orders` | +| [getMultiLoanOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4678) | :closed_lock_with_key: | GET | `/loan/multi_collateral/orders/{order_id}` | +| [repayMultiLoan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4688) | :closed_lock_with_key: | POST | `/loan/multi_collateral/repay` | +| [getMultiLoanRepayRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4698) | :closed_lock_with_key: | GET | `/loan/multi_collateral/repay` | +| [updateMultiLoan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4710) | :closed_lock_with_key: | POST | `/loan/multi_collateral/mortgage` | +| [getMultiLoanAdjustmentRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4722) | :closed_lock_with_key: | GET | `/loan/multi_collateral/mortgage` | +| [getMultiLoanCurrencyQuota()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4734) | :closed_lock_with_key: | GET | `/loan/multi_collateral/currency_quota` | +| [getMultiLoanSupportedCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4746) | | GET | `/loan/multi_collateral/currencies` | +| [getMultiLoanRatio()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4755) | | GET | `/loan/multi_collateral/ltv` | +| [getMultiLoanFixedRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4764) | | GET | `/loan/multi_collateral/fixed_rate` | +| [getMultiLoanCurrentRates()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4777) | | GET | `/loan/multi_collateral/current_rate` | +| [getDualInvestmentProducts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4799) | | GET | `/earn/dual/investment_plan` | +| [getDualInvestmentOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4810) | :closed_lock_with_key: | GET | `/earn/dual/orders` | +| [submitDualInvestmentOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4822) | :closed_lock_with_key: | POST | `/earn/dual/orders` | +| [getDualOrderRefundPreview()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4831) | :closed_lock_with_key: | GET | `/earn/dual/order-refund-preview` | +| [submitDualOrderRefund()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4840) | :closed_lock_with_key: | POST | `/earn/dual/order-refund` | +| [updateDualOrderReinvest()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4849) | :closed_lock_with_key: | POST | `/earn/dual/modify-order-reinvest` | +| [getDualProjectRecommend()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4860) | :closed_lock_with_key: | GET | `/earn/dual/project-recommend` | +| [getEarnFixedTermProducts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4869) | | GET | `/earn/fixed-term/product` | +| [getEarnFixedTermProductsByAsset()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4878) | | GET | `/earn/fixed-term/product/{asset}/list` | +| [createEarnFixedTermLend()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4888) | :closed_lock_with_key: | POST | `/earn/fixed-term/user/lend` | +| [getEarnFixedTermLends()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4897) | :closed_lock_with_key: | GET | `/earn/fixed-term/user/lend` | +| [createEarnFixedTermPreRedeem()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4906) | :closed_lock_with_key: | POST | `/earn/fixed-term/user/pre-redeem` | +| [getEarnFixedTermHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4917) | :closed_lock_with_key: | GET | `/earn/fixed-term/user/history` | +| [createAutoInvestPlan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4926) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/create` | +| [updateAutoInvestPlan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4935) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/update` | +| [stopAutoInvestPlan()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4942) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/stop` | +| [addAutoInvestPlanPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4949) | :closed_lock_with_key: | POST | `/earn/autoinvest/plans/add_position` | +| [getAutoInvestCoins()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4960) | :closed_lock_with_key: | GET | `/earn/autoinvest/coins` | +| [getAutoInvestMinAmount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4969) | :closed_lock_with_key: | POST | `/earn/autoinvest/min_invest_amount` | +| [getAutoInvestPlanRecords()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4980) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/records` | +| [getAutoInvestOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4989) | :closed_lock_with_key: | GET | `/earn/autoinvest/orders` | +| [getAutoInvestConfig()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L4998) | :closed_lock_with_key: | GET | `/earn/autoinvest/config` | +| [getAutoInvestPlanDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5005) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/detail` | +| [getAutoInvestPlans()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5014) | :closed_lock_with_key: | GET | `/earn/autoinvest/plans/list_info` | +| [getStakingCoins()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5026) | :closed_lock_with_key: | GET | `/earn/staking/coins` | +| [submitStakingSwap()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5039) | :closed_lock_with_key: | POST | `/earn/staking/swap` | +| [getAccountDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5058) | :closed_lock_with_key: | GET | `/account/detail` | +| [getAccountRateLimit()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5067) | :closed_lock_with_key: | GET | `/account/rate_limit` | +| [createStpGroup()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5077) | :closed_lock_with_key: | POST | `/account/stp_groups` | +| [getStpGroups()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5087) | :closed_lock_with_key: | GET | `/account/stp_groups` | +| [getStpGroupUsers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5097) | :closed_lock_with_key: | GET | `/account/stp_groups/{stp_id}/users` | +| [addUsersToStpGroup()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5107) | :closed_lock_with_key: | POST | `/account/stp_groups/{stp_id}/users` | +| [deleteUserFromStpGroup()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5123) | :closed_lock_with_key: | DELETE | `/account/stp_groups/{stp_id}/users` | +| [setGTDeduction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5141) | :closed_lock_with_key: | POST | `/account/debit_fee` | +| [getGTDeduction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5152) | :closed_lock_with_key: | GET | `/account/debit_fee` | +| [getAccountMainKeys()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5161) | :closed_lock_with_key: | GET | `/account/main_keys` | +| [getAgencyTransactionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5177) | :closed_lock_with_key: | GET | `/rebate/agency/transaction_history` | +| [getAgencyCommissionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5190) | :closed_lock_with_key: | GET | `/rebate/agency/commission_history` | +| [getPartnerTransactionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5204) | :closed_lock_with_key: | GET | `/rebate/partner/transaction_history` | +| [getPartnerCommissionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5219) | :closed_lock_with_key: | GET | `/rebate/partner/commission_history` | +| [getPartnerSubordinateList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5242) | :closed_lock_with_key: | GET | `/rebate/partner/sub_list` | +| [getPartnerAgentDataAggregated()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5252) | :closed_lock_with_key: | GET | `/rebate/partner/data/aggregated` | +| [getBrokerCommissionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5265) | :closed_lock_with_key: | GET | `/rebate/broker/commission_history` | +| [getBrokerTransactionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5278) | :closed_lock_with_key: | GET | `/rebate/broker/transaction_history` | +| [getUserRebateInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5287) | :closed_lock_with_key: | GET | `/rebate/user/info` | +| [createOTCQuote()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5322) | :closed_lock_with_key: | POST | `/otc/quote` | +| [createOTCFiatOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5334) | :closed_lock_with_key: | POST | `/otc/order/create` | +| [createOTCStablecoinOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5348) | :closed_lock_with_key: | POST | `/otc/stable_coin/order/create` | +| [getOTCBankList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5357) | :closed_lock_with_key: | GET | `/otc/bank/list` | +| [getOTCBankListLegacy()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5364) | :closed_lock_with_key: | GET | `/otc/bank_list` | +| [createOTCBank()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5371) | :closed_lock_with_key: | POST | `/otc/bank/delete` | +| [deleteOTCBank()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5382) | :closed_lock_with_key: | POST | `/otc/bank/delete` | +| [setDefaultOTCBank()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5389) | :closed_lock_with_key: | POST | `/otc/bank/set_default` | +| [getOTCBankSupplementChecklist()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5396) | :closed_lock_with_key: | GET | `/otc/bank/bank_supplement_checklist` | +| [submitOTCBankPersonalSupplement()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5405) | :closed_lock_with_key: | POST | `/otc/order/paid` | +| [submitOTCBankEnterpriseSupplement()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5424) | :closed_lock_with_key: | POST | `/otc/order/paid` | +| [markOTCOrderAsPaid()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5460) | :closed_lock_with_key: | POST | `/otc/order/paid` | +| [cancelOTCOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5474) | :closed_lock_with_key: | POST | `/otc/order/cancel` | +| [getOTCFiatOrderList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5486) | :closed_lock_with_key: | GET | `/otc/order/list` | +| [getOTCStablecoinOrderList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5500) | :closed_lock_with_key: | GET | `/otc/stable_coin/order/list` | +| [getOTCFiatOrderDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5514) | :closed_lock_with_key: | GET | `/otc/order/detail` | +| [getP2PMerchantUserInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5528) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_user_info` | +| [getP2PMerchantCounterpartyUserInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5537) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_counterparty_user_info` | +| [getP2PMerchantMyselfPayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5549) | :closed_lock_with_key: | POST | `/p2p/merchant/account/get_myself_payment` | +| [getP2PMerchantSpotBalance()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5562) | :closed_lock_with_key: | POST | `/p2p/merchant/account/set_merchant_work_hours` | +| [setP2PMerchantWorkHours()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5571) | :closed_lock_with_key: | POST | `/p2p/merchant/account/set_merchant_work_hours` | +| [getP2PMerchantPendingTransactionList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5582) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_pending_transaction_list` | +| [getP2PMerchantCompletedTransactionList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5594) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_completed_transaction_list` | +| [getP2PMerchantTransactionDetails()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5606) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/get_transaction_details` | +| [confirmP2PMerchantPayment()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5618) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/confirm-payment` | +| [confirmP2PMerchantReceipt()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5629) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/confirm-receipt` | +| [cancelP2PMerchantTransaction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5640) | :closed_lock_with_key: | POST | `/p2p/merchant/transaction/cancel` | +| [placeP2PMerchantBizPushOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5651) | :closed_lock_with_key: | POST | `/p2p/merchant/books/place_biz_push_order` | +| [updateP2PMerchantAdsStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5662) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_update_status` | +| [getP2PMerchantAdsDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5675) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_detail` | +| [getP2PMerchantMyAdsList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5684) | :closed_lock_with_key: | POST | `/p2p/merchant/books/my_ads_list` | +| [getP2PMerchantAdsList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5695) | :closed_lock_with_key: | POST | `/p2p/merchant/books/ads_list` | +| [getP2PMerchantChatsList()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5704) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/get_chats_list` | +| [sendP2PMerchantChatMessage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5715) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/send_chat_message` | +| [uploadP2PMerchantChatFile()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5726) | :closed_lock_with_key: | POST | `/p2p/merchant/chat/upload_chat_file` | +| [getCrossExSymbols()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5747) | | GET | `/crossex/rule/symbols` | +| [getCrossExRiskLimits()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5759) | | GET | `/crossex/rule/risk_limits` | +| [getCrossExTransferCoins()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5773) | | GET | `/crossex/transfers/coin` | +| [createCrossExTransfer()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5787) | :closed_lock_with_key: | POST | `/crossex/transfers` | +| [getCrossExTransferHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5801) | :closed_lock_with_key: | GET | `/crossex/transfers` | +| [createCrossExOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5815) | :closed_lock_with_key: | POST | `/crossex/orders` | +| [cancelBatchCrossExOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5829) | :closed_lock_with_key: | POST | `/crossex/batch_cancel_orders` | +| [cancelCrossExOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5843) | :closed_lock_with_key: | DELETE | `/crossex/orders/{order_id}` | +| [modifyCrossExOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5856) | :closed_lock_with_key: | PUT | `/crossex/orders/{order_id}` | +| [getCrossExOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5871) | :closed_lock_with_key: | GET | `/crossex/orders/{order_id}` | +| [createCrossExConvertQuote()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5883) | :closed_lock_with_key: | POST | `/crossex/convert/quote` | +| [createCrossExConvertOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5897) | :closed_lock_with_key: | POST | `/crossex/convert/orders` | +| [updateCrossExAccount()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5911) | :closed_lock_with_key: | PUT | `/crossex/accounts` | +| [getCrossExAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5925) | :closed_lock_with_key: | GET | `/crossex/accounts` | +| [setCrossExPositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5937) | :closed_lock_with_key: | POST | `/crossex/positions/leverage` | +| [getCrossExPositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5951) | :closed_lock_with_key: | GET | `/crossex/positions/leverage` | +| [setCrossExMarginPositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5965) | :closed_lock_with_key: | POST | `/crossex/margin_positions/leverage` | +| [getCrossExMarginPositionLeverage()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5981) | :closed_lock_with_key: | GET | `/crossex/margin_positions/leverage` | +| [closeCrossExPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L5995) | :closed_lock_with_key: | POST | `/crossex/position` | +| [getCrossExInterestRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6009) | :closed_lock_with_key: | GET | `/crossex/interest_rate` | +| [getCrossExFeeRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6022) | :closed_lock_with_key: | GET | `/crossex/fee` | +| [getCrossExPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6034) | :closed_lock_with_key: | GET | `/crossex/positions` | +| [getCrossExMarginPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6048) | :closed_lock_with_key: | GET | `/crossex/margin_positions` | +| [getCrossExAdlRank()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6062) | :closed_lock_with_key: | GET | `/crossex/adl_rank` | +| [getCrossExOpenOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6074) | :closed_lock_with_key: | GET | `/crossex/open_orders` | +| [getCrossExHistoryOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6088) | :closed_lock_with_key: | GET | `/crossex/history_orders` | +| [getCrossExHistoryPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6102) | :closed_lock_with_key: | GET | `/crossex/history_positions` | +| [getCrossExHistoryMarginPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6116) | :closed_lock_with_key: | GET | `/crossex/history_margin_positions` | +| [getCrossExHistoryMarginInterests()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6130) | :closed_lock_with_key: | GET | `/crossex/history_margin_interests` | +| [getCrossExHistoryTrades()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6144) | :closed_lock_with_key: | GET | `/crossex/history_trades` | +| [getCrossExAccountBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6158) | :closed_lock_with_key: | GET | `/crossex/account_book` | +| [getCrossExCoinDiscountRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6172) | :closed_lock_with_key: | GET | `/crossex/coin_discount_rate` | +| [getCrossExMarketTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6186) | | GET | `/crossex/market/tickers` | +| [getCrossExMarketFundingInfo()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6200) | | GET | `/crossex/market/funding_info` | +| [getAlphaAccounts()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6218) | :closed_lock_with_key: | GET | `/alpha/accounts` | +| [getAlphaAccountBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6230) | :closed_lock_with_key: | GET | `/alpha/account_book` | +| [createAlphaQuote()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6244) | :closed_lock_with_key: | POST | `/alpha/quote` | +| [createAlphaOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6256) | :closed_lock_with_key: | POST | `/alpha/orders` | +| [getAlphaOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6268) | :closed_lock_with_key: | GET | `/alpha/orders` | +| [getAlphaOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6280) | :closed_lock_with_key: | GET | `/alpha/order` | +| [getAlphaCurrencies()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6292) | | GET | `/alpha/currencies` | +| [getAlphaTickers()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6304) | | GET | `/alpha/tickers` | +| [getTradFiMT5Account()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6310) | :closed_lock_with_key: | GET | `/tradfi/users/mt5-account` | +| [getTradFiSymbolCategories()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6314) | | GET | `/tradfi/symbols/categories` | +| [getTradFiSymbols()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6320) | | GET | `/tradfi/symbols` | +| [getTradFiSymbolCommissions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6332) | | GET | `/tradfi/symbols/commissions` | +| [getTradFiSymbolDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6338) | :closed_lock_with_key: | GET | `/tradfi/symbols/detail` | +| [getTradFiKlines()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6344) | | GET | `/tradfi/symbols/{symbol}/klines` | +| [getTradFiTicker()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6351) | | GET | `/tradfi/symbols/{symbol}/tickers` | +| [createTradFiUser()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6355) | :closed_lock_with_key: | POST | `/tradfi/users` | +| [getTradFiAssets()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6359) | :closed_lock_with_key: | GET | `/tradfi/users/assets` | +| [createTradFiTransaction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6363) | :closed_lock_with_key: | POST | `/tradfi/transactions` | +| [getTradFiTransactions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6369) | :closed_lock_with_key: | GET | `/tradfi/transactions` | +| [createTradFiOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6375) | :closed_lock_with_key: | POST | `/tradfi/orders` | +| [getTradFiOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6381) | :closed_lock_with_key: | GET | `/tradfi/orders` | +| [modifyTradFiOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6385) | :closed_lock_with_key: | PUT | `/tradfi/orders/{orderId}` | +| [cancelTradFiOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6392) | :closed_lock_with_key: | DELETE | `/tradfi/orders/{orderId}` | +| [getTradFiOrderHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6396) | :closed_lock_with_key: | GET | `/tradfi/orders/history` | +| [getTradFiPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6402) | :closed_lock_with_key: | GET | `/tradfi/positions` | +| [modifyTradFiPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6408) | :closed_lock_with_key: | PUT | `/tradfi/positions/{positionId}` | +| [closeTradFiPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6417) | :closed_lock_with_key: | POST | `/tradfi/positions/{positionId}/close` | +| [getTradFiPositionHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6426) | :closed_lock_with_key: | GET | `/tradfi/positions/history` | +| [getTradFiOrderLog()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6435) | :closed_lock_with_key: | GET | `/tradfi/orders/log/{log_id}` | +| [getStockUserAssets()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6449) | :closed_lock_with_key: | GET | `/stock/users/assets` | +| [getStockSymbols()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6461) | | GET | `/stock/symbols` | +| [getStockSymbolDetail()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6473) | :closed_lock_with_key: | GET | `/stock/symbols/detail` | +| [getStockOrderBook()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6485) | | GET | `/stock/market/{symbol}/orderbook` | +| [getStockOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6495) | :closed_lock_with_key: | GET | `/stock/orders` | +| [createStockOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6509) | :closed_lock_with_key: | POST | `/stock/orders` | +| [cancelAllStockOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6520) | :closed_lock_with_key: | DELETE | `/stock/orders` | +| [getStockOrderHistory()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6530) | :closed_lock_with_key: | GET | `/stock/orders/history` | +| [updateStockOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6543) | :closed_lock_with_key: | PUT | `/stock/orders/{orderId}` | +| [cancelStockOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6556) | :closed_lock_with_key: | DELETE | `/stock/orders/{orderId}` | +| [getStockPositions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6568) | :closed_lock_with_key: | GET | `/stock/positions` | +| [closeStockPosition()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6580) | :closed_lock_with_key: | POST | `/stock/positions/close` | +| [getStockTransactions()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6592) | :closed_lock_with_key: | GET | `/stock/transactions` | +| [createStockTransaction()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6606) | :closed_lock_with_key: | POST | `/stock/transactions` | +| [getStockExchanges()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6617) | | GET | `/stock/exchanges` | +| [getStockFeeRate()](https://github.com/sieblyio/gateio-api/blob/master/src/RestClient.ts#L6628) | | GET | `/stock/fee-rate` | # WebsocketAPIClient.ts -This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in [WebsocketAPIClient.ts](/src/WebsocketAPIClient.ts). +This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in [WebsocketAPIClient.ts](/src/WebsocketAPIClient.ts). This client provides WebSocket API endpoints which allow for faster interactions with the Gate.io API via a WebSocket connection. -| Function | AUTH | HTTP Method | Endpoint | -| -------- | :------: | :------: | -------- | -| [submitNewSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L97) | :closed_lock_with_key: | WS | `spot.order_place` | -| [cancelSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L111) | :closed_lock_with_key: | WS | `spot.order_cancel` | -| [cancelSpotOrderById()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L125) | :closed_lock_with_key: | WS | `spot.order_cancel_ids` | -| [cancelSpotOrderForSymbol()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L139) | :closed_lock_with_key: | WS | `spot.order_cancel_cp` | -| [updateSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L153) | :closed_lock_with_key: | WS | `spot.order_amend` | -| [getSpotOrderStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L167) | :closed_lock_with_key: | WS | `spot.order_status` | -| [getSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L181) | :closed_lock_with_key: | WS | `spot.order_list` | -| [submitNewFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L203) | :closed_lock_with_key: | WS | `futures.order_place` | -| [submitNewFuturesBatchOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L219) | :closed_lock_with_key: | WS | `futures.order_batch_place` | -| [cancelFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L235) | :closed_lock_with_key: | WS | `futures.order_cancel` | -| [cancelFuturesOrderById()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L251) | :closed_lock_with_key: | WS | `futures.order_cancel_ids` | -| [cancelFuturesAllOpenOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L267) | :closed_lock_with_key: | WS | `futures.order_cancel_cp` | -| [updateFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L283) | :closed_lock_with_key: | WS | `futures.order_amend` | -| [getFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L299) | :closed_lock_with_key: | WS | `futures.order_list` | -| [getFuturesOrderStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L315) | :closed_lock_with_key: | WS | `futures.order_status` | \ No newline at end of file +| Function | AUTH | HTTP Method | Endpoint | +| ----------------------------------------------------------------------------------------------------------------- | :--------------------: | :---------: | --------------------------- | +| [submitNewSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L97) | :closed_lock_with_key: | WS | `spot.order_place` | +| [cancelSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L111) | :closed_lock_with_key: | WS | `spot.order_cancel` | +| [cancelSpotOrderById()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L125) | :closed_lock_with_key: | WS | `spot.order_cancel_ids` | +| [cancelSpotOrderForSymbol()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L139) | :closed_lock_with_key: | WS | `spot.order_cancel_cp` | +| [updateSpotOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L153) | :closed_lock_with_key: | WS | `spot.order_amend` | +| [getSpotOrderStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L167) | :closed_lock_with_key: | WS | `spot.order_status` | +| [getSpotOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L181) | :closed_lock_with_key: | WS | `spot.order_list` | +| [submitNewFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L203) | :closed_lock_with_key: | WS | `futures.order_place` | +| [submitNewFuturesBatchOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L219) | :closed_lock_with_key: | WS | `futures.order_batch_place` | +| [cancelFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L235) | :closed_lock_with_key: | WS | `futures.order_cancel` | +| [cancelFuturesOrderById()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L251) | :closed_lock_with_key: | WS | `futures.order_cancel_ids` | +| [cancelFuturesAllOpenOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L267) | :closed_lock_with_key: | WS | `futures.order_cancel_cp` | +| [updateFuturesOrder()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L283) | :closed_lock_with_key: | WS | `futures.order_amend` | +| [getFuturesOrders()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L299) | :closed_lock_with_key: | WS | `futures.order_list` | +| [getFuturesOrderStatus()](https://github.com/sieblyio/gateio-api/blob/master/src/WebsocketAPIClient.ts#L315) | :closed_lock_with_key: | WS | `futures.order_status` | diff --git a/examples/apidoc/RestClient/listCrossExMarketFundingInfo.js b/examples/apidoc/RestClient/getCrossExMarketFundingInfo.js similarity index 93% rename from examples/apidoc/RestClient/listCrossExMarketFundingInfo.js rename to examples/apidoc/RestClient/getCrossExMarketFundingInfo.js index 6ecff44..d796292 100644 --- a/examples/apidoc/RestClient/listCrossExMarketFundingInfo.js +++ b/examples/apidoc/RestClient/getCrossExMarketFundingInfo.js @@ -13,7 +13,7 @@ const client = new RestClient({ apiSecret: 'insert_api_secret_here', }); -client.listCrossExMarketFundingInfo(params) +client.getCrossExMarketFundingInfo(params) .then((response) => { console.log(response); }) diff --git a/examples/apidoc/RestClient/listCrossExMarketTickers.js b/examples/apidoc/RestClient/getCrossExMarketTickers.js similarity index 94% rename from examples/apidoc/RestClient/listCrossExMarketTickers.js rename to examples/apidoc/RestClient/getCrossExMarketTickers.js index a49d943..4a22dac 100644 --- a/examples/apidoc/RestClient/listCrossExMarketTickers.js +++ b/examples/apidoc/RestClient/getCrossExMarketTickers.js @@ -13,7 +13,7 @@ const client = new RestClient({ apiSecret: 'insert_api_secret_here', }); -client.listCrossExMarketTickers(params) +client.getCrossExMarketTickers(params) .then((response) => { console.log(response); }) diff --git a/examples/apidoc/RestClient/listSpotPovOrders.js b/examples/apidoc/RestClient/getSpotPovOrders.js similarity index 95% rename from examples/apidoc/RestClient/listSpotPovOrders.js rename to examples/apidoc/RestClient/getSpotPovOrders.js index 0b04379..da989b3 100644 --- a/examples/apidoc/RestClient/listSpotPovOrders.js +++ b/examples/apidoc/RestClient/getSpotPovOrders.js @@ -13,7 +13,7 @@ const client = new RestClient({ apiSecret: 'insert_api_secret_here', }); -client.listSpotPovOrders(params) +client.getSpotPovOrders(params) .then((response) => { console.log(response); }) diff --git a/llms.txt b/llms.txt index 8b62f39..2e01180 100644 --- a/llms.txt +++ b/llms.txt @@ -16418,7 +16418,7 @@ cancelSpotTriggeredOrder(params: { * @param params Parameters for listing Spot POV orders * @returns Promise */ -listSpotPovOrders(params: GetSpotPovOrdersReq): Promise +getSpotPovOrders(params: GetSpotPovOrdersReq): Promise ⋮---- /** * Create a Spot POV order @@ -19590,7 +19590,7 @@ getCrossExCoinDiscountRate( * @param params Optional parameters to filter symbols * @returns Promise with array of market tickers */ -listCrossExMarketTickers( +getCrossExMarketTickers( params?: GetCrossExMarketTickersReq, ): Promise ⋮---- @@ -19602,7 +19602,7 @@ listCrossExMarketTickers( * @param params Optional parameters to filter symbols * @returns Promise with array of funding info records */ -listCrossExMarketFundingInfo( +getCrossExMarketFundingInfo( params?: GetCrossExMarketFundingInfoReq, ): Promise ⋮---- diff --git a/src/RestClient.ts b/src/RestClient.ts index ddf889f..c2a7565 100644 --- a/src/RestClient.ts +++ b/src/RestClient.ts @@ -2059,7 +2059,7 @@ export class RestClient extends BaseRestClient { * @param params Parameters for listing Spot POV orders * @returns Promise */ - listSpotPovOrders(params: GetSpotPovOrdersReq): Promise { + getSpotPovOrders(params: GetSpotPovOrdersReq): Promise { return this.getPrivate('/spot/pov_orders', params); } @@ -6183,7 +6183,7 @@ export class RestClient extends BaseRestClient { * @param params Optional parameters to filter symbols * @returns Promise with array of market tickers */ - listCrossExMarketTickers( + getCrossExMarketTickers( params?: GetCrossExMarketTickersReq, ): Promise { return this.get('/crossex/market/tickers', params); @@ -6197,7 +6197,7 @@ export class RestClient extends BaseRestClient { * @param params Optional parameters to filter symbols * @returns Promise with array of funding info records */ - listCrossExMarketFundingInfo( + getCrossExMarketFundingInfo( params?: GetCrossExMarketFundingInfoReq, ): Promise { return this.get('/crossex/market/funding_info', params);