Перейти к основному содержимому

GET /api/v1/ws/events/{event_id}/chart

WebSocket endpoint that streams live market price data for a specific event. Used to power real-time price charts in the UI.

Authentication

None. This is a public WebSocket endpoint.

Connection

Path Parameters

ParameterTypeRequiredDescription
event_idintegerYesEvent ID
wscat -c wss://intotes.com/api/v1/ws/events/42/chart

Or in JavaScript:

const ws = new WebSocket("wss://intotes.com/api/v1/ws/events/42/chart");

ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log(data);
};

Messages

Initial Message

Upon connection, the server sends historical price data:

{
"type": "init",
"event_id": 42,
"ratios": [
{
"timestamp": "2026-04-04T00:00:00Z",
"values": [0.65, 0.35]
},
{
"timestamp": "2026-04-04T01:00:00Z",
"values": [0.68, 0.32]
}
]
}

Chart Update

Price updates are broadcast as market activity changes probabilities:

{
"type": "chart_update",
"event_id": 42,
"ratios": [
{
"timestamp": "2026-04-04T14:30:00Z",
"values": [0.72, 0.28]
}
]
}

Field Reference

FieldTypeDescription
event_idintegerEvent ID this update belongs to
ratios[].timestampstring (ISO 8601)Time of the price snapshot
ratios[].valuesnumber[]Probability for each market outcome (sums to ~1.0)

Connection Notes

  • The server sends ping frames periodically. Clients should respond with pong to keep the connection alive.
  • If the connection drops, clients should implement reconnection logic with exponential backoff.
  • No client-to-server messages are expected.