Coinbase Institutional CBExchange REST cb exchange private 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.
coinbase-api instead of hand-written HTTP request plumbing.Coinbase/Institutional/CBExchange/Rest/cb-exchange-private.ts.CBExchangeClient.getOrders(), getOrder(), cancelOrder().import { CBExchangeClient } 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 CBExchangeClient({ apiKey: 'yourAPIKeyHere', apiSecret: 'yourAPISecretHere', //This is the passphrase you provided when creating this API key. NOT your account password. apiPassphrase: 'yourAPIPassPhraseHere', // Optional, connect to sandbox instead: https://public-sandbox.exchange.coinbase.com/apikeys // useSandbox: true,}); async function privateExchangeCalls() { try { const orders = await client.getOrders(); console.log('Orders: ', orders); const order = await client.getOrder({ order_id: '0c892cb3-2824-4662-8be3-99c8e879f606', market_type: 'market', }); console.log('Order: ', order); const cancelOrderResult = await client.cancelOrder({ order_id: '0c892cb3-2824-4662-8be3-99c8e879f606', product_id: 'BTC-GBP', }); console.log('cancelOrder result: ', cancelOrderResult); } catch (e) { console.error('Error: ', e); }} privateExchangeCalls(); We use essential cookies and optional analytics. Read the Privacy Policy.
Essential cookies stay on. Toggle analytics if you want to share anonymous usage insights. You can revisit this anytime via Cookie Settings in the footer.