Kraken WebSocket API

Subscribe to Kraken v2 public channels (ticker, book, trade, ohlc, spread) and authenticated private channels (openOrders, ownTrades) from a typed Delphi component.

Quick answer: TsgcWSAPI_Kraken is the sgcWebSockets component that connects Delphi and C++ Builder apps to Kraken. It subscribes to the Kraken WebSocket v2 public channels and the signed openOrders / ownTrades private channels, and exposes the v2 order-management verbs.

TsgcWSAPI_Kraken

Kraken WebSocket v2 client — ticker, book, trade, ohlc and spread channels plus signed openOrders / ownTrades private streams.

Component class

TsgcWSAPI_Kraken

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Standard / Professional / Enterprise

Drop the component, set keys, subscribe

Pair with a TsgcWebSocketClient, fetch a WebSocket token if you need private channels, then subscribe to public or authenticated streams.

uses
  sgcWebSocket, sgcWebSocket_API_Kraken;

var
  WSClient: TsgcWebSocketClient;
  Kraken: TsgcWSAPI_Kraken;
begin
  WSClient := TsgcWebSocketClient.Create(nil);

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

  WSClient.Active := True;

  Kraken.SubscribeTicker(['XBT/USD']);
  Kraken.SubscribeBook(['XBT/USD'], 25);
  Kraken.SubscribeTrade(['XBT/USD']);
end;
// uses: sgcWebSocket, sgcWebSocket_API_Kraken
TsgcWebSocketClient *WSClient = new TsgcWebSocketClient(this);
TsgcWSAPI_Kraken *Kraken = new TsgcWSAPI_Kraken(this);
Kraken->Client = WSClient;

WSClient->Active = true;
Kraken->SubscribeTicker(OPENARRAY(UnicodeString, ("XBT/USD")));
Kraken->SubscribeBook(OPENARRAY(UnicodeString, ("XBT/USD")), 25);

What's inside

Per-symbol ticker, book deltas, ohlc, spread and trade streams, plus the signed openOrders / ownTrades channels.

v2 public channels

SubscribeTicker, SubscribeBook, SubscribeTrade, SubscribeOHLC, SubscribeSpread and SubscribeInstrument cover every Kraken WebSocket v2 public channel.

Private channels

SubscribeOpenOrders, SubscribeOwnTrades, SubscribeBalances open authenticated streams — the component obtains the WebSocket token via the signed REST call automatically.

Multi-pair arrays

Every subscribe call accepts an array of symbols so one connection multiplexes any number of pairs.

Order management

The v2 RPC verbs (add_order, cancel_order, cancel_all, edit_order, batch_add, batch_cancel) are exposed as typed methods.

Snapshot then deltas

Book subscriptions deliver an initial snapshot followed by incremental updates — ideal for maintaining a synchronised local order book.

Sequence numbers

Kraken v2 messages carry a sequence_num inside the relevant channels — the component watches for gaps and signals via OnException if resubscription is needed.

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_Kraken Full property, method and event reference for this component.
Demo Project — Demos\05.Crypto\08.Kraken 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 Kraken API component for Delphi and C++ Builder.

Drop a TsgcWebSocketClient and a TsgcWSAPI_Kraken component on your form, assign the client to the API component's Client property, set Kraken.ApiKey and Kraken.ApiSecret if you need private channels, then set WSClient.Active := True and call subscribe methods like SubscribeTicker or SubscribeBook.
The TsgcWSAPI_Kraken component targets the Kraken WebSocket v2 API: the public channels (ticker, book, trade, ohlc, spread, instrument), the signed openOrders / ownTrades / balances streams, and the v2 order-management verbs (add_order, cancel_order, cancel_all, edit_order, batch_add, batch_cancel) as typed methods. For private channels it obtains the WebSocket token via the signed REST call automatically.
Public channels such as ticker, book, trade, ohlc and spread work without credentials. You only need a Kraken API key and secret for the private channels (openOrders, ownTrades, balances) and order management. Set Kraken.ApiKey and Kraken.ApiSecret and the component fetches the required WebSocket token for you.
sgcWebSockets supports Delphi 7 through the latest Delphi 13, plus the matching C++ Builder versions. The Kraken component runs on Windows, macOS, Linux, iOS and Android.

Ready to Trade on Kraken?

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