Market Endpoints

class kucoin.client.Client(api_key=None, api_secret=None, passphrase=None, sandbox=False, requests_params=None)[source]
get_24hr_stats(symbol, **params)[source]

Get 24hr stats for a symbol. Volume is in base currency units. open, high, low are in quote currency units.

https://www.kucoin.com/docs/rest/spot-trading/market-data/get-24hr-stats

Parameters:

symbol (string) – Name of symbol e.g. KCS-BTC

stats = client.get_24hr_stats('ETH-BTC')
Returns:

ApiResponse

{
    "time": 1602832092060, // time
    "symbol": "BTC-USDT", // symbol
    "buy": "11328.9", // bestAsk
    "sell": "11329", // bestBid
    "changeRate": "-0.0055", // 24h change rate
    "changePrice": "-63.6", // 24h change price
    "high": "11610", // 24h highest price
    "low": "11200", // 24h lowest price
    "vol": "2282.70993217", // 24h volume the aggregated trading volume in BTC
    "volValue": "25984946.157790431", // 24h total, the trading volume in quote currency of last 24 hours
    "last": "11328.9", // last price
    "averagePrice": "11360.66065903", // 24h average transaction price yesterday
    "takerFeeRate": "0.001", // Basic Taker Fee
    "makerFeeRate": "0.001", // Basic Maker Fee
    "takerCoefficient": "1", // Taker Fee Coefficient
    "makerCoefficient": "1" // Maker Fee Coefficient
}
Raises:

KucoinResponseException, KucoinAPIException

get_full_order_book(symbol, **params)[source]

Get a list of all bids and asks aggregated by price for a symbol.

This call is generally used by professional traders because it uses more server resources and traffic, and Kucoin has strict access frequency control.

https://www.kucoin.com/docs/rest/spot-trading/market-data/get-full-order-book-aggregated-

Parameters:

symbol (string) – Name of symbol e.g. KCS-BTC

orders = client.get_order_book('KCS-BTC')
Returns:

ApiResponse

{
    "sequence": "3262786978",
    "bids": [
        ["6500.12", "0.45054140"],  # [price size]
        ["6500.11", "0.45054140"]
    ],
    "asks": [
        ["6500.16", "0.57753524"],
        ["6500.15", "0.57753524"]
    ]
}
Raises:

KucoinResponseException, KucoinAPIException

get_historical_orders(symbol=None, side=None, start=None, end=None, page=None, limit=None)[source]

Deprecated

get_kline_data(symbol, kline_type='5min', start=None, end=None, **params)[source]

Get kline data

https://www.kucoin.com/docs/rest/spot-trading/market-data/get-klines

For each query, the system would return at most 1500 pieces of data. To obtain more data, please page the data by time.

Parameters:
  • symbol (string) – Name of symbol e.g. KCS-BTC

  • kline_type (string) – type of symbol, type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 8hour, 12hour, 1day, 1week

  • start (int) – Start time as unix timestamp (optional) default start of day in UTC

  • end (int) – End time as unix timestamp (optional) default now in UTC

klines = client.get_kline_data('KCS-BTC', '5min', 1507479171, 1510278278)
Returns:

ApiResponse

[
    [
        "1545904980",             //Start time of the candle cycle
        "0.058",                  //opening price
        "0.049",                  //closing price
        "0.058",                  //highest price
        "0.049",                  //lowest price
        "0.018",                  //Transaction amount
        "0.000945"                //Transaction volume
    ],
    [
        "1545904920",
        "0.058",
        "0.072",
        "0.072",
        "0.058",
        "0.103",
        "0.006986"
    ]
]
Raises:

KucoinResponseException, KucoinAPIException

get_markets()[source]

Get supported market list

https://www.kucoin.com/docs/rest/spot-trading/market-data/get-market-list

markets = client.get_markets()
Returns:

ApiResponse

{
    "data": [
        "USDS", //SC has been changed to USDS
        "BTC",
        "KCS",
        "ALTS", //ALTS market includes ETH, NEO, TRX
        "NFT-ETF",
        "FIAT",
        "DeFi",
        "NFT",
        "Metaverse",
        "Polkadot",
        "ETF"
    ],
    "code": "200000"
}
Raises:

KucoinResponseException, KucoinAPIException

get_order_book(symbol, depth_20=False, **params)[source]

Get a list of bids and asks aggregated by price for a symbol.

Returns up to 20 or 100 depth each side. Fastest Order book API

https://www.kucoin.com/docs/rest/spot-trading/market-data/get-part-order-book-aggregated-

Parameters:
  • symbol (string) – Name of symbol e.g. KCS-BTC

  • depth_20 (bool) – If to return only 20 depth

orders = client.get_order_book('KCS-BTC')
Returns:

ApiResponse

{
    "sequence": "3262786978",
    "time": 1550653727731,
    "bids": [
        ["6500.12", "0.45054140"],
        ["6500.11", "0.45054140"]
    ],
    "asks": [
        ["6500.16", "0.57753524"],
        ["6500.15", "0.57753524"]
    ]
}
Raises:

KucoinResponseException, KucoinAPIException

get_symbols(market=None, **params)[source]

Get a list of available currency pairs for trading.

https://www.kucoin.com/docs/rest/spot-trading/market-data/get-symbols-list

Parameters:

market (string) – (optional) Name of market e.g. BTC

symbols = client.get_symbols()
symbols = client.get_symbols('USDS')
Returns:

ApiResponse

[
    {
        "symbol": "XLM-USDT",
        "name": "XLM-USDT",
        "baseCurrency": "XLM",
        "quoteCurrency": "USDT",
        "feeCurrency": "USDT",
        "market": "USDS",
        "baseMinSize": "0.1",
        "quoteMinSize": "0.01",
        "baseMaxSize": "10000000000",
        "quoteMaxSize": "99999999",
        "baseIncrement": "0.0001",
        "quoteIncrement": "0.000001",
        "priceIncrement": "0.000001",
        "priceLimitRate": "0.1",
        "minFunds": "0.1",
        "isMarginEnabled": true,
        "enableTrading": true
    },
    {
        "symbol": "VET-USDT",
        "name": "VET-USDT",
        "baseCurrency": "VET",
        "quoteCurrency": "USDT",
        "feeCurrency": "USDT",
        "market": "USDS",
        "baseMinSize": "10",
        "quoteMinSize": "0.01",
        "baseMaxSize": "10000000000",
        "quoteMaxSize": "99999999",
        "baseIncrement": "0.0001",
        "quoteIncrement": "0.000001",
        "priceIncrement": "0.0000001",
        "priceLimitRate": "0.1",
        "minFunds": "0.1",
        "isMarginEnabled": true,
        "enableTrading": true
    }
]
Raises:

KucoinResponseException, KucoinAPIException

get_ticker(symbol, **params)[source]

Get symbol ticker

https://www.kucoin.com/docs/rest/spot-trading/market-data/get-ticker

Parameters:

symbol (string) – Name of symbol e.g. KCS-BTC

ticker = client.get_ticker('ETH-BTC')
Returns:

ApiResponse

{
    "sequence": "1550467636704",
    "price": "0.03715005",
    "size": "0.17",
    "bestAsk": "0.03715004",
    "bestAskSize": "1.788",
    "bestBid": "0.03710768",
    "bestBidSize": "3.803",
    "time": 1550653727731
}
Raises:

KucoinResponseException, KucoinAPIException

get_trade_histories(symbol, **params)[source]

List the latest trades for a symbol

https://www.kucoin.com/docs/rest/spot-trading/market-data/get-trade-histories

Parameters:

symbol (string) – Name of symbol e.g. KCS-BTC

orders = client.get_trade_histories('KCS-BTC')
Returns:

ApiResponse

[
    {
        "sequence": "1545896668571",
        "price": "0.07",                # Filled price
        "size": "0.004",                # Filled amount
        "side": "buy",                  # Filled side. The filled side is set to the taker by default.
        "time": 1545904567062140823     # Transaction time
    },
    {
        "sequence": "1545896668578",
        "price": "0.054",
        "size": "0.066",
        "side": "buy",
        "time": 1545904581619888405
    }
]
Raises:

KucoinResponseException, KucoinAPIException