Coinbase WebSocket API

Stream Coinbase Advanced Trade market data (ticker, level2, market_trades, candles) and authenticated user channels with HMAC/JWT signing.

Quick answer: TsgcWSAPI_Coinbase is the sgcWebSockets component that connects Delphi and C++ Builder apps to Coinbase Advanced Trade. It streams the public market channels (ticker, level2, market_trades, candles) and the signed user channel using HMAC or JWT auth.

TsgcWSAPI_Coinbase

Coinbase Advanced Trade client — ticker, level2 order book, market_trades, candles, status and the authenticated user channel.

Component class

TsgcWSAPI_Coinbase

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Standard / Professional / Enterprise

Drop the component, set keys, subscribe

Pair with a TsgcWebSocketClient, supply API key/secret for signed channels, then subscribe to ticker, level2, market_trades or user.

uses
  sgcWebSocket, sgcWebSocket_API_Coinbase;

var
  WSClient: TsgcWebSocketClient;
  Coinbase: TsgcWSAPI_Coinbase;
begin
  WSClient := TsgcWebSocketClient.Create(nil);

  Coinbase := TsgcWSAPI_Coinbase.Create(nil);
  Coinbase.Client := WSClient;
  Coinbase.Coinbase.ApiKey    := 'your-api-key';
  Coinbase.Coinbase.ApiSecret := 'your-api-secret';

  WSClient.Active := True;

  Coinbase.SubscribeTicker(['BTC-USD']);
  Coinbase.SubscribeLevel2(['BTC-USD']);
  Coinbase.SubscribeMarketTrades(['BTC-USD']);
  Coinbase.SubscribeUser;
end;
// uses: sgcWebSocket, sgcWebSocket_API_Coinbase
TsgcWebSocketClient *WSClient = new TsgcWebSocketClient(this);
TsgcWSAPI_Coinbase *Coinbase = new TsgcWSAPI_Coinbase(this);
Coinbase->Client = WSClient;

WSClient->Active = true;
Coinbase->SubscribeTicker(OPENARRAY(UnicodeString, ("BTC-USD")));
Coinbase->SubscribeLevel2(OPENARRAY(UnicodeString, ("BTC-USD")));

What's inside

Advanced Trade streams: ticker, ticker_batch, level2, market_trades, candles, status, plus the authenticated user channel.

Public channels

SubscribeTicker, SubscribeTickerBatch, SubscribeLevel2, SubscribeMarketTrades, SubscribeCandles and SubscribeStatus handle every Advanced Trade public stream.

User channel

SubscribeUser opens the authenticated user channel and delivers order, fill and account-level events for the signed-in identity.

HMAC + JWT auth

Coinbase Advanced Trade supports both legacy HMAC signing and newer JWT auth — the component picks the right scheme based on the credentials supplied.

Heartbeats & sequence

level2 and market_trades deliver a sequence_num per envelope; the component watches for gaps and raises OnException if a re-subscribe is required.

Multiple product IDs

Every subscribe call accepts an array of product IDs (BTC-USD, ETH-USD, ...) so a single connection can multiplex hundreds of instruments.

REST fallback

For snapshot data and order placement use the REST counterpart — the WebSocket component focuses on real-time streams.

Specifications & references

Authoritative sources for the APIs this component implements.

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Online Help — API_Coinbase Full property, method and event reference for this component.
Demo Project — Demos\05.Crypto\09.Coinbase Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.

Frequently asked questions

Common questions about the Coinbase API component for Delphi and C++ Builder.

Drop a TsgcWebSocketClient and a TsgcWSAPI_Coinbase component on your form, assign the client to the API component's Client property, set Coinbase.ApiKey and Coinbase.ApiSecret if you need the user channel, then set WSClient.Active := True and call subscribe methods such as SubscribeTicker or SubscribeLevel2.
The TsgcWSAPI_Coinbase component focuses on the Coinbase Advanced Trade WebSocket API: the public channels (ticker, ticker_batch, level2, market_trades, candles, status) and the authenticated user channel. For snapshot data and order placement use the REST counterpart; the WebSocket component handles the real-time streams.
Public market channels stream without credentials. You only need Coinbase credentials for the authenticated user channel, which delivers order, fill and account-level events. Supply an API key and secret and the component picks HMAC or JWT auth automatically based on the credentials you provide.
sgcWebSockets supports Delphi 7 through the latest Delphi 13, plus the matching C++ Builder versions. The Coinbase component runs on Windows, macOS, Linux, iOS and Android.

Ready to Trade on Coinbase?

Download the free trial and stream Coinbase market data and account events from Delphi.