Markets API
GET /api/markets
Returns all markets, optionally filtered.
Query parameters:
| Parameter | Type | Description |
|---|---|---|
cat | string | Filter by category: crypto, soccer, etc. |
league | string | Filter by league: Bags.fm, etc. |
status | string | Filter by status: active, resolved |
Response:
[
{
"id": "bags-a1b2c3d4",
"q": "Will $DFLASH graduate to DAMM v2 within 24 hours?",
"cat": "crypto",
"league": "Bags.fm",
"yes": 35,
"no": 65,
"vol": "0",
"traders": 0,
"closes": "Jun 1, 2026",
"closes_at": "2026-06-01T12:00:00Z",
"status": "active",
"source": "bags",
"resolution_rule": "..."
}
]GET /api/markets/:id
Returns a single market by ID.
Path parameters:
| Parameter | Description |
|---|---|
:id | Market ID (e.g. bags-a1b2c3d4 or fees-e5f6g7h8) |
Response: Same shape as individual item in /api/markets.
GET /api/markets/:id/history
Returns OHLCV price history for the market chart.
Query parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
range | string | 24H | Time range: 1H, 6H, 24H, 7D, All |
Response:
{
"marketId": "bags-a1b2c3d4",
"range": "24H",
"points": [
{
"bucketAt": "2026-06-01T10:00:00Z",
"openYesPrice": 48.2,
"highYesPrice": 52.1,
"lowYesPrice": 47.8,
"closeYesPrice": 51.0,
"openNoPrice": 51.8,
"highNoPrice": 52.2,
"lowNoPrice": 47.9,
"closeNoPrice": 49.0,
"volume": 145.50,
"trades": 12
}
]
}Each point represents a 5-minute OHLCV candle.
POST /api/orders/quote
Get a trade quote without placing an order. No authentication required.
Request body:
{
"marketId": "bags-a1b2c3d4",
"side": "YES",
"amount": 50
}Response:
{
"shares": 89.23,
"fee": 0.25,
"feeRate": 0.5,
"avgPriceCents": 56.04,
"startPriceCents": 55.0,
"newYesPriceCents": 57.1,
"newNoPriceCents": 42.9,
"slippageBps": 189
}| Field | Description |
|---|---|
shares | Number of shares you’d receive |
fee | Fee amount in trade currency |
feeRate | Fee rate as a decimal |
avgPriceCents | Average fill price (¢) |
startPriceCents | Price before your order |
newYesPriceCents | YES price after your order |
slippageBps | Slippage in basis points |