Websockets
WebSockets
The platform provides two WebSocket endpoints for real-time data:
Base URL: wss://v2.api.dexodus.finance
WS /ws-prices
Real-time price and market status updates.
Subscription Message
{
"action": "subscribe",
"markets": ["BTC", "ETH", "SOL"]
}
Parameters:
action
:"subscribe"
or"unsubscribe"
markets
: Array of markets you want to subscribe to. If empty, subscribes to all available markets.
Initial Snapshot Message
Server automatically sends initial data snapshot with current data for all markets.
{
"type": "initial_data_snapshot",
"data": {
"BTC": {
"perpetualPrice": 45000.50,
"indexPrice": 45010.25,
"currentDate": "2024-01-15T10:30:00.000Z",
"price24hAgo": 44500.00,
"date24hAgo": "2024-01-14T10:30:00.000Z",
"marketStatus": "Open"
},
"ETH": {
"perpetualPrice": 2500.75,
"indexPrice": 2502.50,
"currentDate": "2024-01-15T10:30:00.000Z",
"price24hAgo": 2450.00,
"date24hAgo": "2024-01-14T10:30:00.000Z",
"marketStatus": "Open"
}
// ... all other markets
}
}
Real-time Update Message
Server sends price status update messages for real-time updates automatically when prices change.
{
"type": "price_status_update",
"symbol": "BTC",
"perpetualPrice": 45025.75,
"indexPrice": 45030.00,
"marketStatus": "Open",
"timestamp": "2024-01-15T10:31:00.000Z"
}
WS /ws
Real-time candlestick data.
Subscription Message
{
"action": "subscribe",
"symbol": "BTC",
"resolution": "1"
}
Parameters:
action
:"subscribe"
or"unsubscribe"
symbol
: Symbol nameresolution
: Value is in minutes:"1"
- 1 minute candle"5"
- 5 minutes candle"240"
- 4 hours candle"1D"
- 1 day candle (exception)
Response Message
{
"symbol": "BTC",
"resolution": "1m",
"candle": {
"time": 1234567890000,
"open": 50000.0,
"high": 50100.0,
"low": 49900.0,
"close": 50050.0
}
}
Candle Update Behavior:
All updates have the same
time
(e.g.,1759939376000
) for the same candle periodThe
close
price is constantly updating (represents the current price)The
high
andlow
update as new highs/lows are hitThe
open
stays the same (price when the candle period started)
Last updated