KuCoin TypeScript SDK example: rest-spot-public.ts

KuCoin REST REST spot public example for the Siebly KuCoin SDK, with TypeScript source for exchange REST API and WebSocket integration, setup, and production SDK docs.

What This Example Covers

  • KuCoin REST API example in TypeScript.
  • Uses the Siebly KuCoin SDK package kucoin-api instead of hand-written HTTP request plumbing.
  • Source path: Kucoin/Rest/rest-spot-public.ts.
  • Example category: REST.
  • Imports SDK symbols including SpotClient.
  • Calls SDK methods such as getSymbols(), getTicker(), getKlines().

How To Use This Example

  • Start here for the specific request or stream pattern, then check the matching SDK guide for install, credentials, and operational notes.
  • Open the repository source when you need the latest committed version: GitHub source file.

Example Path

Kucoin/Rest/rest-spot-public.ts

Source Link

Repository source: https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Kucoin/Rest/rest-spot-public.ts

Related SDK Docs

Example Source

import { SpotClient } from 'kucoin-api';

async function start() {
  const client = new SpotClient();

  try {
    // Fetch all symbols
    const symbols = await client.getSymbols();
    console.log('symbols:', JSON.stringify(symbols, null, 2));

    // Fetch ticker for a specific symbol
    const ticker = await client.getTicker({ symbol: 'BTC-USDT' });
    console.log('ticker:', JSON.stringify(ticker, null, 2));

    // Fetch klines for a specific symbol
    const klines = await client.getKlines({
      symbol: 'BTC-USDT',
      type: '1day',
    });
    console.log(klines);
  } catch (e) {
    console.error('Req error: ', e);
  }
}

start();