---
title: "Bitget REST Public Futures JavaScript SDK Example | Siebly"
description: "Bitget V2 Classic REST public futures JavaScript example for the Siebly Bitget SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs."
canonical: "https://siebly.io/examples/Bitget/V2%20-%20Classic/Rest/rest-public-futures"
robots: "index,follow"
---

# Bitget REST Public Futures JavaScript SDK Example

Bitget V2 Classic REST public futures JavaScript example for the Siebly Bitget SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.

**Path:** [Home](/) / [Examples](/examples) / [Bitget](/examples/Bitget) / [V2 - Classic](/examples/Bitget/V2%20-%20Classic) / [Rest](/examples/Bitget/V2%20-%20Classic/Rest) / [rest-public-futures.ts](/examples/Bitget/V2%20-%20Classic/Rest/rest-public-futures)

[View source on GitHub](https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Bitget/V2%20-%20Classic/Rest/rest-public-futures.ts)

[Open the Bitget JavaScript SDK guide](/sdk/bitget/javascript)

## rest-public-futures.ts

```typescript
import { RestClientV2 } from 'bitget-api';

const restClient = new RestClientV2();

const symbol = 'BTCUSDT';

(async () => {
  try {
    // Fetch the last 1000 1min candles for a symbol
    const timestampNow = Date.now();
    const msPerCandle = 60 * 1000; // 60 seconds x 1000
    const candlesToFetch = 1000;
    const msFor1kCandles = candlesToFetch * msPerCandle;
    const startTime = timestampNow - msFor1kCandles;

    const response = await restClient.getFuturesCandles({
      symbol,
      productType: 'USDT-FUTURES',
      granularity: '1m',
      startTime: startTime.toString(),
      endTime: timestampNow.toString(),
      limit: candlesToFetch.toString(),
    });

    console.table(response.data);

    console.log('getCandles returned ' + response.data.length + ' candles');
  } catch (e) {
    console.error('request failed: ', e);
  }
})();
```
