MEXC WebSocket API

Subscribe to MEXC spot WebSocket streams (deals, kline, depth, bookTicker, miniTicker) and authenticated account channels with HMAC signing.

Quick answer: TsgcWSAPI_MEXC is the sgcWebSockets component that connects Delphi and C++ Builder apps to MEXC. It decodes MEXC's Protobuf spot streams (deals, kline, depth, bookTicker, miniTicker) and opens the listenKey-based private account-data stream.

TsgcWSAPI_MEXC

MEXC spot WebSocket client — deals, kline, depth, bookTicker and miniTicker plus the listenKey-based private account stream.

Component class

TsgcWSAPI_MEXC

Protocol

MEXC Spot v3 API

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Standard / Professional / Enterprise

Drop the component, set keys, subscribe

Pair with a TsgcWebSocketClient and call SubscribeDeals / SubscribeKLine / SubscribeDepth — the component handles MEXC's Protobuf framing.

uses
  sgcWebSocket, sgcWebSocket_API_MEXC;

var
  WSClient: TsgcWebSocketClient;
  MEXC: TsgcWSAPI_MEXC;
begin
  WSClient := TsgcWebSocketClient.Create(nil);

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

  WSClient.Active := True;

  MEXC.SubscribeDeals('BTCUSDT');
  MEXC.SubscribeDepth('BTCUSDT');
  MEXC.SubscribeKLine('BTCUSDT', mki5m);
end;
// uses: sgcWebSocket, sgcWebSocket_API_MEXC
TsgcWebSocketClient *WSClient = new TsgcWebSocketClient(this);
TsgcWSAPI_MEXC *MEXC = new TsgcWSAPI_MEXC(this);
MEXC->Client = WSClient;

WSClient->Active = true;
MEXC->SubscribeDeals("BTCUSDT");
MEXC->SubscribeDepth("BTCUSDT");

What's inside

Protobuf payload decoding, spot market streams, account-data stream with automatic listenKey refresh.

Protobuf payloads

MEXC v3 ships market data as Protobuf-encoded binary frames; the component decodes them and surfaces typed events.

Spot streams

SubscribeDeals, SubscribeDepth, SubscribeKLine, SubscribeBookTicker, SubscribeMiniTicker cover the spot public surface.

Account-data stream

StartUserDataStream returns a listenKey; SubscribeListenKey opens the account-data WebSocket for balance / order / position updates.

Heartbeat

MEXC sends ping frames; the component answers automatically. WatchDog re-subscribes after reconnect.

Single-component routing

One TsgcWSAPI_MEXC instance can handle hundreds of symbols by chaining subscribe calls — routing is internal.

Futures sibling

TsgcWSAPI_MEXC_Futures targets the MEXC futures contract gateway with the same component surface.

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

Drop a TsgcWebSocketClient and a TsgcWSAPI_MEXC component on your form, assign the client to the API component's Client property, set MEXC.ApiKey and MEXC.ApiSecret if you need the account stream, then set WSClient.Active := True and call subscribe methods such as SubscribeDeals, SubscribeDepth or SubscribeKLine.
The TsgcWSAPI_MEXC component targets the MEXC spot WebSocket API. It decodes the Protobuf-encoded market streams (deals, kline, depth, bookTicker, miniTicker) and opens the listenKey-based account-data stream for balance, order and position updates. A TsgcWSAPI_MEXC_Futures sibling targets the MEXC futures contract gateway.
Public spot streams such as deals, depth, kline and bookTicker work without credentials. You only need a MEXC API key and secret for the private account-data stream: set MEXC.ApiKey and MEXC.ApiSecret, call StartUserDataStream to obtain a listenKey, then SubscribeListenKey opens the authenticated channel.
sgcWebSockets supports Delphi 7 through the latest Delphi 13, plus the matching C++ Builder versions. The MEXC component runs on Windows, macOS, Linux, iOS and Android.

Ready to Trade on MEXC?

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