Skip to content

Public market data ​

Use an unauthenticated SpotClient for public prices and instrument metadata. Spot symbols are lowercase, such as btcusdt.

Read prices and an order book ​

ts
import { SpotClient } from '@siebly/htx-api';

async function main() {
  const client = new SpotClient();
  const ticker = await client.getTicker({ symbol: 'btcusdt' });
  const depth = await client.getMarketDepth({
    symbol: 'btcusdt',
    type: 'step0',
  });
  const candles = await client.getKlines({
    symbol: 'btcusdt',
    period: '1min',
    size: 10,
  });
  console.log('Last price:', ticker.tick.close);
  console.log('Best bid:', depth.tick.bids[0]);
  console.log('Latest candles:', candles.data);
}

main().catch(() => {
  console.error('Public market-data request failed.');
  process.exitCode = 1;
});

Ticker and depth responses carry tick; candles and trading-symbol metadata carry data. Depth levels contain price and quantity. The type parameter selects the exchange's aggregation step; step0 requests unaggregated depth.

Check instrument constraints ​

Read getTradingSymbols() before validating orders. Use the current symbol status, precision and amount/value limits. Keep decimal order amounts and prices as strings, and avoid using floating-point arithmetic for accounting.

Candles and historical data ​

getKlines() accepts symbol, period and an optional size. A candle's id is its interval start in Unix seconds; response timestamps use their documented units. The current candle can change until the interval closes.

Futures market data ​

Use FuturesClient methods for the relevant contract family. Contract identifiers and quantity units differ from Spot. Inspect contract metadata and the selected endpoint's return type before sharing code between products.

Maintain a local order book ​

A REST depth response is a snapshot, not a continuously synchronized book. For incremental feeds, follow the channel's snapshot, sequence and resubscription rules. Do not apply one channel's reconciliation rules to another merely because both contain bids and asks.

Public streams · Spot reference

Built by Siebly. Open source SDKs for exchange APIs.