
OKX Market Data Connector
OKX Data Connector based on WebSocket/REST.
Features
okex_v5Connector KeyConfiguration
Data Connector Parameters
| Parameter | Default Value | Description |
|---|---|---|
| WebSocket URL | wss://ws.okx.com:8443/ws/v5/public | WebSocket root URL. The following endpoints are supported: Standard OKX data feed: wss://ws.okx.com:8443/ws/v5/public OKX AWS data feed: wss://wsaws.okx.com:8443/ws/v5/public By default URL for standard OKX data feed is chosen. |
| REST URL | https://openapi.okx.com/ | REST root URL. The following endpoints are supported: Standard OKX endpoint: https://openapi.okx.com/ OKX AWS endpoint: https://aws.okx.com/ By default URL for standard OKX endpoint is chosen. |
| Read Timeout | 20000 | Read timeout in milliseconds. |
| Reconnect Timeout | 15000 | Reconnect timeout in milliseconds. |
| Exchange Name | OKX | Exchange name for this session. |
| Use Tick-By-Tick Order Book Channel | false | This 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 Key | N/A | API key for authentication in OKX. Required when Use Tick-By-Tick Order Book Channel is enabled. |
| Secret Key | N/A | Secret key for authentication in OKX. Required when Use Tick-By-Tick Order Book Channel is enabled. |
| Passphrase | N/A | Passphrase for authentication in OKX. Required when Use Tick-By-Tick Order Book Channel is enabled. |
| Output Book Size | 20 | Size of the output book. |
| Snapshot Interval | 10S | This 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.
| Field | Type | Description |
|---|---|---|
| Entries | array of L1Entry, L2EntryNew, L2EntryUpdate, BookResetEntry, TradeEntry | The batch of universal entries carried by this update. |
| Received Time | TIMESTAMP | Time when this message was received by the data connector. |
Symbology
Supported symbol notations:
| Symbol Notation | Examples |
|---|---|
| Spot | BTC-USDT |
| Swap | BTC-USD-SWAP |
| Futures | BTC-USD-231103 |
| Option | BTC-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
seqIdmay 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>
