Skip to main content

OKX Market Data Connector

OKX Data Connector based on WebSocket/REST.

Features​

okex_v5Connector Key
Instrument Types
FXFUTUREOPTION
Asset Class
Crypto
Technology
WebSocketREST
Feed Mode
Real-Time
Order Book Update Mode
SnapshotIncremental Updates
Order Book Type
Aggregated
Message Types
✓
Level 1
✓
Level 2
✗
Level 3
✓
Trades
✗
Funding Rates

Configuration​

Data Connector Parameters​

ParameterDefault ValueDescription
WebSocket URLwss://ws.okx.com/ws/v5/publicWebSocket root URL.

Production public feed: wss://ws.okx.com/ws/v5/public
REST URLhttps://openapi.okx.com/REST root URL.

Production endpoint: https://openapi.okx.com/
Read Timeout20000Read timeout in milliseconds.
Reconnect Timeout15000Reconnect timeout in milliseconds.
Exchange NameOKXExchange name for this session.
Use Tick-By-Tick Order Book ChannelfalseThis option allows to use tick-by-tick order book channel instead of a standard one.

When disabled (default), the connector subscribes to the public books channel (no authentication required).

When enabled, the connector performs HMAC login using API Key, Secret Key, and Passphrase, then subscribes to authenticated tick-by-tick channels: books50-l2-tbt (50 levels) or books-l2-tbt (400 levels). Depending on Output Book Size, either books50-l2-tbt (when ≤ 50) or books-l2-tbt (when > 50) is used.

Default value for this option is false.
API KeyN/AAPI key for authentication in OKX. Required when Use Tick-By-Tick Order Book Channel is enabled.
Secret KeyN/ASecret key for authentication in OKX. Required when Use Tick-By-Tick Order Book Channel is enabled.
PassphraseN/APassphrase for authentication in OKX. Required when Use Tick-By-Tick Order Book Channel is enabled.
Output Book Size20Size of the output book.
Snapshot Interval10SThis property sets an interval in seconds between periodical Level2 snapshots which sent to Aggregator.

Snapshots will be generated as soon as this threshold is exceeded AND the next increment message arrives. Conversely, snapshots are NOT generated every period if no data is coming in.

Default value is 10 seconds.

Message Types​

In addition to the standard universal market-data message types, the connector defines custom message types (package deltix.qsrv.hf.plugins.data.okex_v5.types) that carry vendor-specific data.

OKEx Package Header​

Top-level output message that wraps a batch of book and trade entries published by the connector. L1, L2, book-reset, and trade updates for an instrument are delivered inside this envelope when the corresponding entry types are included in the Aggregator output model.

FieldTypeDescription
Entriesarray of L1Entry, L2EntryNew, L2EntryUpdate, BookResetEntry, TradeEntryThe batch of universal entries carried by this update.
Received TimeTIMESTAMPTime when this message was received by the data connector.

Symbology​

Supported symbol notations:

Symbol NotationExamples
SpotBTC-USDT
SwapBTC-USD-SWAP
FuturesBTC-USD-231103
OptionBTC-USD-231103-40000-C

To get full symbol list please refer:

https://openapi.okx.com/api/v5/public/instruments?instType=SPOT

https://openapi.okx.com/api/v5/public/instruments?instType=SWAP

https://openapi.okx.com/api/v5/public/instruments?instType=FUTURES

Notes​

Sequence numbers​

The connector maps the venue seqId field to the Sequence Number on output messages (L2 and trade updates).

Known limitations:

  • Duplicates may occur due to maintenance periods (because the sequence may be reset during maintenance).
  • Duplicates may occur because each instrument has its own independent ID sequence.
  • For trades: the seqId may be the same for different trade updates that occur at the same time.

Logging​

To enable detailed logging, use these lines in the <QSHOME>/config/gflog.xml file:

<logger name="deltix.qsrv.hf.plugins.data.okex_v5" level="DEBUG">
<appender-ref ref="safeAppender"/>
</logger>