Gate REST Futures JavaScript SDK example: getTickers.ts

Gate REST Futures get tickers JavaScript example. Read the source code, review its SDK calls, and browse related exchange integration examples.

This example uses gateio-api, the JavaScript and TypeScript SDK for Gate. Install it with npm install gateio-api.

We use environment variables in our examples for API keys. It is your responsibility to manage and secure your keys appropriately.

examples/Gate/Rest/futures/getTickers.ts

What this example covers

  • Gate REST API JavaScript example.
  • Uses the Siebly Gate SDK package gateio-api instead of hand-written HTTP request plumbing.
  • Source path: Gate/Rest/futures/getTickers.ts.
  • Example category: REST Futures.
  • Imports SDK symbols including RestClient.

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.
import { RestClient } from 'gateio-api'; // Define the account object with API key and secretconst account = {  key: process.env.API_KEY || 'yourApiHere', // Replace 'yourApiHere' with your actual API key  secret: process.env.API_SECRET || 'yourSecretHere', // Replace 'yourSecretHere' with your actual API secret}; // Initialize the RestClient with the API credentialsconst gateRestClient = new RestClient({  apiKey: account.key,  apiSecret: account.secret,}); async function getFuturesTicker() {  try {    console.log('Using API keys:', account);     // Fetch all futures tickers with USDT settlement    const allTickers = await gateRestClient.getFuturesTickers({      settle: 'usdt', // Specify the settlement currency    });    console.log('allTickers: ', allTickers); // Log the response to the console     // Fetch a specific futures ticker with USDT settlement    const ticker = await gateRestClient.getFuturesTickers({      settle: 'usdt', // Specify the settlement currency      contract: 'BTC_USDT', // Specify the contract    });    console.log('ticker: ', ticker); // Log the response to the console  } catch (e) {    console.error('Error in execution: ', e); // Log any errors that occur  }} // Execute the function to get futures tickersgetFuturesTicker(); 

Subscribe on Substack

Complete the Substack form below to join our newsletter. Substack handles all subscriber data directly.