UNPKG

kucoin-api

Version:

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

439 lines (438 loc) 9.85 kB
/** * *********** * Spot Trading *********** * */ /** * * Market data * */ export interface CurrencyInfo { currency: string; name: string; fullName: string; precision: number; confirms: number | null; contractAddress: string | null; isMarginEnabled: boolean; isDebitEnabled: boolean; chains: Chain[]; } interface Chain { chainName: string; withdrawalMinSize: string; depositMinSize: string | null; withdrawFeeRate: string; withdrawalMinFee: string; isWithdrawEnabled: boolean; isDepositEnabled: boolean; confirms: number; preConfirms: number; contractAddress: string; withdrawPrecision: number; maxWithdraw: string | null; maxDeposit: string | null; needTag: boolean; chainId: string; } export interface SymbolInfo { symbol: string; name: string; baseCurrency: string; quoteCurrency: string; feeCurrency: string; market: 'USDS' | 'BTC' | 'ALTS'; baseMinSize: string; quoteMinSize: string; baseMaxSize: string; quoteMaxSize: string; baseIncrement: string; quoteIncrement: string; priceIncrement: string; priceLimitRate: string; minFunds: string; isMarginEnabled: boolean; enableTrading: boolean; feeCategory: 1 | 2 | 3; makerFeeCoefficient: string; takerFeeCoefficient: string; st: boolean; callauctionIsEnabled: boolean; callauctionPriceFloor: string | null; callauctionPriceCeiling: string | null; callauctionFirstStageStartTime: number | null; callauctionSecondStageStartTime: number | null; callauctionThirdStageStartTime: number | null; tradingStartTime: number | null; } export interface Ticker { sequence: string; price: string; size: string; bestAsk: string; bestAskSize: string; bestBid: string; bestBidSize: string; time: number; } export interface AllTickers { time: number; ticker: Ticker[]; } export interface AllTickersItem { symbol: string; symbolName: string; buy: string; bestBidSize: string; sell: string; bestAskSize: string; changeRate: string; changePrice: string; high: string; low: string; vol: string; volValue: string; last: string; averagePrice: string; takerFeeRate: string; makerFeeRate: string; takerCoefficient: string; makerCoefficient: string; } export interface Symbol24hrStats { time: number; symbol: string; buy: string; sell: string; changeRate: string; changePrice: string; high: string; low: string; vol: string; volValue: string; last: string; averagePrice: string; takerFeeRate: string; makerFeeRate: string; takerCoefficient: string; makerCoefficient: string; } export interface OrderBookLevel { sequence: string; time: number; bids: [string, string][]; asks: [string, string][]; } export interface CallAuctionInfo { symbol: string; estimatedPrice: string; estimatedSize: string; sellOrderRangeLowPrice: string; sellOrderRangeHighPrice: string; buyOrderRangeLowPrice: string; buyOrderRangeHighPrice: string; time: number; } export interface TradeHistory { sequence: string; time: number; price: string; size: string; side: string; } export type Kline = [string, string, string, string, string, string, string]; /** * * Spot HF trade * */ export interface SubmitHFOrderSyncResponse { orderId: string; orderTime: number; originSize: string; dealSize: string; remainSize: string; canceledSize: string; status: string; matchTime: number; clientOid: string; } export interface SubmitMultipleHFOrdersResponse { orderId: string; success?: boolean; failMsg?: string; clientOid: string; } export interface SubmitMultipleHFOrdersSyncResponse { orderId: string; orderTime: number; originSize: string; dealSize: string; remainSize: string; canceledSize: string; status: string; matchTime: number; success: boolean; clientOid: string; } export interface SyncCancelHFOrderResponse { clientOid?: string; orderId?: string; originSize: string; dealSize: string; remainSize: string; canceledSize: string; status: string; } export interface CancelAllHFOrdersResponse { succeedSymbols?: string[]; failedSymbols?: { symbol: string; error: string; }[]; } export interface AutoCancelHFOrderSettingQueryResponse { timeout: number; symbols: string; currentTime: number; triggerTime: number; } export interface HFFilledOrder { id: number; orderId: string; counterOrderId: string; tradeId: number; symbol: string; side: 'buy' | 'sell'; liquidity: 'taker' | 'maker'; type: 'limit' | 'market'; forceTaker: boolean; price: string; size: string; funds: string; fee: string; feeRate: string; feeCurrency: string; stop: string; tradeType: string; taxRate: string; tax: string; createdAt: number; } export interface HFOrder { id: string; clientOid: string; symbol: string; opType: string; type: 'limit' | 'market'; side: 'buy' | 'sell'; price: string; size: string; funds: string; dealSize: string; dealFunds: string; remainSize: string; remainFunds: string; cancelledSize: string; cancelledFunds: string; fee: string; feeCurrency: string; stp?: 'DC' | 'CO' | 'CN' | 'CB' | null; timeInForce: 'GTC' | 'GTT' | 'IOC' | 'FOK'; postOnly: boolean; hidden: boolean; iceberg: boolean; visibleSize: string; cancelAfter: number; channel: string; remark?: string | null; tags?: string | null; cancelExist: boolean; tradeType: string; inOrderBook: boolean; active: boolean; tax: string; createdAt: number; lastUpdatedAt: number; } /** * * Orders * */ export interface MultipleOrdersResponse { symbol: string; type?: string; side: string; price: string; size: string; funds?: any; stp?: string; stop?: string; stopPrice?: any; timeInForce?: string; cancelAfter?: number; postOnly?: boolean; hidden?: boolean; iceberg?: boolean; visibleSize?: any; channel: string; id: string; status: string; failMsg?: any; clientOid: string; } export interface SpotOrderList { currentPage: number; pageSize: number; totalNum: number; totalPage: number; items: SpotOrder[]; } export interface SpotOrder { id: string; symbol: string; opType: string; type: string; side: string; price: string; size: string; funds: string; dealFunds: string; dealSize: string; fee: string; feeCurrency: string; stp: string; stop: string; stopTriggered: boolean; stopPrice: string; timeInForce: string; postOnly: boolean; hidden: boolean; iceberg: boolean; visibleSize: string; cancelAfter: number; channel: string; clientOid: string; remark: string; tags: string; isActive: boolean; cancelExist: boolean; createdAt: number; tradeType: string; } /** * * Fills * */ export interface SpotOrderFill { symbol: string; tradeId: string; orderId: string; counterOrderId: string; side: 'buy' | 'sell'; price: string; size: string; funds: string; type: 'limit' | 'market' | 'limit_stop' | 'market_stop'; fee: string; feeCurrency: string; stop: string; liquidity: 'taker' | 'maker'; forceTaker: boolean; createdAt: number; tradeType: 'TRADE' | 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE'; } export interface SpotOrderFills { currentPage: number; pageSize: number; totalNum: number; totalPage: number; items: SpotOrderFill[]; } /** * * Stop order * */ export interface StopOrders { currentPage: number; pageSize: number; totalNum: number; totalPage: number; items: StopOrderItem[]; } export interface StopOrderItem { id?: string; symbol?: string; userId?: string; status?: 'NEW' | 'TRIGGERED'; type?: 'limit' | 'market' | 'limit_stop' | 'market_stop'; side?: 'buy' | 'sell'; price?: string; size?: string; funds?: string | null; stp?: string | null; timeInForce?: 'GTC' | 'GTT' | 'IOC' | 'FOK'; cancelAfter?: number; postOnly?: boolean; hidden?: boolean; iceberg?: boolean; visibleSize?: string | null; channel?: string; clientOid?: string; remark?: string | null; tags?: string | null; domainId?: string; tradeSource?: 'USER' | 'MARGIN_SYSTEM'; tradeType?: 'TRADE' | 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE'; feeCurrency?: string; takerFeeRate?: string; makerFeeRate?: string; createdAt?: number; stop?: 'loss' | 'entry'; stopTriggerTime?: number | null; stopPrice?: string; orderTime?: number; } /** * * OCO order * */ export interface OCOOrderDetails { orderId: string; symbol: string; clientOid: string; orderTime: number; status: 'NEW' | 'DONE' | 'TRIGGERED' | 'CANCELLED'; orders: OCOOrderSubOrder[]; } export interface OCOOrderSubOrder { id: string; symbol: string; side: 'buy' | 'sell'; price: string; stopPrice: string; size: string; status: 'NEW' | 'DONE' | 'TRIGGERED' | 'CANCELLED'; } export interface OCOOrders { currentPage: number; pageSize: number; totalNum: number; totalPage: number; items: OCOOrderListItem[]; } export interface OCOOrderListItem { orderId: string; symbol: string; clientOid: string; orderTime: number; status: 'NEW' | 'DONE' | 'TRIGGERED' | 'CANCELLED'; } export {};