Bitfinex WebSocket API

Subscribe to Bitfinex v2 public channels (ticker, trades, books, candles) and authenticate to receive private order, position and wallet updates.

TsgcWSAPI_Bitfinex

Typed Delphi/C++Builder client for the Bitfinex WebSocket v2 API — public channels (ticker, trades, book, candles, status) and authenticated order/position/wallet streams.

Component class

TsgcWSAPI_Bitfinex

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Standard / Professional / Enterprise

Drop the component, set keys, subscribe

Pair the component with a TsgcWebSocketClient, then call SubscribeTicker, SubscribeTrades or Authenticate to start receiving private updates.

uses
  sgcWebSocket, sgcWebSocket_API_Bitfinex;

var
  WSClient: TsgcWebSocketClient;
  Bitfinex: TsgcWSAPI_Bitfinex;
begin
  WSClient := TsgcWebSocketClient.Create(nil);

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

  WSClient.Active := True;

  // public channels
  Bitfinex.SubscribeTicker('tBTCUSD');
  Bitfinex.SubscribeTrades('tBTCUSD');
  Bitfinex.SubscribeBook('tBTCUSD');

  // authenticated channels
  Bitfinex.Authenticate;
end;
// uses: sgcWebSocket, sgcWebSocket_API_Bitfinex
TsgcWebSocketClient *WSClient = new TsgcWebSocketClient(this);

TsgcWSAPI_Bitfinex *Bitfinex = new TsgcWSAPI_Bitfinex(this);
Bitfinex->Client = WSClient;

WSClient->Active = true;

Bitfinex->SubscribeTicker("tBTCUSD");
Bitfinex->SubscribeTrades("tBTCUSD");
Bitfinex->SubscribeBook("tBTCUSD");

What's inside

Multi-channel router, typed handlers per public channel and authenticated streams.

Public channels

SubscribeTicker, SubscribeTrades, SubscribeBook, SubscribeRawBook, SubscribeCandles and SubscribeStatus register every public Bitfinex v2 channel.

Authenticated stream

Authenticate signs the auth payload with HMAC-SHA384 against Bitfinex.ApiSecret and opens the private channel for orders, positions, wallets, balance updates and trade executions.

Multi-channel router

Each subscribe call returns a chanId. The component tracks which symbol/timeframe maps to which chanId and delivers each channel through its own typed event.

Trading actions

NewOrder, CancelOrder, UpdateOrder, CancelMultipleOrders and the order-multi-op envelope are typed methods that send the corresponding auth-channel input messages.

Configuration flags

Conf sends the Bitfinex configuration bitmask to enable sequencing, checksums, raw order IDs and the rest of the v2 wire-format options.

Resilience

Bind to the underlying TsgcWebSocketClient for WatchDog / HeartBeat / TLS — resubscribe-on-reconnect is wired through OnConnect.

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_Bitfinex Full property, method and event reference for this component.
Demo Project — Demos\05.Crypto\21.Bitfinex 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.

Ready to Trade on Bitfinex?

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