Websocket API

This document describes two WebSocket interfaces:

  • Public WebSocket: market data only. No authentication is required. Clients subscribe to the channels they need after the connection is established.

  • Private WebSocket: account and trading data. Authentication is required. Data is pushed automatically after authentication succeeds.

Domain

wss://quote.edgex.exchange

Endpoints

Path
Description

/api/v1/public/ws

Public market data WebSocket endpoint.

/api/v1/private/ws

Private account and trading WebSocket endpoint.

Common Behavior

Heartbeat

After a connection is established, the server periodically sends a ping frame in JSON form:

{
  "type": "ping",
  "time": "1693208170000"
}

The client should reply with:

The client may also proactively send ping messages for latency measurement. The server replies with a matching pong.

Error Message

For invalid requests, the server returns an error message. For example:

Public WebSocket

Overview

The public WebSocket provides real-time market data. It does not require authentication.

You can use the public WebSocket to receive:

  • Exchange metadata

  • 24-hour ticker updates

  • Kline / candlestick updates

  • Order book depth updates

  • Latest trade updates

  • Funding rate updates

  • Best bid / best ask updates

Endpoint

  • Domain: wss://quote.edgex.exchange

  • Path: /api/v1/public/ws

  • Full URL: wss://quote.edgex.exchange/api/v1/public/ws

Authentication

No authentication is required for public interfaces.

How It Works

  1. Connect to the public endpoint.

  2. Send subscribe messages for the channels you need.

  3. Receive subscribed acknowledgements.

  4. Receive subsequent quote-event pushes.

  5. Reply to ping messages with pong to keep the connection alive.

Subscribe and Unsubscribe

Public channels require explicit subscription.

Subscribe request:

Unsubscribe request:

Subscribe acknowledgement:

Public Message Envelope

All public market data pushes use quote-event.

Real public push example:

content.dataType identifies whether the payload is an initial snapshot or a later update. In current production traffic, values may appear with different casing such as Snapshot, Changed, or changed. Clients should handle this field case-insensitively.

Metadata

Channel

Channel
Description

metadata

Global metadata, including coin and contract information.

Subscribe Request

Snapshot Example

Ticker

Channels

Channel
Description

ticker.{contractId}

24-hour ticker for one contract.

ticker.all

24-hour ticker snapshot for all contracts.

ticker.all.1s

Periodic ticker updates for all contracts.

Subscribe Request

Update Example

Kline

Channel Format

kline.{priceType}.{contractId}.{interval}

priceType

Value
Description

LAST_PRICE

Last traded price kline.

INDEX_PRICE

Index price kline.

ORACLE_PRICE

Oracle price kline.

MARK_PRICE

Mark price kline.

interval

Value
Description

MINUTE_1

1-minute kline

MINUTE_5

5-minute kline

MINUTE_15

15-minute kline

MINUTE_30

30-minute kline

HOUR_1

1-hour kline

HOUR_2

2-hour kline

HOUR_4

4-hour kline

HOUR_6

6-hour kline

HOUR_8

8-hour kline

HOUR_12

12-hour kline

DAY_1

1-day kline

WEEK_1

1-week kline

MONTH_1

1-month kline

Subscribe Request

Update Example

Depth

Channel Format

depth.{contractId}.{level}

Supported Levels

Value
Description

15

15 levels

200

200 levels

Subscribe Request

Behavior

After a successful subscription, the server first pushes a full snapshot and then pushes incremental updates.

  • depthType = Snapshot means a full order book snapshot for the subscribed level.

  • depthType = CHANGED means an incremental update.

Snapshot Example

Incremental Example

Latest Trades

Channel Format

trades.{contractId}

Subscribe Request

Payload Structure

Funding Rate

Channels

Channel
Description

fundingRate.{contractId}

Funding rate for one contract.

fundingRate.all

Funding rates for all contracts.

Subscribe Request

Payload Structure

Book Ticker

Channels

Channel
Description

bookTicker.{contractId}

Best bid and best ask for one contract.

bookTicker.all

Best bid and best ask for all contracts.

bookTicker.all.1s

Periodic best bid and ask updates for all contracts.

Subscribe Request

Payload Structure

Client Handling Notes

  • After subscribing, treat the first pushed payload as the initial state for that channel.

  • For metadata, ticker, kline, fundingRate, and bookTicker, later pushes replace the affected records in the local cache.

  • For depth, apply updates by price level and use startVersion / endVersion to maintain ordering.

  • Handle dataType values case-insensitively.

  • If a channel is invalid, fix the request and resubscribe instead of retrying blindly.

Private WebSocket

Overview

The private WebSocket provides authenticated account and trading updates.

Clients can use the private WebSocket to receive:

  • Initial account snapshot after connection

  • Account updates

  • Deposit and withdrawal updates

  • Transfer updates

  • Order updates

  • Funding settlement updates

  • Liquidation-related updates

Endpoint

  • Domain: wss://quote.edgex.exchange

  • Path: /api/v1/private/ws

  • Full URL: wss://quote.edgex.exchange/api/v1/private/ws?accountId={accountId}

Authentication

The following headers must be included in the request to authenticate access to private APIs:

| Name | Location | Required | Description | | --- | --- | --- | --- | --- | | X-edgeX-Api-Timestamp | header | must | The timestamp when the request was made. | | X-edgeX-Api-Signature | header | must | The signature generated using the private key and request details. | | accountId | query | must | The account ID included in the WebSocket handshake URL. |

Notes:

  • The WebSocket handshake is an HTTP GET request.

  • There is no request body to sign.

  • The signing rule should follow the same rule described in authentication.md for private HTTP APIs.

  • When generating the signature payload, include the request path and query string used in the actual WebSocket handshake.

Example URL:

How It Works

  1. Connect to the private endpoint with valid signed request information.

  2. Receive a connected message.

  3. Receive an initial trade-event snapshot.

  4. Receive later trade-event updates when account or order data changes.

  5. Reply to ping messages with pong to keep the connection alive.

Connected Message

Private Event Envelope

All private business data is wrapped in a trade-event message.

Event Types

The content.event field identifies the reason for the push.

Event
Description

Snapshot

Initial full snapshot pushed immediately after a successful connection.

ACCOUNT_UPDATE

Account information changed.

DEPOSIT_UPDATE

Deposit information changed.

WITHDRAW_UPDATE

Withdrawal information changed.

TRANSFER_IN_UPDATE

Transfer-in information changed.

TRANSFER_OUT_UPDATE

Transfer-out information changed.

ORDER_UPDATE

Order information changed.

FORCE_WITHDRAW_UPDATE

Forced withdrawal information changed.

FORCE_TRADE_UPDATE

Forced trade information changed.

FUNDING_SETTLEMENT

Funding settlement information changed.

ORDER_FILL_FEE_INCOME

Fill fee income information changed.

START_LIQUIDATING

Liquidation started.

FINISH_LIQUIDATING

Liquidation finished.

UNRECOGNIZED

Unknown event type.

Snapshot Example

Order Update Example

Funding Settlement Example

Client Handling Notes

  • Treat the first Snapshot as the initial full state.

  • Treat subsequent events as incremental updates keyed by event and entity ID.

  • Empty arrays mean that the event did not update that section.

  • Always respond to server ping messages to keep the connection alive.

Last updated