KuCoin REST spot public JavaScript example. Read the source code, review its SDK calls, and browse related exchange integration examples.
This example uses kucoin-api, the JavaScript and TypeScript SDK for KuCoin. Install it with npm install kucoin-api.
We use environment variables in our examples for API keys. It is your responsibility to manage and secure your keys appropriately.
kucoin-api instead of hand-written HTTP request plumbing.Kucoin/Rest/rest-spot-public.ts.SpotClient.getSymbols(), getTicker(), getKlines().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(); We use essential cookies and optional analytics. Read the Privacy Policy.
Essential cookies stay on. Toggle analytics if you want to share anonymous usage insights. You can revisit this anytime via Cookie Settings in the footer.