OKX
BetaCrypto — Major Exchanges
connectorType: "okx"OKX is a global cryptocurrency exchange offering spot, margin, futures, perpetual swaps, and options trading. Known for its advanced trading tools and deep liquidity.
Connection Architecture
OKX
WebSocket / REST→
Connector
libs/exchange-okx→
Provider
:8081/api→
Detector
Advisor
Studio
The connector receives data from the exchange and feeds it to Provider (port 8081). From there — to Detector, Advisor, and Studio.
Technologies
Transport
WebSocketREST
Authentication
API Key + Secret + PassphraseData Format
JSONFeatures
Rate LimiterPassphrase Required
Best for
- OKX is the go-to connector for options and multi-leg derivatives strategies — its options order book is among the deepest in the industry.
- It suits professional traders running volatility surface arbitrage, calendar spreads, or gamma-scalping strategies.
- The exchange is also competitive for USDT perpetual strategies across a broad altcoin universe.
- Barfinex users who need options data for implied-volatility signals or delta-hedging workflows should prioritise OKX.
Connect via code
1Environment variables (.env)
OKX_API_KEY=your_key_here OKX_API_SECRET=your_secret_here OKX_API_PASSPHRASE=your_passphrase_here
2Connector configuration
// config/config.provider.json
{
"provider": {
"connectors": [
{
"connectorType": "okx",
"enabled": true,
"key": "${OKX_API_KEY}",
"secret": "${OKX_API_SECRET}",
"passphrase": "${OKX_API_PASSPHRASE}",
"markets": [
{ "marketType": "spot", "symbols": [{ "name": "BTCUSDT" }] }
],
"subscriptions": [
{ "type": "PROVIDER_MARKETDATA_CANDLE", "symbols": ["BTCUSDT"], "intervals": ["min1", "h1"], "active": true },
{ "type": "PROVIDER_MARKETDATA_TRADE", "symbols": ["BTCUSDT"], "active": true },
{ "type": "PROVIDER_MARKETDATA_ORDERBOOK", "symbols": ["BTCUSDT"], "active": true }
]
}
]
}
}3Verify and query data
# Verify connection curl -H "Authorization: Bearer $PROVIDER_API_TOKEN" \ https://localhost:8081/api/exchanges/runtime-proof # Candles (last 7 days) curl -H "Authorization: Bearer $PROVIDER_API_TOKEN" \ "https://localhost:8081/api/candles/okx/spot/BTCUSDT/h1?days=7"
Available via Barfinex API
/api/candles/okx/...
/api/trades/okx/...
/api/orderbook/okx/...
/api/account/okx/...
/api/symbols/okx/...
/api/assets/okx/...
Studio graphical setup — in development, coming in the next release.
Important
Permissions required: Read + Trade.
OKX requires three credentials: API Key, Secret Key, and a Passphrase you set during key creation — all three must be present in Barfinex config.
Rate limit: up to 500 requests/min (varies by endpoint).
OKX enforces IP whitelisting on API keys — the connector IP must be added during key creation or the key will be rejected.
Sandbox (demo) trading is available with a separate set of credentials; sandbox and live endpoints are different URLs.