Overview
Retrieve the current order book for a trading pair, including bids and asks with price levels and quantities. This endpoint provides real-time market depth data essential for analyzing liquidity and market microstructure.
Endpoint
GET /api/v1/market/orderbook/:exchange/:symbol
Path Parameters
The exchange identifier (e.g., binance, coinbase, kraken)
The trading pair symbol in exchange format (e.g., BTC/USDT, ETH/USD)
Query Parameters
Number of price levels to return for both bids and asks. Valid range: 1-100. Default is 20.
Response Schema
The exchange name from the request
The trading pair symbol from the request
Array of bid price levels, where each entry is [price, amount] Total quantity available at this price level
Array of ask price levels, where each entry is [price, amount] Total quantity available at this price level
The timestamp when this order book snapshot was captured
Indicates whether the data was served from Redis cache
Code Examples
curl -X GET "https://api.neuratrade.io/api/v1/market/orderbook/binance/BTC/USDT?limit=10" \
-H "Content-Type: application/json"
Response Example
{
"exchange" : "binance" ,
"symbol" : "BTC/USDT" ,
"bids" : [
[ 49999.50 , 1.2345 ],
[ 49999.00 , 0.5678 ],
[ 49998.50 , 2.1234 ]
],
"asks" : [
[ 50000.50 , 0.9876 ],
[ 50001.00 , 1.5432 ],
[ 50001.50 , 0.7654 ]
],
"timestamp" : "2026-03-03T10:30:45Z" ,
"cached" : false
}
Caching Behavior
Cache TTL : 5 seconds (shorter than tickers due to rapid order book changes)
Cache Key Format : orderbook:{exchange}:{symbol}:{limit}
Cache Analytics : Cache hits/misses are tracked in the order_books category
Order Book Metrics
For advanced order book analysis including imbalance, liquidity scores, and depth metrics, use the metrics endpoint:
GET /api/v1/market/orderbook/:exchange/:symbol/metrics
This endpoint calculates:
Bid-ask spread and mid-price
Order book imbalance at 1% and 2% depth
Liquidity scores
Best bid/ask prices
Error Responses
400 Bad Request
503 Service Unavailable
500 Internal Server Error
{
"error" : "Exchange and symbol are required"
}
Implementation Details
Data Source : Live CCXT service only (no database fallback)
Service Health Check : Returns 503 if CCXT service is unhealthy
Limit Validation : Values outside 1-100 range default to 20
Source Code : services/backend-api/internal/api/handlers/market.go:518
Use Cases
Market Making : Monitor bid/ask spreads for trading opportunities
Liquidity Analysis : Assess market depth before placing large orders
Arbitrage Detection : Compare order books across exchanges
Price Discovery : Identify support and resistance levels from order clustering