kucoin-api
Version:
Complete & robust Node.js SDK for Kucoin's REST APIs and WebSockets, with TypeScript & strong end to end tests.
308 lines (307 loc) • 17.4 kB
TypeScript
import { BaseRestClient } from './lib/BaseRestClient.js';
import { RestClientType } from './lib/requestUtils.js';
import { BatchCancelOrdersBySymbolRequestUTA, BatchCancelOrdersRequestUTA, BatchPlaceOrderRequestUTA, CancelOrderRequestUTA, FlexTransferRequestUTA, GetAccountLedgerRequestUTA, GetAccountPositionTiersRequestUTA, GetAnnouncementsRequestUTA, GetBorrowingRatesAndLimitsRequestUTA, GetClassicAccountRequestUTA, GetCurrencyRequestUTA, GetCurrentFundingRateRequestUTA, GetDCPRequestUTA, GetDepositAddressRequestUTA, GetFeeRateRequestUTA, GetHistoryFundingRateRequestUTA, GetInterestHistoryRequestUTA, GetKlinesRequestUTA, GetLeverageRequestUTA, GetOpenOrderListRequestUTA, GetOrderBookRequestUTA, GetOrderDetailsRequestUTA, GetOrderHistoryRequestUTA, GetPositionListRequestUTA, GetPositionsHistoryRequestUTA, GetPrivateFundingFeeHistoryRequestUTA, GetServiceStatusRequestUTA, GetSubAccountRequestUTA, GetSymbolRequestUTA, GetThirdPartyCustodyCurrenciesRequestUTA, GetThirdPartyCustodyQuotaRequestUTA, GetTickerRequestUTA, GetTradeHistoryRequestUTA, GetTradesRequestUTA, GetTransferQuotasRequestUTA, ModifyLeverageRequestUTA, ModifyMarginCrossLeverageRequestUTA, PlaceOrderRequestUTA, SetAccountModeRequestUTA, SetDCPRequestUTA, SetSubAccountTransferPermissionRequestUTA } from './types/request/uta-types.js';
import { APISuccessResponse } from './types/response/shared.types.js';
import { BatchCancelOrdersBySymbolResponseUTA, BatchCancelOrdersResponseUTA, BatchPlaceOrderResponseUTA, BorrowableCurrencyUTA, CancelOrderResponseUTA, DCPResponseUTA, DepositAddressUTA, FlexTransferResponseUTA, GetAccountLedgerResponseClassicUTA, GetAccountLedgerResponseUTA, GetAccountModeResponseUTA, GetAccountOverviewResponseUTA, GetAnnouncementsResponseUTA, GetBorrowingRatesAndLimitsResponseUTA, GetClassicAccountResponseUTA, GetCrossMarginConfigResponseUTA, GetCurrencyResponseUTA, GetCurrentFundingRateResponseUTA, GetFeeRateResponseUTA, GetHistoryFundingRateResponseUTA, GetInterestHistoryResponseUTA, GetKlinesResponseUTA, GetLeverageItemUTA, GetOpenOrderListResponseUTA, GetOrderBookResponseUTA, GetOrderHistoryResponseUTA, GetPositionsHistoryResponseUTA, GetPrivateFundingFeeHistoryResponseUTA, GetServiceStatusResponseUTA, GetSubAccountResponseUTA, GetSymbolResponseUTA, GetTickerResponseUTA, GetTradeHistoryResponseUTA, GetTradesResponseUTA, GetTransferQuotasResponseUTA, ModifyMarginCrossLeverageResponseUTA, OrderDetailsUTA, PlaceOrderResponseUTA, PositionTierUTA, PositionUTA, SubAccountTransferPermissionUTA, ThirdPartyCustodyCurrencyUTA, ThirdPartyCustodyQuotaUTA } from './types/response/uta-types.js';
/**
* Unified Trading Account Client
*
* This client provides access to the Unified Trading Account API endpoints
* that unify market data access across Spot, Futures, and Margin trading.
*/
export declare class UnifiedAPIClient extends BaseRestClient {
getClientType(): RestClientType;
/**
*
* REST - Unified Trading Account - Market Data
*
*/
/**
* Get Announcements
* This interface can obtain the latest news announcements, and the default
* page search is for announcements within a month.
*/
getAnnouncements(params?: GetAnnouncementsRequestUTA): Promise<APISuccessResponse<GetAnnouncementsResponseUTA>>;
/**
* Get Currency
* Request the currency details of a specified currency via this endpoint.
*/
getCurrency(params?: GetCurrencyRequestUTA): Promise<APISuccessResponse<GetCurrencyResponseUTA>>;
/**
* Get Third-Party Custody Currencies
* Query settlement currencies supported by third-party (OES) custodian institutions.
*/
getThirdPartyCustodyCurrencies(params?: GetThirdPartyCustodyCurrenciesRequestUTA): Promise<APISuccessResponse<ThirdPartyCustodyCurrencyUTA[]>>;
/**
* Get Symbol
* Request a list of available currency pairs for trading via this endpoint.
*/
getSymbols(params: GetSymbolRequestUTA): Promise<APISuccessResponse<GetSymbolResponseUTA>>;
/**
* Get Ticker
* Request market tickers for the trading pairs in the market (including 24h volume).
*/
getTickers(params: GetTickerRequestUTA): Promise<APISuccessResponse<GetTickerResponseUTA>>;
/**
* Get Trades
* Request via this endpoint to get the latest 100 public trades of the specified symbol.
*/
getTrades(params: GetTradesRequestUTA): Promise<APISuccessResponse<GetTradesResponseUTA>>;
/**
* Get OrderBook
* Query order book depth information (aggregated by price).
*/
getOrderBook(params: GetOrderBookRequestUTA): Promise<APISuccessResponse<GetOrderBookResponseUTA>>;
/**
* Get Klines
* Get the Kline of the symbol. Data are returned in grouped buckets based on requested type.
*/
getKlines(params: GetKlinesRequestUTA): Promise<APISuccessResponse<GetKlinesResponseUTA>>;
/**
* Get Current Funding Rate
* Get current Futures funding fee rate.
*/
getCurrentFundingRate(params: GetCurrentFundingRateRequestUTA): Promise<APISuccessResponse<GetCurrentFundingRateResponseUTA>>;
/**
* Get History Funding Rate
* Query the Futures funding rate at each settlement time point within a certain time range.
*/
getHistoryFundingRate(params: GetHistoryFundingRateRequestUTA): Promise<APISuccessResponse<GetHistoryFundingRateResponseUTA>>;
/**
* Get Cross Margin Config
* Request the configure info of the 'spot cross margin' via this endpoint.
*/
getCrossMarginConfig(): Promise<APISuccessResponse<GetCrossMarginConfigResponseUTA>>;
/**
* Get Borrowable Currencies
* List of borrowable currencies (UTA / public).
*/
getBorrowableCurrencies(): Promise<APISuccessResponse<BorrowableCurrencyUTA[]>>;
/**
* Get Service Status
* Get the service status.
*/
getServiceStatus(params: GetServiceStatusRequestUTA): Promise<APISuccessResponse<GetServiceStatusResponseUTA>>;
/**
*
* REST - Unified Trading Account - Account
*
*/
/**
* Get Account (Classic)
* Get information for Classic Account (FUNDING, SPOT, FUTURES, CROSS, ISOLATED).
* Note: AccountType enum value changed from TRADING to SPOT as of 2026.01.17.
*/
getClassicAccount(params: GetClassicAccountRequestUTA): Promise<APISuccessResponse<GetClassicAccountResponseUTA>>;
/**
* Get Account (UTA)
* Get information for Unified Trading Account.
*/
getAccount(): Promise<APISuccessResponse<GetClassicAccountResponseUTA>>;
/**
* Get Account Overview (UTA)
* Get account overview for Unified Trading Account.
*/
getAccountOverview(): Promise<APISuccessResponse<GetAccountOverviewResponseUTA>>;
/**
* Get Sub Account
* Request sub account info via this endpoint.
*/
getSubAccount(params?: GetSubAccountRequestUTA): Promise<APISuccessResponse<GetSubAccountResponseUTA>>;
/**
* Get Transfer Quotas
* This endpoint returns the transferable balance of a specified account.
* Note: AccountType enum value changed from TRADING to SPOT as of 2026.01.17.
*/
getTransferQuotas(params: GetTransferQuotasRequestUTA): Promise<APISuccessResponse<GetTransferQuotasResponseUTA>>;
/**
* Flex Transfer
* This interface can be used for transfers between master- and sub-accounts and transfers.
* Note: AccountType enum value changed from TRADING to SPOT as of 2026.01.17.
*/
flexTransfer(params: FlexTransferRequestUTA): Promise<APISuccessResponse<FlexTransferResponseUTA>>;
/**
* Set Sub Account Transfer Permission
* This endpoint supports setting whether the specified sub-account needs to open the SUB_TO_SUB transfer permission.
*/
setSubAccountTransferPermission(params: SetSubAccountTransferPermissionRequestUTA): Promise<APISuccessResponse<SubAccountTransferPermissionUTA[]>>;
/**
* Get Account Mode
* This interface supports query the list of unified and classic sub-accounts and current account mode.
*/
getAccountMode(): Promise<APISuccessResponse<GetAccountModeResponseUTA>>;
/**
* Set Account Mode
* This interface supports set account mode to UTA.
*/
setAccountMode(params: SetAccountModeRequestUTA): Promise<APISuccessResponse<null>>;
/**
* Get Fee Rate
* This interface is for the trading pair's actual fee rate.
* You can inquire about fee rates of 10 trading pairs each time at most for Spot.
* Futures only supports 1 symbol at a time.
*/
getFeeRate(params: GetFeeRateRequestUTA): Promise<APISuccessResponse<GetFeeRateResponseUTA>>;
/**
* Get Account Ledger
* This API endpoint returns all transfer (in and out) records and supports multi-coin queries.
* The query results are sorted in descending order by createdAt and ID.
* Note: AccountType enum value changed from TRADING to SPOT as of 2026.01.17.
* Note: direction values unified to uppercase IN/OUT as of 2026.01.17.
* Note: For Futures - id changed from Number to String, balance/amount changed from Number to String as of 2026.01.17.
* Note: ts standardized to nanoseconds as of 2026.01.12.
*/
getAccountLedger(params: GetAccountLedgerRequestUTA): Promise<APISuccessResponse<GetAccountLedgerResponseUTA | GetAccountLedgerResponseClassicUTA>>;
/**
* Get Interest History (UTA)
* Request the interest records via this endpoint.
*/
getInterestHistory(params: GetInterestHistoryRequestUTA): Promise<APISuccessResponse<GetInterestHistoryResponseUTA>>;
/**
* Get Borrowing Rates and Limits
* Hourly/daily rates and borrow limits (UTA).
*/
getBorrowingRatesAndLimits(params: GetBorrowingRatesAndLimitsRequestUTA): Promise<APISuccessResponse<GetBorrowingRatesAndLimitsResponseUTA>>;
/**
* Modify Leverage (UTA)
* This interface supports modify leverage of the specified symbol.
*/
modifyLeverage(params: ModifyLeverageRequestUTA): Promise<APISuccessResponse<null>>;
/**
* Modify Leverage Margin Cross (UTA)
* Update leverage for a currency in UTA cross margin.
*/
modifyMarginCrossLeverage(params: ModifyMarginCrossLeverageRequestUTA, accountMode?: 'unified'): Promise<APISuccessResponse<ModifyMarginCrossLeverageResponseUTA>>;
/**
* Get Leverage (UTA)
* Query leverage for MARGIN (currency) or FUTURES (symbol).
*/
getLeverage(params: GetLeverageRequestUTA): Promise<APISuccessResponse<GetLeverageItemUTA[]>>;
/**
* Get Deposit Address
* Return a deposit address; when both currency and chain are provided,
* the address will be created if it does not exist.
* URL unified to GET /api/ua/v1/asset/deposit/address as of 2026.01.17.
*/
getDepositAddress(params: GetDepositAddressRequestUTA): Promise<APISuccessResponse<DepositAddressUTA[]>>;
/**
* Get Third-Party Custody Account Currency Limits
* OES remaining custody quota per custodian and settlement currency.
*/
getThirdPartyCustodyQuota(params?: GetThirdPartyCustodyQuotaRequestUTA): Promise<APISuccessResponse<ThirdPartyCustodyQuotaUTA[]>>;
/**
*
* REST - Unified Trading Account - Orders
*
*/
/**
* Place Order
* This interface can be used to place orders.
* Supports RPI (Retail Price Improvement) orders for Futures as of 2025.01.02.
* Note: timeInForce supports 'RPI' value for Futures only (Phase 1).
* Note: For Classic mode, tradeType is required in query param.
* Note: For Unified mode, tradeType is sent in the request body (incl. MARGIN as of 2026.04.19).
*/
placeOrder(params: PlaceOrderRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<PlaceOrderResponseUTA>>;
/**
* Batch Place Order (Classic)
* This interface can be used for placing batch orders.
* URL changed to /api/ua/v1/{accountMode}/order/place-batch as of 2026.01.17.
* Note: timeInForce supports 'RPI' value for Futures as of 2025.01.02.
*/
batchPlaceOrder(params: BatchPlaceOrderRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<BatchPlaceOrderResponseUTA>>;
/**
* Get Order Details
* This interface can be used getting single order details.
* Note: timeInForce returns 'RPI' value for Futures RPI orders as of 2025.01.02.
* Note: status changed from String to Number for UTA as of 2026.01.17.
* Note: orderTime/updatedTime standardized to nanoseconds as of 2026.01.12.
*/
getOrderDetails(params: GetOrderDetailsRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<OrderDetailsUTA>>;
/**
* Get Open Order List
* This interface can be used getting open order list.
* Note: timeInForce returns 'RPI' value for Futures RPI orders as of 2025.01.02.
* Note: status changed from String to Number for UTA as of 2026.01.17.
* Note: orderTime/updatedTime standardized to nanoseconds as of 2026.01.12.
*/
getOpenOrderList(params: GetOpenOrderListRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<GetOpenOrderListResponseUTA>>;
/**
* Get Order History
* This interface can be used for getting order history.
* Note: timeInForce returns 'RPI' value for Futures RPI orders as of 2025.01.02.
* Note: status changed from String to Number for UTA as of 2026.01.17.
* Note: orderTime/updatedTime standardized to nanoseconds as of 2026.01.12.
*/
getOrderHistory(params: GetOrderHistoryRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<GetOrderHistoryResponseUTA>>;
/**
* Get Trade History
* This interface can be used for getting trade execution history.
* Note: executionTime standardized to nanoseconds as of 2026.01.12.
* Note: isRpiTrade added for Futures as of 2025.01.02.
*/
getTradeHistory(params: GetTradeHistoryRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<GetTradeHistoryResponseUTA>>;
/**
* Cancel Order
* This interface can be used to cancel orders.
* Note: ts (timestamp in nanoseconds) only effective for unified account mode.
*/
cancelOrder(params: CancelOrderRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<CancelOrderResponseUTA>>;
/**
* Batch Cancel Orders
* This interface can be used for batch cancel orders (maximum 20 orders).
* Note: tradeType required for Classic accounts only; ignored in UTA (UNIFIED) mode.
* Note: ts (timestamp in nanoseconds) not supported for classic accounts.
*/
batchCancelOrders(params: BatchCancelOrdersRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<BatchCancelOrdersResponseUTA>>;
/**
* Batch Cancel Orders By Symbol
* Cancels orders in batch by symbol. UTA only. Supports SPOT (non-margin) and Futures Cross Margin.
*/
batchCancelOrdersBySymbol(params: BatchCancelOrdersBySymbolRequestUTA): Promise<APISuccessResponse<BatchCancelOrdersBySymbolResponseUTA>>;
/**
* Set DCP (Disconnection Protect / Deadman Switch) - Classic Only
* Set automatic order cancellation after specified time.
* Call this interface to automatically cancel all orders of the set trading pair after the specified time.
* Note: Order cancellation delay is between 0 and 10 seconds.
* Note: timeout range: -1 (unset) or 5 <= timeout <= 86400 seconds.
*/
setDCP(params: SetDCPRequestUTA): Promise<APISuccessResponse<DCPResponseUTA>>;
/**
* Get DCP (Disconnection Protect / Deadman Switch) - Classic Only
* Get automatic order cancellation settings.
* If data is empty, it means DCP is not set.
*/
getDCP(params: GetDCPRequestUTA): Promise<APISuccessResponse<DCPResponseUTA>>;
/**
*
* REST - Unified Trading Account - Positions
*
*/
/**
* Get Position List (UTA)
* Get the position details of all open positions.
* Note: creationTime standardized to nanoseconds as of 2026.01.12.
* Note: pageNumber, pageSize query params and liquidationPrice in each position (as of 2026.04.09).
*/
getPositionList(params?: GetPositionListRequestUTA): Promise<APISuccessResponse<PositionUTA[]>>;
/**
* Get Positions History (UTA)
* Query position history information records.
* Note: Data retained for up to 3 months.
* Note: Each query limited to 7 days time range.
* Note: creationTime and closingTime standardized to nanoseconds as of 2026.01.12.
*/
getPositionsHistory(params?: GetPositionsHistoryRequestUTA): Promise<APISuccessResponse<GetPositionsHistoryResponseUTA>>;
/**
* Get Private Funding Fee History
* Settled funding fee records for the current account.
*/
getPrivateFundingFeeHistory(params?: GetPrivateFundingFeeHistoryRequestUTA): Promise<APISuccessResponse<GetPrivateFundingFeeHistoryResponseUTA>>;
/**
* Get Account Position Tiers
* Request account position tiers (risk limit) info.
* Note: Currently only queries of classic - futures isolated margin are supported.
*/
getAccountPositionTiers(params: GetAccountPositionTiersRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<PositionTierUTA[]>>;
}