Get Market Depth
This WebSocket API provides real-time order book depth updates on Nami Exchange.
Get Real Time Spot Depth By WebSocket
Overview This WebSocket API provides real-time order book depth updates on Nami Exchange.
Base URL:
wss://stream-asia2.nami.exchangePath:
/wsTransport: WebSocket
Reconnection: Enabled with exponential backoff
Connection To establish a connection, use the following WebSocket client configuration:
const socket = socketIO("https://stream-asia2.nami.exchange", {
path: "/ws",
upgrade: false,
reconnection: true,
reconnectionDelay: 100,
reconnectionDelayMax: 500,
reconnectionAttempts: Infinity,
transports: ["websocket"],
});Events
1. Connect
Event:
connectDescription: Triggered when the client successfully connects to the WebSocket server.
Example:
2. Subscribe to Market Depth
Event:
subscribe:depthDescription: Subscribes to real-time order book depth updates for a specific trading pair.
Payload:
string(trading pair, e.g.,"BTCUSDT")Example:
3. Receive Market Depth Updates
Event:
spot:depth:updateDescription: Provides real-time order book depth updates for the subscribed trading pair.
Payload: JSON object containing bid and ask order book data.
Example Response:
Response Fields:
symbol
string
Trading pair (e.g., BTCUSDT)
bids
array
List of bid prices and quantities
asks
array
List of ask prices and quantities
Example Handling:
Disconnection & Reconnection
The WebSocket client automatically attempts to reconnect with exponential backoff.
If disconnected, it will retry indefinitely with a delay between 100ms - 500ms.
Notes
Ensure your WebSocket client supports reconnection strategies to maintain a stable connection.
Data is subject to market fluctuations and should be handled accordingly.
Last updated