Getting Started with Huobi

← Huobi

When to use this API

When you need real-time cryptocurrency market data — current prices, 24-hour trading statistics, recent trades, or order book depth. Huobi's public market API requires no authentication and responds fast, making it ideal for price checks and market monitoring. The API is particularly good at 24-hour rolling statistics (open, high, low, close, volume, trade count) which many exchanges bury behind private endpoints.

Checking 24-hour price statistics for a trading pair

"How has Litecoin (LIT) performed against USDT in the last 24 hours?" The /market/detail endpoint returns a complete 24-hour summary for any trading pair, including OHLC values, volume, and trade count in a single call.

curl "https://api.huobi.pro/market/detail?symbol=litusdt" | head -c 10000
{
  "ch": "market.litusdt.detail",
  "status": "ok",
  "ts": 1775693940735,
  "tick": {
    "id": 378752271352,
    "low": 0.846,
    "high": 0.9443,
    "open": 0.9418,
    "close": 0.8506,
    "vol": 1731204.65936757,
    "amount": 1924002.0257,
    "count": 34096
  }
}

The count field is the number of individual trades in the 24-hour window — a surprisingly useful liquidity indicator that many price APIs omit. Thirty-four thousand trades in a day suggests decent liquidity for a mid-cap token. The vol field is the USDT-denominated volume (quote asset), while amount is the LIT-denominated volume (base asset). Note the timestamps are Unix epoch in milliseconds, not seconds — divide by 1000 if you need standard Unix time.

LIT is trading at $0.8506, down 9.7% from its 24-hour open of $0.9418. The pair saw a high of $0.9443 and a low of $0.846, with approximately $1.73 million USDT in volume across 34,096 trades.

Getting the most recent trade

"What was the last price someone paid for Siacoin?" The /market/trade endpoint returns only the most recent trade — useful for a quick "last price" check without pulling the entire order book or 24-hour history.

curl "https://api.huobi.pro/market/trade?symbol=scusdt" | head -c 10000
{
  "ch": "market.scusdt.trade.detail",
  "status": "ok",
  "ts": 1775688792615,
  "tick": {
    "id": 189389433729,
    "ts": 1775688769567,
    "data": [
      {
        "id": 1893894337291560442346113749,
        "ts": 1775688769567,
        "trade-id": 103623393495,
        "amount": 0.000086,
        "price": 0.000958,
        "direction": "sell"
      }
    ]
  }
}

The nested timestamps are worth watching — the outer ts is when Huobi sent the response, while the inner tick.data[0].ts is when the trade actually executed (about 24 seconds earlier in this case). The direction field tells you whether the trade was a market sell (taker selling) or market buy (taker buying). A recent sell at $0.000958 gives you the current market price with single-trade precision.

The most recent SC/USDT trade was a sell of 0.000086 SC at $0.000958, executed approximately 24 seconds ago.

Checking recent candlestick data

"Show me the hourly price action for Bitcoin." The /market/history/kline endpoint returns OHLCV candlestick data. You can specify the period (1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1week, 1month) with the period parameter.

curl "https://api.huobi.pro/market/history/kline?symbol=btcusdt&period=60min&size=3" | head -c 10000
{
  "ch": "market.btcusdt.kline.60min",
  "status": "ok",
  "ts": 1775693879354,
  "data": [
    {
      "id": 1775692800,
      "open": 71071.84,
      "close": 71036.44,
      "low": 71031.74,
      "high": 71074.5,
      "amount": 0.067857,
      "vol": 4821.051,
      "count": 17
    },
    {
      "id": 1775696400,
      "open": 71028.83,
      "close": 70980.93,
      "low": 70980.93,
      "high": 71028.83,
      "amount": 0.0,
      "vol": 0.0,
      "count": 0
    },
    {
      "id": 1775700000,
      "open": 70951.77,
      "close": 70980.93,
      "low": 70951.77,
      "high": 70991.61,
      "amount": 4.265,
      "vol": 302765.819,
      "count": 21
    }
  ]
}

The id field in each candle is the Unix timestamp in seconds for that period's open — multiply by 1000 to compare with Huobi's millisecond timestamps elsewhere. Notice the middle candle has zero volume (amount: 0, vol: 0, count: 0) — this happens when no trades execute during that period. Huobi includes these empty candles rather than skipping them, which is important for keeping time-series alignment when building charts. The size parameter limits how many candles you get back; omit it and you might get hundreds.

Hourly candles for BTC/USDT show the price consolidating around $71,000 with relatively light volume. One hour had no trades at all (zero volume and zero trades), while the active hours saw 17-21 trades each with modest volume in the $3,000-$300,000 range.

Pitfalls

One-line summary for the user

I can pull real-time cryptocurrency market data — current prices, 24-hour OHLCV stats, recent trades, and candlestick history — from Huobi's public API with no authentication required.