OKX TypeScript SDK example: rest-public.ts

OKX TypeScript SDK REST example for OKX/Rest/rest-public.ts. Source code reference for exchange REST, WebSocket, and API integration patterns with links to matching Siebly SDK documentation.

Example Path

OKX/Rest/rest-public.ts

Source Link

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

Related SDK Docs

Example Source

import { RestClient } from 'okx-api';

const client = new RestClient();

/**
 * This is a simple script wrapped in a immediately invoked function expression, designed to make public API calls without credentials
 */
(async () => {
  try {
    const results = await client.getInstruments({ instType: 'SPOT' });

    console.log(
      'result: ',
      results.filter((row) => row.baseCcy === 'SUI'),
    );

    return;
  } catch (e) {
    console.error('request failed: ', e);
  }
})();