Market Data
Get Order Book Stats
Rolling volume and trade counts over four windows
GET
/
orderbooks
/
stocks
/
api
/
order-books
/
{orderBookId}
/
stats
curl "https://api.trusset.org/orderbooks/stocks/api/order-books/clx_ob_stock_002/stats" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/stocks/api/order-books/${orderBookId}/stats`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
console.log('24h volume', data['24h'].volume, 'in', data['24h'].trades, 'trades');
{
"success": true,
"data": {
"1h": { "volume": "3000000", "trades": 2 },
"24h": { "volume": "31000000", "trades": 12 },
"7d": { "volume": "184000000", "trades": 63 },
"30d": { "volume": "702000000", "trades": 241 }
}
}
Returns base volume and trade count for one book over four rolling windows ending now: one hour, 24 hours, 7 days and 30 days. Each window is computed from the same 30-day trade set, so the figures are internally consistent.
When the book pools depth with peers, the windows cover the whole eligible set, matching what Get Order Book Snapshot reports.
Trades whose settlement failed permanently are excluded. A refused settlement moved nothing and was reversed, so counting it would misstate activity.
Path Parameters
string
required
Order book ID.
Response Fields
object
Volume is base quantity only. There is no notional figure here; for value-weighted history use Get Daily Stats, which reports both base and quote volume per day.
curl "https://api.trusset.org/orderbooks/stocks/api/order-books/clx_ob_stock_002/stats" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/stocks/api/order-books/${orderBookId}/stats`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
console.log('24h volume', data['24h'].volume, 'in', data['24h'].trades, 'trades');
{
"success": true,
"data": {
"1h": { "volume": "3000000", "trades": 2 },
"24h": { "volume": "31000000", "trades": 12 },
"7d": { "volume": "184000000", "trades": 63 },
"30d": { "volume": "702000000", "trades": 241 }
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
INVALID_PARAM | 400 | orderBookId is missing or longer than 100 characters |
ORDER_BOOK_NOT_FOUND | 404 | No such stock book on this instance, and not imported |
SERVICE_NOT_ENABLED | 403 | The Trading service is not enabled on this instance |
⌘I
curl "https://api.trusset.org/orderbooks/stocks/api/order-books/clx_ob_stock_002/stats" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/stocks/api/order-books/${orderBookId}/stats`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
console.log('24h volume', data['24h'].volume, 'in', data['24h'].trades, 'trades');
{
"success": true,
"data": {
"1h": { "volume": "3000000", "trades": 2 },
"24h": { "volume": "31000000", "trades": 12 },
"7d": { "volume": "184000000", "trades": 63 },
"30d": { "volume": "702000000", "trades": 241 }
}
}
