UNPKG

ccxt

Version:

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

721 lines • 112 kB
import Exchange from './abstract/kucoin.js'; import type { ADL, Account, Balances, BorrowInterest, CrossBorrowRate, Currency, Currencies, DepositAddress, Dict, FundingHistory, FundingRate, Int, int, LedgerEntry, Leverage, LeverageTier, LeverageTiers, MarginMode, MarginModification, Market, Num, OHLCV, Order, OrderBook, OrderRequest, OrderSide, OrderType, OpenInterest, OpenInterests, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry } from './base/types.js'; /** * @class kucoin * @augments Exchange */ export default class kucoin extends Exchange { describe(): any; nonce(): number; /** * @method * @name kucoin#fetchTime * @description fetches the current integer timestamp in milliseconds from the exchange server * @see https://www.kucoin.com/docs-new/rest/spot-trading/market-data/get-server-time * @see https://www.kucoin.com/docs-new/rest/futures-trading/market-data/get-server-time * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {int} the current integer timestamp in milliseconds from the exchange server */ fetchTime(params?: {}): Promise<Int>; /** * @method * @name kucoin#fetchStatus * @description the latest known information on the availability of the exchange API * @see https://www.kucoin.com/docs-new/rest/spot-trading/market-data/get-service-status * @see https://www.kucoin.com/docs-new/rest/futures-trading/market-data/get-service-status * @see https://www.kucoin.com/docs-new/rest/ua/get-service-status * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.type] spot or swap * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false * @param {string} [params.tradeType] *uta only* set to SPOT or FUTURES * @returns {object} a [status structure]{@link https://docs.ccxt.com/?id=exchange-status-structure} */ fetchStatus(params?: {}): Promise<{ status: string; updated: any; eta: any; url: any; info: any; }>; /** * @method * @name kucoin#fetchMarkets * @description retrieves data on all markets for kucoin * @see https://www.kucoin.com/docs-new/rest/spot-trading/market-data/get-all-symbols * @see https://www.kucoin.com/docs-new/rest/ua/get-symbol * @see https://www.kucoin.com/docs-new/rest/futures-trading/market-data/get-all-symbols * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false * @returns {object[]} an array of objects representing market data */ fetchMarkets(params?: {}): Promise<Market[]>; fetchContractMarkets(params?: {}): Promise<Market[]>; fetchUTAMarkets(params?: {}): Promise<Market[]>; /** * @method * @name kucoin#loadMigrationStatus * @param {boolean} force load account state for non hf * @description loads the migration status for the account (hf or not) * @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/get-user-type * @returns {any} ignore */ loadMigrationStatus(force?: boolean): Promise<boolean>; handleHfAndParams(params?: {}): {}[]; /** * @method * @name kucoin#fetchCurrencies * @description fetches all available currencies on an exchange * @see https://www.kucoin.com/docs-new/rest/spot-trading/market-data/get-all-currencies * @see https://www.kucoin.com/docs-new/rest/ua/get-currencies * @param {object} params extra parameters specific to the exchange API endpoint * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false * @returns {object} an associative dictionary of currencies */ fetchCurrencies(params?: {}): Promise<Currencies>; parseCurrency(currency: Dict): Currency; /** * @method * @name kucoin#fetchAccounts * @description fetch all the accounts associated with a profile * @see https://www.kucoin.com/docs-new/rest/account-info/account-funding/get-account-list-spot * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/?id=account-structure} indexed by the account type */ fetchAccounts(params?: {}): Promise<Account[]>; /** * @method * @name kucoin#fetchTransactionFee * @description *DEPRECATED* please use fetchDepositWithdrawFee instead * @see https://docs.kucoin.com/#get-withdrawal-quotas * @param {string} code unified currency code * @param {object} params extra parameters specific to the exchange API endpoint * @returns {object} a [fee structure]{@link https://docs.ccxt.com/?id=fee-structure} */ fetchTransactionFee(code: string, params?: {}): Promise<{ info: any; withdraw: Dict; deposit: {}; }>; /** * @method * @name kucoin#fetchDepositWithdrawFee * @description fetch the fee for deposits and withdrawals * @see https://www.kucoin.com/docs-new/rest/account-info/withdrawals/get-withdrawal-quotas * @param {string} code unified currency code * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.network] The chain of currency. This only apply for multi-chain currency, and there is no need for single chain currency; you can query the chain through the response of the GET /api/v2/currencies/{currency} interface * @returns {object} a [fee structure]{@link https://docs.ccxt.com/?id=fee-structure} */ fetchDepositWithdrawFee(code: string, params?: {}): Promise<any>; parseDepositWithdrawFee(fee: any, currency?: Currency): Dict; isFuturesMethod(methodName: any, params: any): boolean; parseSpotOrUtaTicker(ticker: Dict, market?: Market): Ticker; parseTicker(ticker: Dict, market?: Market): Ticker; parseContractTicker(ticker: Dict, market?: Market): Ticker; typeToTradeType(type: Str): Str; /** * @method * @name kucoin#fetchTickers * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market * @see https://www.kucoin.com/docs-new/rest/spot-trading/market-data/get-all-tickers * @see https://www.kucoin.com/docs-new/rest/futures-trading/market-data/get-all-tickers * @see https://www.kucoin.com/docs-new/rest/ua/get-ticker * @param {string[]|undefined} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false * @param {string} [params.type] spot or swap (default is spot) * @param {string} [params.method] *swap only* the method to use, futuresPublicGetContractsActive or futuresPublicGetAllTickers (default is futuresPublicGetContractsActive) * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/?id=ticker-structure} */ fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>; fetchContractTickers(symbols?: Strings, params?: {}): Promise<Tickers>; /** * @method * @name kucoin#fetchMarkPrices * @description fetches the mark price for multiple markets * @see https://www.kucoin.com/docs-new/rest/margin-trading/market-data/get-mark-price-list * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/?id=ticker-structure} */ fetchMarkPrices(symbols?: Strings, params?: {}): Promise<Tickers>; /** * @method * @name kucoin#fetchTicker * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market * @see https://www.kucoin.com/docs-new/rest/spot-trading/market-data/get-24hr-stats * @see https://www.kucoin.com/docs-new/rest/futures-trading/market-data/get-ticker * @see https://www.kucoin.com/docs-new/rest/ua/get-ticker * @param {string} symbol unified symbol of the market to fetch the ticker for * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure} */ fetchTicker(symbol: string, params?: {}): Promise<Ticker>; /** * @method * @name kucoin#fetchMarkPrice * @description fetches the mark price for a specific market * @see https://www.kucoin.com/docs-new/rest/margin-trading/market-data/get-mark-price-detail * @see https://www.kucoin.com/docs-new/rest/futures-trading/market-data/get-mark-price * @param {string} symbol unified symbol of the market to fetch the ticker for * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure} */ fetchMarkPrice(symbol: string, params?: {}): Promise<Ticker>; parseOHLCV(ohlcv: any, market?: Market): OHLCV; /** * @method * @name kucoin#fetchOHLCV * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market * @see https://www.kucoin.com/docs-new/rest/spot-trading/market-data/get-klines * @see https://www.kucoin.com/docs-new/rest/futures-trading/market-data/get-klines * @see https://www.kucoin.com/docs-new/rest/ua/get-klines * @param {string} symbol unified symbol of the market to fetch OHLCV data for * @param {string} timeframe the length of time each candle represents * @param {int} [since] timestamp in ms of the earliest candle to fetch * @param {int} [limit] the maximum amount of candles to fetch * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume */ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>; /** * @method * @ignore * @name kucoin#fetchUTAOHLCV * @description helper method for fetchOHLCV * @see https://www.kucoin.com/docs-new/rest/ua/get-klines * @param {string} symbol unified symbol of the market to fetch OHLCV data for * @param {string} timeframe the length of time each candle represents * @param {int} [since] timestamp in ms of the earliest candle to fetch * @param {int} [limit] the maximum amount of candles to fetch * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume */ fetchUTAOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>; /** * @method * @ignore * @name kucoin#fetchSpotOHLCV * @description helper method for fetchOHLCV * @see https://www.kucoin.com/docs-new/rest/spot-trading/market-data/get-klines * @param {string} symbol unified symbol of the market to fetch OHLCV data for * @param {string} timeframe the length of time each candle represents * @param {int} [since] timestamp in ms of the earliest candle to fetch * @param {int} [limit] the maximum amount of candles to fetch * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume */ fetchSpotOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>; /** * @method * @ignore * @name kucoin#fetchContractOHLCV * @description helper method for fetchOHLCV * @see https://www.kucoin.com/docs-new/rest/futures-trading/market-data/get-klines * @param {string} symbol unified symbol of the market to fetch OHLCV data for * @param {string} timeframe the length of time each candle represents * @param {int} [since] timestamp in ms of the earliest candle to fetch * @param {int} [limit] the maximum amount of candles to fetch * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume */ fetchContractOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>; /** * @method * @name kucoin#createDepositAddress * @see https://www.kucoin.com/docs-new/rest/account-info/deposit/add-deposit-address-v3 * @description create a currency deposit address * @param {string} code unified currency code of the currency for the deposit address * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.network] the blockchain network name * @returns {object} an [address structure]{@link https://docs.ccxt.com/?id=address-structure} */ createDepositAddress(code: string, params?: {}): Promise<DepositAddress>; /** * @method * @name kucoin#fetchDepositAddress * @description fetch the deposit address for a currency associated with this account * @see https://www.kucoin.com/docs-new/rest/account-info/deposit/get-deposit-address-v3/en * @see https://www.kucoin.com/docs-new/rest/ua/get-deposit-address * @param {string} code unified currency code * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.network] the blockchain network name * @param {string} [params.accountType] 'main', 'contract' or 'uta' (default is 'main') * @param {boolean} [params.uta] set to true for the unified trading account (uta) endpoint, defaults to false * @returns {object} an [address structure]{@link https://docs.ccxt.com/?id=address-structure} */ fetchDepositAddress(code: string, params?: {}): Promise<DepositAddress>; /** * @method * @name kucoin#fetchContractDepositAddress * @description fetch the deposit address for a currency associated with this account * @see https://www.kucoin.com/docs/rest/funding/deposit/get-deposit-address * @param {string} code unified currency code * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} an [address structure]{@link https://docs.ccxt.com/?id=address-structure} */ fetchContractDepositAddress(code: string, params?: {}): Promise<DepositAddress>; parseDepositAddress(depositAddress: any, currency?: Currency): DepositAddress; /** * @method * @name kucoin#fetchDepositAddressesByNetwork * @see https://www.kucoin.com/docs-new/rest/account-info/deposit/get-deposit-address-v3/en * @see https://www.kucoin.com/docs-new/rest/ua/get-deposit-address * @description fetch the deposit address for a currency associated with this account * @param {string} code unified currency code * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {boolean} [params.uta] set to true for the unified trading account (uta) endpoint, defaults to false * @returns {object} an array of [address structures]{@link https://docs.ccxt.com/?id=address-structure} */ fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<DepositAddress[]>; /** * @method * @name kucoin#fetchOrderBook * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data * @see https://www.kucoin.com/docs-new/rest/spot-trading/market-data/get-part-orderbook * @see https://www.kucoin.com/docs-new/rest/spot-trading/market-data/get-full-orderbook * @see https://www.kucoin.com/docs-new/rest/futures-trading/market-data/get-part-orderbook * @see https://www.kucoin.com/docs-new/rest/ua/get-orderbook * @param {string} symbol unified symbol of the market to fetch the order book for * @param {int} [limit] the maximum amount of order book entries to return * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/?id=order-book-structure} indexed by market symbols */ fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>; handleTriggerPrices(params: any): any[]; /** * @method * @name kucoin#createOrder * @description Create an order on the exchange * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/add-order * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/add-order-sync * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/add-order-test * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/add-stop-order * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/add-order * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/add-order-test * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/add-stop-order * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/add-order * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/add-order-test * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/add-take-profit-and-stop-loss-order * @see https://www.kucoin.com/docs-new/rest/ua/place-order * @param {string} symbol Unified CCXT market symbol * @param {string} type 'limit' or 'market' * @param {string} side 'buy' or 'sell' * @param {float} amount the amount of currency to trade * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {boolean} [params.uta] set to true for the unified trading account (uta) endpoint, defaults to false * Check createSpotOrder(), createContractOrder() and createUtaOrder () for more details on the extra parameters that can be used in params * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} */ createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>; /** * @method * @name kucoin#createSpotOrder * @description helper method for creating spot orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/add-order * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/add-order-sync * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/add-order-test * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/add-stop-order * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/add-order * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/add-order-test * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/add-stop-order * @param {string} symbol Unified CCXT market symbol * @param {string} type 'limit' or 'market' * @param {string} side 'buy' or 'sell' * @param {float} amount the amount of currency to trade * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at * @param {string} [params.marginMode] 'cross', // cross (cross mode) and isolated (isolated mode), set to cross by default, the isolated mode will be released soon, stay tuned * @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only * @param {bool} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK * * EXCHANGE SPECIFIC PARAMETERS * @param {string} [params.clientOid] client order id, defaults to uuid if not passed * @param {string} [params.remark] remark for the order, length cannot exceed 100 utf8 characters * @param {string} [params.tradeType] 'TRADE', // TRADE, MARGIN_TRADE // not used with margin orders * limit orders --------------------------------------------------- * @param {float} [params.cancelAfter] long, // cancel after n seconds, requires timeInForce to be GTT * @param {bool} [params.hidden] false, // Order will not be displayed in the order book * @param {bool} [params.iceberg] false, // Only a portion of the order is displayed in the order book * @param {string} [params.visibleSize] this.amountToPrecision (symbol, visibleSize), // The maximum visible size of an iceberg order * market orders -------------------------------------------------- * @param {string} [params.funds] // Amount of quote currency to use * stop orders ---------------------------------------------------- * @param {string} [params.stop] Either loss or entry, the default is loss. Requires triggerPrice to be defined * margin orders -------------------------------------------------- * @param {float} [params.leverage] Leverage size of the order * @param {string} [params.stp] '', // self trade prevention, CN, CO, CB or DC * @param {bool} [params.autoBorrow] false, // The system will first borrow you funds at the optimal interest rate and then place an order for you * @param {bool} [params.hf] false, // true for hf order * @param {bool} [params.test] set to true to test an order, no order will be created but the request will be validated * @param {bool} [params.sync] set to true to use the hf sync call * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} */ createSpotOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>; createSpotOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): any; marketOrderAmountToPrecision(symbol: string, amount: any): string; /** * @method * @name kucoin#createContractOrder * @description helper method for creating contract orders * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/add-order * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/add-order-test * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/add-take-profit-and-stop-loss-order * @param {string} symbol Unified CCXT market symbol * @param {string} type 'limit' or 'market' * @param {string} side 'buy' or 'sell' * @param {float} amount the amount of currency to trade * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered and the triggerPriceType * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered and the triggerPriceType * @param {float} [params.triggerPrice] The price a trigger order is triggered at * @param {float} [params.stopLossPrice] price to trigger stop-loss orders * @param {float} [params.takeProfitPrice] price to trigger take-profit orders * @param {bool} [params.reduceOnly] A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. * @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only * @param {bool} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK * @param {float} [params.cost] the cost of the order in units of USDT * @param {string} [params.marginMode] 'cross' or 'isolated', default is 'isolated' * @param {bool} [params.hedged] *swap and future only* true for hedged mode, false for one way mode, default is false * ----------------- Exchange Specific Parameters ----------------- * @param {float} [params.leverage] Leverage size of the order (mandatory param in request, default is 1) * @param {string} [params.clientOid] client order id, defaults to uuid if not passed * @param {string} [params.remark] remark for the order, length cannot exceed 100 utf8 characters * @param {string} [params.stop] 'up' or 'down', the direction the triggerPrice is triggered from, requires triggerPrice. down: Triggers when the price reaches or goes below the triggerPrice. up: Triggers when the price reaches or goes above the triggerPrice. * @param {string} [params.triggerPriceType] "last", "mark", "index" - defaults to "mark" * @param {string} [params.stopPriceType] exchange-specific alternative for triggerPriceType: TP, IP or MP * @param {bool} [params.closeOrder] set to true to close position * @param {bool} [params.test] set to true to use the test order endpoint (does not submit order, use to validate params) * @param {bool} [params.forceHold] A mark to forcely hold the funds for an order, even though it's an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default.\ * @param {string} [params.positionSide] *swap and future only* hedged two-way position side, LONG or SHORT * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} */ createContractOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>; createContractOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): any; /** * @method * @name kucoin#createUtaOrder * @description helper method for creating uta orders * @see https://www.kucoin.com/docs-new/rest/ua/place-order * @param {string} symbol Unified CCXT market symbol * @param {string} type 'limit' or 'market' * @param {string} side 'buy' or 'sell' * @param {float} amount the amount of currency to trade * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.clientOrderId] client order id, defaults to uuid if not passed * @param {float} [params.cost] the cost of the order in units of quote currency * @param {string} [params.timeInForce] GTC, GTD, IOC, FOK or PO * @param {bool} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK (default is false) * @param {bool} [params.reduceOnly] *contract markets only* A mark to reduce the position size only. Set to false by default * @param {float} [params.triggerPrice] The price a trigger order is triggered at * @param {string} [params.triggerDirection] 'ascending' or 'descending', the direction the triggerPrice is triggered from, requires triggerPrice * @param {string} [params.triggerPriceType] *contract markets only* "last", "mark", "index" - defaults to "mark" * @param {float} [params.stopLossPrice] price to trigger stop-loss orders * @param {float} [params.takeProfitPrice] price to trigger take-profit orders * @param {string} [params.marginMode] 'cross' or 'isolated', (default is 'cross' for margin orders, default is 'isolated' for contract orders) * * Exchange-specific parameters ------------------------------------------------- * @param {string} [params.accountMode] 'unified' or 'classic', default is 'unified' * @param {string} [params.stp] '', // self trade prevention, CN, CO, CB or DC * @param {int} [params.cancelAfter] - Cancel After N Seconds (Calculated from the time of entering the matching engine), only effective when timeInForce is GTD * @param {string} [params.sizeUnit] *contracts only* 'BASECCY' (amount of base currency) or 'UNIT' (number of contracts), default is 'UNIT' * * Classic account parameters * @param {bool} [params.autoBorrow] *classic margin orders only* * @param {bool} [params.autoRepay] *classic margin orders only* * @param {string} [params.hedged] *classic contract orders only* true for hedged mode, false for one way mode, default is false * @param {int} [params.leverage] *classic contract orders with isolated marginMode only* Leverage size of the order * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} */ createUtaOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>; createUtaOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): any; /** * @method * @name kucoin#createMarketOrderWithCost * @description create a market order by providing the symbol, side and cost * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/add-order * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/add-order * @param {string} symbol unified symbol of the market to create an order in * @param {string} side 'buy' or 'sell' * @param {float} cost how much you want to trade in units of the quote currency * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} */ createMarketOrderWithCost(symbol: string, side: OrderSide, cost: number, params?: {}): Promise<Order>; /** * @method * @name kucoin#createMarketBuyOrderWithCost * @description create a market buy order by providing the symbol and cost * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/add-order * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/add-order * @param {string} symbol unified symbol of the market to create an order in * @param {float} cost how much you want to trade in units of the quote currency * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} */ createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>; /** * @method * @name kucoin#createMarketSellOrderWithCost * @description create a market sell order by providing the symbol and cost * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/add-order * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/add-order * @param {string} symbol unified symbol of the market to create an order in * @param {float} cost how much you want to trade in units of the quote currency * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} */ createMarketSellOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>; /** * @method * @name kucoin#createOrders * @description create a list of trade orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/batch-add-orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/batch-add-orders-sync * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params * @param {object} [params] extra parameters specific to the exchange API endpoint * Check createSpotOrders() and createContractOrders() for more details on the extra parameters that can be used in params * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} */ createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>; /** * @method * @name kucoin#createSpotOrders * @description helper method for creating spot orders in batch * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/batch-add-orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/batch-add-orders-sync * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/batch-add-orders * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {bool} [params.hf] false, // true for hf orders * @param {bool} [params.sync] false, // true to use the hf sync call * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} */ createSpotOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>; /** * @method * @name kucoin#createContractOrders * @description helper method for creating contract orders in batch * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/batch-add-orders * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} */ createContractOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>; /** * @method * @name kucoin#editOrder * @description edit an order, kucoin currently only supports the modification of HF orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/modify-order * @param {string} id order id * @param {string} symbol unified symbol of the market to create an order in * @param {string} type not used * @param {string} side not used * @param {float} amount how much of the currency you want to trade in units of the base currency * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.clientOrderId] client order id, defaults to id if not passed * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} */ editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>; /** * @method * @name kucoin#cancelOrder * @description cancels an open order * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-order-by-orderld * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-order-by-orderld-sync * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-order-by-clientoid * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-order-by-clientoid-sync * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-stop-order-by-clientoid * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-stop-order-by-orderld * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/cancel-order-by-orderld * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/cancel-order-by-clientoid * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/cancel-stop-order-by-orderld * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/cancel-stop-order-by-clientoid * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/cancel-order-by-orderld * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/cancel-order-by-clientoid * @see https://www.kucoin.com/docs-new/rest/ua/cancel-order * @param {string} id order id * @param {string} symbol unified symbol of the market the order was made in * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.type] 'spot' or 'swap', used if symbol is not provided (default is 'spot') * @param {string} [params.marginMode] *spot only* 'cross' or 'isolated' * @param {boolean} [params.uta] true for cancelling order with unified account endpoint (default is false) * Check cancelSpotOrder() and cancelContractOrder() for more details on the extra parameters that can be used in params * @returns Response from the exchange */ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>; /** * @method * @name kucoin#cancelSpotOrder * @description helper method for cancelling spot orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-order-by-orderld * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-order-by-orderld-sync * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-order-by-clientoid * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-order-by-clientoid-sync * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-stop-order-by-clientoid * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-stop-order-by-orderld * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/cancel-order-by-orderld * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/cancel-order-by-clientoid * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/cancel-stop-order-by-orderld * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/cancel-stop-order-by-clientoid * @param {string} id order id * @param {string} symbol unified symbol of the market the order was made in * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {bool} [params.trigger] True if cancelling a stop order * @param {bool} [params.hf] false, // true for hf order * @param {bool} [params.sync] false, // true to use the hf sync call * @param {string} [params.marginMode] 'cross' or 'isolated' * @returns Response from the exchange */ cancelSpotOrder(id: string, symbol?: Str, params?: {}): Promise<Order>; /** * @method * @name kucoin#cancelContractOrder * @description helper method for cancelling contract orders * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/cancel-order-by-orderld * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/cancel-order-by-clientoid * @param {string} id order id * @param {string} symbol unified symbol of the market the order was made in * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.clientOrderId] cancel order by client order id * @returns {object} An [order structure]{@link https://docs.ccxt.com/?id=order-structure} */ cancelContractOrder(id: string, symbol?: Str, params?: {}): Promise<Order>; /** * @method * @name kucoin#cancelUtaOrder * @description helper method for cancelling uta orders * @see https://www.kucoin.com/docs-new/rest/ua/cancel-order * @param {string} id order id * @param {string} symbol unified symbol of the market the order was made in * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.accountMode] 'unified' or 'classic' (default is 'unified') * @param {string} [params.clientOrderId] client order id, required if id is not provided * @param {string} [params.marginMode] 'cross' or 'isolated', required if fetching a margin order (unified accountMode supports only cross margin) * @returns Response from the exchange */ cancelUtaOrder(id: string, symbol?: Str, params?: {}): Promise<Order>; /** * @method * @name kucoin#cancelAllOrders * @description cancel all open orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-all-orders-by-symbol * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-all-orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/batch-cancel-stop-orders * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/cancel-all-orders-by-symbol * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/batch-cancel-stop-orders * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/cancel-all-orders * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/cancel-all-stop-orders * @see https://www.kucoin.com/docs-new/rest/ua/batch-cancel-order-by-symbol * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.type] 'spot' or 'swap', used if symbol is not provided (default is 'spot') * @param {string} [params.marginMode] *spot only* 'cross' or 'isolated' * @param {boolean} [params.uta] true for cancelling orders with unified account endpoint (default is false) * Check cancelAllSpotOrders(), cancelAllContractOrders() and cancelAllUtaOrders() for more details on the extra parameters that can be used in params * @returns Response from the exchange */ cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>; /** * @method * @name kucoin#cancelAllSpotOrders * @description helper method for cancelling all spot orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-all-orders-by-symbol * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/cancel-all-orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/batch-cancel-stop-orders * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/cancel-all-orders-by-symbol * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/batch-cancel-stop-orders * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {bool} [params.trigger] *invalid for isolated margin* true if cancelling all stop orders * @param {string} [params.marginMode] 'cross' or 'isolated' * @param {string} [params.orderIds] *stop orders only* Comma separated order IDs * @param {bool} [params.hf] false, // true for hf order * @returns Response from the exchange */ cancelAllSpotOrders(symbol?: Str, params?: {}): Promise<Order[]>; /** * @method * @name kucoin#cancelAllContractOrders * @description helper method for cancelling all contract orders * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/cancel-all-orders * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/cancel-all-stop-orders * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {object} [params.trigger] When true, all the trigger orders will be cancelled * @returns Response from the exchange */ cancelAllContractOrders(symbol?: Str, params?: {}): Promise<Order[]>; /** * @method * @name kucoin#cancelAllUtaOrders * @description helper method for cancelling all uta orders * @see https://www.kucoin.com/docs-new/rest/ua/batch-cancel-order-by-symbol * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {bool} [params.trigger] true if cancelling all stop orders * @param {string} [params.marginMode] 'CROSS' or 'ISOLATED' * @returns Response from the exchange */ cancelAllUtaOrders(symbol?: Str, params?: {}): Promise<Order[]>; /** * @method * @name kucoin#fetchOrdersByStatus * @description fetches a list of orders placed on the exchange * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/get-open-orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/get-closed-orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/get-stop-orders-list * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/get-open-orders * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/get-closed-orders * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/get-stop-order-list * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/get-order-list * @see https://www.kucoin.com/docs-new/rest/futures-trading/orders/get-stop-order-list * @see https://www.kucoin.com/docs-new/rest/ua/get-open-order-list * @see https://www.kucoin.com/docs-new/rest/ua/get-order-history * @param {string} status 'active' or 'closed', only 'active' is valid for stop orders * @param {string} symbol unified symbol for the market to retrieve orders from * @param {int} [since] timestamp in ms of the earliest order to retrieve * @param {int} [limit] The maximum number of orders to retrieve * @param {object} [params] exchange specific parameters * @param {boolean} [params.uta] true for fetch orders with uta endpoint (default is false) * Check fetchSpotOrdersByStatus(), fetchContractOrdersByStatus() and fetchUtaOrdersByStatus() for more details on the extra parameters that can be used in params * @returns An [array of order structures]{@link https://docs.ccxt.com/?id=order-structure} */ fetchOrdersByStatus(status: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>; /** * @method * @name kucoin#fetchSpotOrdersByStatus * @description fetch a list of spot orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/get-open-orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/get-closed-orders * @see https://www.kucoin.com/docs-new/rest/spot-trading/orders/get-stop-orders-list * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/get-open-orders * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/get-closed-orders * @see https://www.kucoin.com/docs-new/rest/margin-trading/orders/get-stop-order-list * @param {string} status *not used for stop orders* 'open' or 'closed' * @param {string} symbol unified market symbol * @param {int} [since] timestamp in ms of the earliest order * @param {int} [limit] max number of orders to return * @param {object} [params] exchange specific params * @param {int} [params.until] end time in ms * @param {string} [params.side] buy or sell * @param {string} [params.type] limit, market, limit_stop or market_stop * @param {string} [params.tradeType] TRADE for spot trading, MARGIN_TRADE or MARGIN_ISOLATED_TRADE for Margin Trading * @param {int} [params.currentPage] *trigger orders only* current page * @param {string} [params.orderIds] *trigger orders only* comma separated order ID list * @param {bool} [params.trigger] True if fetching a trigger order * @param {bool} [params.hf] false, // true for hf order * @param {string} [params.marginMode] 'cross' or 'isolated', only for margin orders * @returns An [array of order structures]{@link https://docs.ccxt.com/?id=order-structure} */ fetchSpotOrdersByStatus(status: any, symbol?: Str, since?: Int,