UNPKG

kucoin-api

Version:

Complete & robust Node.js SDK for Kucoin's REST APIs and WebSockets, with TypeScript & strong end to end tests.

304 lines (303 loc) 9.78 kB
/** * Unified Trading Account Request Types */ export interface GetAnnouncementsRequestUTA { language?: 'zh_HK' | 'ja_JP' | 'ko_KR' | 'en_US' | 'pl_PL' | 'es_ES' | 'fr_FR' | 'ar_AE' | 'it_IT' | 'id_ID' | 'nl_NL' | 'pt_PT' | 'vi_VN' | 'de_DE' | 'tr_TR' | 'ms_MY' | 'ru_RU' | 'th_TH' | 'hi_IN' | 'bn_BD' | 'fil_PH' | 'ur_PK'; type?: 'latest-announcements' | 'activities' | 'product-updates' | 'vip' | 'maintenance-updates' | 'delistings' | 'others' | 'api-campaigns' | 'new-listings' | 'futures-announcements'; pageNumber?: number; pageSize?: number; startTime?: number; endTime?: number; } export interface GetCurrencyRequestUTA { currency?: string; chain?: string; } export interface GetSymbolRequestUTA { tradeType: 'SPOT' | 'FUTURES' | 'ISOLATED' | 'CROSS'; symbol?: string; } export interface GetTickerRequestUTA { tradeType: 'SPOT' | 'FUTURES'; symbol?: string; } export interface GetTradesRequestUTA { tradeType: 'SPOT' | 'FUTURES'; symbol: string; } export interface GetOrderBookRequestUTA { tradeType: 'SPOT' | 'FUTURES'; symbol: string; limit: '20' | '50' | '100' | 'FULL'; /** * Whether it is an RPI Order. Applicable to FUTURES only. * 0: noneRPI Orders (default) * 1: noneRPI + RPI Orders */ rpiFilter?: 0 | 1; } export interface GetKlinesRequestUTA { tradeType: 'SPOT' | 'FUTURES'; symbol: string; interval: '1min' | '3min' | '5min' | '15min' | '30min' | '1hour' | '2hour' | '4hour' | '6hour' | '8hour' | '12hour' | '1day' | '1week' | '1month'; startAt?: number; endAt?: number; } export interface GetCurrentFundingRateRequestUTA { symbol: string; } export interface GetHistoryFundingRateRequestUTA { symbol: string; startAt: number; endAt: number; } export interface GetServiceStatusRequestUTA { tradeType: 'SPOT' | 'FUTURES'; } /** * Account Endpoints */ export interface GetClassicAccountRequestUTA { accountType: 'FUNDING' | 'SPOT' | 'FUTURES' | 'CROSS' | 'ISOLATED'; accountSubtype?: string; currency?: string; } export interface GetSubAccountRequestUTA { UID?: string; pageSize?: number; lastId?: number; } export interface GetTransferQuotasRequestUTA { currency: string; accountType: 'FUNDING' | 'SPOT' | 'FUTURES' | 'CROSS' | 'ISOLATED' | 'UNIFIED'; symbol?: string; } export interface FlexTransferRequestUTA { clientOid: string; currency: string; amount: string; type: '0' | '1' | '2' | '3'; fromAccountType: 'FUNDING' | 'SPOT' | 'FUTURES' | 'CROSS' | 'ISOLATED' | 'UNIFIED'; toAccountType: 'FUNDING' | 'SPOT' | 'FUTURES' | 'CROSS' | 'ISOLATED' | 'UNIFIED'; fromAccountSymbol?: string; toAccountSymbol?: string; fromUid?: string; toUid?: string; } export interface SetSubAccountTransferPermissionRequestUTA { subUids: string; subToSub: boolean; } export interface SetAccountModeRequestUTA { accountType: 'CLASSIC' | 'UNIFIED'; } export interface GetFeeRateRequestUTA { tradeType: 'SPOT' | 'FUTURES'; symbol: string; } export interface GetAccountLedgerRequestUTA { accountType: 'FUNDING' | 'SPOT' | 'FUTURES' | 'CROSS' | 'ISOLATED' | 'UNIFIED'; currency?: string; direction?: 'IN' | 'OUT'; businessType?: 'TRADE_EXCHANGE' | 'TRANSFER' | 'SUB_TRANSFER' | 'RETURNED_FEES' | 'DEDUCTION_FEES' | 'OTHER' | 'SUB_TO_SUB_TRANSFER' | 'SPOT_EXCHANGE' | 'SPOT_EXCHANGE_REBATE' | 'FUTURES_EXCHANGE_OPEN' | 'FUTURES_EXCHANGE_CLOSE' | 'FUTURES_EXCHANGE_REBATE' | 'FUNDING_FEE' | 'LIABILITY_INTEREST' | 'KCS_DEDUCTION_FEES' | 'KCS_RETURNED_FEES' | 'AUTO_EXCHANGE_USER'; lastId?: number; startAt?: number; endAt?: number; pageSize?: number; } export interface GetInterestHistoryRequestUTA { accountType: 'UNIFIED'; currency?: string; startTime?: number; endTime?: number; page?: number; size?: number; } export interface GetBorrowingRatesAndLimitsRequestUTA { currency: string; } export interface ModifyLeverageRequestUTA { symbol: string; leverage: string; } /** UTA cross margin only — path includes accountMode (typically unified) */ export interface ModifyMarginCrossLeverageRequestUTA { leverage: string; /** Cross margin currency (e.g. BTC) */ currency?: string; } export interface GetLeverageRequestUTA { tradeType: 'MARGIN' | 'FUTURES'; marginMode: 'CROSS' | 'ISOLATED'; /** Required for MARGIN when not returning all; optional => all for MARGIN */ currency?: string; /** Required for FUTURES when not returning all; optional => all for FUTURES */ symbol?: string; } export interface GetDepositAddressRequestUTA { currency: string; chain?: string; } /** * Order Endpoints */ export interface PlaceOrderRequestUTA { tradeType: 'SPOT' | 'FUTURES' | 'ISOLATED' | 'CROSS' | 'MARGIN'; clientOid?: string; symbol: string; side: 'BUY' | 'SELL'; positionSide?: 'BOTH' | 'LONG' | 'SHORT'; orderType: 'LIMIT' | 'MARKET'; size: string; sizeUnit: 'BASECCY' | 'QUOTECCY' | 'UNIT'; price?: string; leverage?: number; reduceOnly?: boolean; marginMode?: 'ISOLATED' | 'CROSS'; stp?: 'DC' | 'CO' | 'CN' | 'CB'; /** * Time in Force. Added 'RPI' as of 2025.01.02 * - GTC: Good Till Cancel (default) * - FOK: Fill Or Kill * - IOC: Immediate Or Cancel * - GTT: Good Till Time (not supported for Futures) * - RPI: Retail Price Improvement Order (Phase 1: Futures only) */ timeInForce?: 'GTC' | 'IOC' | 'GTT' | 'FOK' | 'RPI'; cancelAfter?: number; postOnly?: boolean; autoBorrow?: boolean; autoRepay?: boolean; tags?: string; triggerDirection?: 'DOWN' | 'UP'; triggerPrice?: string; triggerPriceType?: 'TP' | 'IP' | 'MP'; tpTriggerPrice?: string; tpTriggerPriceType?: 'TP' | 'IP' | 'MP'; slTriggerPrice?: string; slTriggerPriceType?: 'TP' | 'IP' | 'MP'; } export interface BatchPlaceOrderRequestUTA { tradeType: 'SPOT' | 'FUTURES' | 'ISOLATED' | 'CROSS' | 'MARGIN'; orderList: Omit<PlaceOrderRequestUTA, 'tradeType'>[]; } export interface GetOrderDetailsRequestUTA { tradeType: 'SPOT' | 'FUTURES' | 'ISOLATED' | 'CROSS' | 'MARGIN'; symbol: string; orderId?: string; clientOid?: string; } export interface GetOpenOrderListRequestUTA { tradeType: 'SPOT' | 'FUTURES' | 'ISOLATED' | 'CROSS' | 'MARGIN'; symbol?: string; orderFilter?: 'NORMAL' | 'CONDITION'; startAt?: number; endAt?: number; pageNumber?: number; pageSize?: number; } export interface GetOrderHistoryRequestUTA { tradeType: 'SPOT' | 'FUTURES' | 'ISOLATED' | 'CROSS' | 'MARGIN'; symbol?: string; side?: 'BUY' | 'SELL'; orderFilter?: 'NORMAL' | 'CONDITION'; startAt?: number; endAt?: number; lastId?: string; pageSize?: number; } export interface GetTradeHistoryRequestUTA { tradeType: 'SPOT' | 'FUTURES' | 'ISOLATED' | 'CROSS' | 'MARGIN'; symbol?: string; orderId?: string; side?: 'BUY' | 'SELL'; type?: 'LIMIT' | 'MARKET'; startAt?: number; endAt?: number; lastId?: string; pageSize?: number; } export interface CancelOrderRequestUTA { tradeType: 'SPOT' | 'FUTURES' | 'ISOLATED' | 'CROSS' | 'MARGIN'; symbol: string; orderId?: string; clientOid?: string; } export interface CancelOrderItemRequestUTA { symbol: string; orderId?: string; clientOid?: string; } export interface BatchCancelOrdersRequestUTA { tradeType: 'SPOT' | 'FUTURES' | 'ISOLATED' | 'CROSS' | 'MARGIN'; cancelOrderList: CancelOrderItemRequestUTA[]; } /** Batch cancel orders by symbol (POST /order/cancel-all) */ export interface BatchCancelOrdersBySymbolRequestUTA { tradeType: 'SPOT' | 'FUTURES' | 'MARGIN'; symbol: string; marginMode?: 'CROSS' | 'ISOLATED'; orderFilter?: 'NORMAL' | 'ADVANCED'; } export interface SetDCPRequestUTA { tradeType: 'SPOT' | 'FUTURES' | 'MARGIN'; timeout: number; symbols?: string[]; } export interface GetDCPRequestUTA { tradeType: 'SPOT' | 'FUTURES' | 'MARGIN'; } /** * Position Endpoints */ export interface GetPositionListRequestUTA { symbol?: string; pageNumber?: number; pageSize?: number; } /** Third-party custody (OES) custodian codes */ export type ThirdPartyCustodyCustodianUTA = 'BITGO_SG' | 'BITGO_SD' | 'CACTUS' | 'CEFFU'; /** * Get Third-Party Custody Currencies (public) * Settlement currencies supported per custodian. */ export interface GetThirdPartyCustodyCurrenciesRequestUTA { /** If omitted, returns all custodian rows */ custodian?: ThirdPartyCustodyCustodianUTA; /** If omitted, all currencies for the selected custodian(s) */ currency?: string; } /** * Get Third-Party Custody Account Currency Limits (private) * Remaining OES custody quota per custodian/currency. */ export interface GetThirdPartyCustodyQuotaRequestUTA { /** * If sub-account API key is used, this parameter is ignored; only the * custodian bound to the sub-account is returned (per API docs). */ custodian?: ThirdPartyCustodyCustodianUTA; /** If omitted, limits for all currencies under the custodian */ currency?: string; } export interface GetPositionsHistoryRequestUTA { symbol?: string; startAt?: number; endAt?: number; lastId?: number; pageSize?: number; } /** Settled funding fee history (private) */ export interface GetPrivateFundingFeeHistoryRequestUTA { symbol?: string; startAt?: number; endAt?: number; lastId?: number; pageSize?: number; } export interface GetAccountPositionTiersRequestUTA { symbol: string; tradeType?: 'FUTURES' | 'MARGIN'; marginMode?: 'ISOLATED' | 'CROSS'; data?: 'RISK_LIMIT' | 'BORROW'; }