GETGet Orderbook by Slug

Retrieve the current orderbook (bids and asks) for a specific outcome using the market slug. This endpoint is designed for use with WebSocket signals, which provide slug-based channel names (market:{slug}:orderbook).

Request

GET /v1/markets/slug/:slug/orderbook

Path Parameters

ParameterTypeRequiredDescription
slugstringYesMarket URL slug (e.g., will-btc-hit-100k)

Query Parameters

ParameterTypeRequiredDescription
outcomeIdstringYesOutcome ID to get orderbook for

Response

{
  "outcomeId": "outcome-uuid-1",
  "outcomeSide": "Yes - YES",
  "bids": [
    { "price": "0.650", "shares": "500.00" },
    { "price": "0.640", "shares": "300.00" },
    { "price": "0.620", "shares": "150.00" }
  ],
  "asks": [
    { "price": "0.680", "shares": "200.00" },
    { "price": "0.700", "shares": "400.00" },
    { "price": "0.750", "shares": "100.00" }
  ]
}

Response Fields

FieldTypeDescription
outcomeIdstringThe outcome ID this orderbook represents
outcomeSidestringOutcome name and side combined (e.g., Yes - YES, Trump - YES)
bidsarrayBuy orders sorted by price (highest first)
asksarraySell orders sorted by price (lowest first)
bids[].pricestringBid price (3 decimal places)
bids[].sharesstringTotal shares at this price level

WebSocket Integration

This endpoint is designed to be called after receiving a WebSocket signal on the market:{slug}:orderbook channel:

// 1. Subscribe to WebSocket channel
socket.emit('join', { channel: 'market:will-btc-hit-100k:orderbook' });

// 2. When signal received, fetch updated data using the same slug
socket.on('market:will-btc-hit-100k:orderbook', async (data) => {
  const response = await fetch('/v1/markets/slug/will-btc-hit-100k/orderbook?outcomeId=outcome-uuid-1');
  const orderbook = await response.json();
});

This eliminates the need to maintain a slug-to-UUID mapping, as both the WebSocket channel and the REST API use the same slug identifier.

Errors

StatusDescription
400Missing outcomeId or outcome does not belong to market
404Market or outcome not found

Example

curl "https://api.conviction.bet/v1/markets/slug/will-btc-hit-100k/orderbook?outcomeId=outcome-uuid-1"