Coinbase Institutional CBInternational Exchange JavaScript SDK example: cb-intx-public.ts

Coinbase Institutional CBInternational Exchange cb intx public JavaScript example for the Siebly Coinbase SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.

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

examples/Coinbase/Institutional/CBInternationalExchange/cb-intx-public.ts

What this example covers

  • Coinbase exchange API JavaScript example.
  • Uses the Siebly Coinbase SDK package coinbase-api instead of hand-written HTTP request plumbing.
  • Source path: Coinbase/Institutional/CBInternationalExchange/cb-intx-public.ts.
  • Example category: Institutional CBInternational Exchange.
  • Imports SDK symbols including CBInternationalClient.
  • Calls SDK methods such as getAssets(), getAssetDetails(), getSupportedNetworksPerAsset(), getInstruments(), getInstrumentDetails(), getQuotePerInstrument(), getDailyTradingVolumes(), getAggregatedCandlesData(), getHistoricalFundingRates(), getPositionOffsets().

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 { CBInternationalClient } from 'coinbase-api'; // Initialize the client, you can pass in api keys here if you have them but they are not required for public endpointsconst client = new CBInternationalClient(); async function publicInternationalCalls() {  try {    // List assets    const assets = await client.getAssets();    console.log('Assets: ', assets);     // Get asset details    const assetDetails = await client.getAssetDetails({ asset: 'BTC' });    console.log('Asset Details (BTC): ', assetDetails);     // Get supported networks per asset    const supportedNetworks = await client.getSupportedNetworksPerAsset({      asset: 'BTC',    });    console.log('Supported Networks (BTC): ', supportedNetworks);     // List instruments    const instruments = await client.getInstruments();    console.log('Instruments: ', instruments);     // Get instrument details    const instrumentDetails = await client.getInstrumentDetails({      instrument: 'BTC-PERP',    });    console.log('Instrument Details (BTC-PERP): ', instrumentDetails);     // Get quote per instrument    const quote = await client.getQuotePerInstrument({      instrument: 'BTC-PERP',    });    console.log('Quote (BTC-PERP): ', quote);     // Get daily trading volumes    const dailyVolumes = await client.getDailyTradingVolumes({      instruments: 'BTC-PERP',    });    console.log('Daily Trading Volumes (BTC-PERP): ', dailyVolumes);     // Get aggregated candles data per instrument    const candlesData = await client.getAggregatedCandlesData({      instrument: 'BTC-PERP',      granularity: 'ONE_HOUR',      start: '2023-01-01T00:00:00Z',      end: '2023-01-02T00:00:00Z',    });    console.log('Aggregated Candles Data (BTC-PERP): ', candlesData);     // Get historical funding rates    const fundingRates = await client.getHistoricalFundingRates({      instrument: 'BTC-PERP',    });    console.log('Historical Funding Rates (BTC-PERP): ', fundingRates);     // List position offsets    const positionOffsets = await client.getPositionOffsets();    console.log('Position Offsets: ', positionOffsets);  } catch (e) {    console.error('Error: ', e);  }} publicInternationalCalls(); 

Subscribe on Substack

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