---
title: "Binance REST Spot Public JavaScript SDK Example | Siebly"
description: "Binance REST spot public JavaScript example for the Siebly Binance SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs."
canonical: "https://siebly.io/examples/Binance/Rest/Spot/rest-spot-public"
robots: "index,follow"
---

# Binance REST Spot Public JavaScript SDK Example

Binance REST spot public JavaScript example for the Siebly Binance SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.

**Path:** [Home](/) / [Examples](/examples) / [Binance](/examples/Binance) / [Rest](/examples/Binance/Rest) / [Spot](/examples/Binance/Rest/Spot) / [rest-spot-public.ts](/examples/Binance/Rest/Spot/rest-spot-public)

[View source on GitHub](https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Binance/Rest/Spot/rest-spot-public.ts)

[Open the Binance JavaScript SDK guide](/sdk/binance/javascript)

## rest-spot-public.ts

```typescript
import { MainClient } from 'binance';

const client = new MainClient({
  // Optional (default: false) - when true, response strings are parsed to floats (only for known keys).
  // beautifyResponses: true,
});

(async () => {
  try {
    // console.log(
    //   'getAvgPrice: ',
    //   await client.getAvgPrice({ symbol: 'BTCUSDT' }),
    // );
    // console.log(
    //   'getExchangeInfo: ',
    //   JSON.stringify(await client.getExchangeInfo(), null, 2),
    // );

    const oneTicker = await client.get24hrChangeStatistics({
      symbol: 'BTCUSDT',
    });
    console.log('getTickers', oneTicker);

    const manyTickers = await client.get24hrChangeStatistics({
      symbols: ['BTCUSDT', 'ETHUSDT'],
    });
    console.log('getTickers many', manyTickers);
    const allTickers = await client.get24hrChangeStatistics();
    console.log('getTickers all', allTickers);
  } catch (e) {
    console.error('request failed: ', e);
  }
})();
```
