REST API
Orderbook
Retrieve a real-time orderbook snapshot with bid and ask price levels for a trading pair.
Returns a real-time orderbook snapshot for a trading pair. The snapshot includes bid and ask price levels with their corresponding sizes.
Authentication
API key via X-API-Key header.
Endpoint
GET /api/v1/orderbookParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
exchange | string | Yes | Exchange ID (e.g., binancef, bybitf) |
symbol | string | Yes | Trading pair with slash separator (e.g., btc/usd) |
levels | string | No | Number of price levels: 100, 1000, 5000, or full (default: full) |
Note: This endpoint does not support aggregated exchanges. Use a single exchange ID.
Rate Limits
| Metric | Value |
|---|---|
| Cost | 1 weight |
This endpoint has a fixed cost of 1 weight per request regardless of the number of levels.
Response
Response Type: Orderbook
{"t": 1704067200, "exchange": "binancef", "symbol": "btc/usd", "a": [[42100.10, 1.5], [42100.20, 2.3]], "b": [[42099.90, 2.1], [42099.80, 1.8]], "lp": 42100.00, "snapshot": true, "seq": 123456, "levels": 1000}| Field | Type | Description |
|---|---|---|
t | int64 | Unix timestamp (seconds) |
exchange, symbol | string | Exchange ID and trading pair |
a | [][2]float64 | Asks as [price, size] pairs (ascending) |
b | [][2]float64 | Bids as [price, size] pairs (descending) |
lp | float64 | Last traded price |
snapshot | bool | Full snapshot flag |
seq | int64 | Sequence number |
levels | int64 | Number of levels returned |
See Types for full details.
Level Options
| Value | Description |
|---|---|
100 | Top 100 price levels on each side |
1000 | Top 1,000 price levels on each side |
5000 | Top 5,000 price levels on each side |
full | All available price levels (default) |
Tip: Use smaller level counts for faster responses when you only need top-of-book data. The
fulloption returns the complete orderbook which may be large for liquid markets.
Errors
| Code | HTTP | Description |
|---|---|---|
INVALID_API_KEY | 401 | Missing or invalid API key |
INVALID_PARAMS | 400 | Missing or invalid parameters |
INVALID_EXCHANGE | 400 | Unknown exchange ID |
INVALID_SYMBOL | 400 | Unknown trading symbol |
RATE_LIMITED | 429 | Rate limit exceeded |
TIMEOUT | 504 | Request exceeded timeout (10s for NATS fetch; error message says "30s") |
INTERNAL_ERROR | 500 | Internal server error |
Example Error Response
{
"error": {
"code": "INVALID_PARAMS",
"message": "levels must be one of: 100, 1000, 5000, full"
}
}Examples
Basic Request
curl "https://eu-central-1.mmt.gg/api/v1/orderbook?exchange=binancef&symbol=btc/usd" \
-H "X-API-Key: your-api-key"With Level Limit
curl "https://eu-central-1.mmt.gg/api/v1/orderbook?exchange=binancef&symbol=btc/usd&levels=100" \
-H "X-API-Key: your-api-key"Python Example
import requests
response = requests.get(
"https://eu-central-1.mmt.gg/api/v1/orderbook",
params={
"exchange": "binancef",
"symbol": "btc/usd",
"levels": "1000"
},
headers={"X-API-Key": "your-api-key"}
)
data = response.json()
best_bid = data["b"][0][0] # first bid price
best_ask = data["a"][0][0] # first ask price
spread = best_ask - best_bid
print(f"Best bid: {best_bid}, Best ask: {best_ask}, Spread: {spread}")