GETGet Price History by Slug
Retrieve historical price data 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}:price).
Request
GET /v1/markets/slug/:slug/prices-history
Path Parameters
| Parameter | Type | Required | Description |
|---|
slug | string | Yes | Market URL slug (e.g., will-btc-hit-100k) |
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|
outcomeId | string | Yes | — | Outcome ID to get price history for |
startTs | number | No | 1 week ago | Start unix timestamp (seconds) |
endTs | number | No | now | End unix timestamp (seconds) |
fidelity | number | No | 1 | Data fidelity in minutes. Higher values produce fewer data points. |
Response
{
"history": [
{ "t": 1710000000, "p": 0.67 },
{ "t": 1710000300, "p": 0.68 },
{ "t": 1710000600, "p": 0.665 }
]
}
Response Fields
| Field | Type | Description |
|---|
history | array | Array of price points |
history[].t | number | Unix timestamp (seconds) |
history[].p | number | Closing price for the interval (0-1) |
WebSocket Integration
This endpoint is designed to be called after receiving a WebSocket signal on the market:{slug}:price channel:
// 1. Subscribe to WebSocket channel
socket.emit('join', { channel: 'market:will-btc-hit-100k:price' });
// 2. When signal received, fetch updated data using the same slug
socket.on('market:will-btc-hit-100k:price', async (data) => {
const response = await fetch('/v1/markets/slug/will-btc-hit-100k/prices-history?outcomeId=outcome-uuid-1');
const priceHistory = await response.json();
});
Errors
| Status | Description |
|---|
400 | Missing outcomeId or outcome does not belong to market |
404 | Market or outcome not found |
Examples
Last 24 hours with 5-minute fidelity
curl "https://api.conviction.bet/v1/markets/slug/will-btc-hit-100k/prices-history?outcomeId=outcome-uuid-1&startTs=1709913600&endTs=1710000000&fidelity=5"
Last week with default fidelity
curl "https://api.conviction.bet/v1/markets/slug/will-btc-hit-100k/prices-history?outcomeId=outcome-uuid-1"