Time SeventeenDocs
API Reference

WebSocket

Public and private real-time streams — subscribe/unsubscribe, snapshot/delta, envelope, sequencing, heartbeats, resume, and schema evolution.

Draft v0.1 — design contract, not yet a live service

This documentation set defines a proposed Time Seventeen protocol for review and implementation planning. https://api.t17.capital is the approved and reserved REST origin, but neither that origin nor any documented endpoint is claimed to be live. The WebSocket origin remains unspecified. Credentials, chain IDs, contract addresses, rate limits, and SLAs remain unapproved; IDs, prices, and timestamps shown throughout are illustrative, not real production data.

Connection

wss://YOUR_APPROVED_STREAM_HOST/v1/ws

Private topics require the same canonical request authentication used for private REST endpoints, applied to the connection/subscription handshake. Public topics require no identity.

Topics

ScopeTopicPayload
Publicindex.priceNew IndexPriceObservation
Publicindex.statusIndex/version status transition (active, suspended, degraded, archived)
Publicindex.rebalanceNew IndexVersion published
Publicmarket.tickerLatest normalized market price view
Publicmarket.tradePublic trade tape entries
Publicmarket.orderbookOrder-book snapshot/delta
Publicmarket.ratingNew/updated MarketRating
Publicevent.severityNew/updated SeverityAssessment
Publicseverity_index.valueNew SeverityIndex value
Privateaccount.orderOrder state transitions
Privateaccount.fillNew fills
Privateaccount.positionPosition projection updates
Privateaccount.balanceBalance projection updates
Privateaccount.settlementSettlement state transitions
Privateaccount.riskRisk-limit changes

market.rating and event.severity/severity_index.value remain independent topics: a market.rating message never carries severity fields, and a severity message never carries rating fields.

Envelope

Every stream message shares one envelope:

{
  "type": "market.orderbook.delta",
  "version": "1.0",
  "event_id": "evtmsg_demo_001",
  "subscription_id": "sub_demo_001",
  "sequence": 42,
  "resource_time": "2026-08-31T12:00:00.123Z",
  "published_at": "2026-08-31T12:00:00.130Z",
  "resume_cursor": "opaque",
  "data": {}
}
FieldMeaning
typeEvent type/version qualifier, for example market.orderbook.snapshot or market.orderbook.delta
versionSchema version of this event type, independent of the REST /v1 path version
event_idUnique per message; used to detect and ignore duplicates
subscription_idThe client’s subscription this message satisfies
sequenceMonotonic per subscription/resource partition, used for gap detection
resource_timeWhen the underlying resource changed
published_atWhen Time Seventeen published this message
resume_cursorOpaque cursor a client can present to resume after a disconnect
dataThe topic-specific payload

Subscribe / unsubscribe

Illustrative subscribe request
{
  "action": "subscribe",
  "topic": "market.orderbook",
  "params": { "market_id": "mkt_demo_001", "outcome_id": "out_demo_001" },
  "subscription_id": "sub_demo_001"
}
Illustrative unsubscribe request
{
  "action": "unsubscribe",
  "subscription_id": "sub_demo_001"
}

A new subscription receives an initial snapshot message before any delta messages for the same resource, unless the client explicitly opts into delta-only mode for a resource it has already snapshotted through REST.

Sequence gaps, resume, and recovery

  • Clients track the monotonic sequence per subscription/resource partition and ignore any message whose event_id has already been seen.
  • On a detected sequence gap, the client discards local state for that resource and either resumes with resume_cursor or requests a fresh snapshot.
  • Resume is best-effort within a production-configured retention window. A resume request outside that window returns STREAM_RESUME_UNAVAILABLE, and the client MUST fall back to a fresh REST/stream snapshot rather than assume continuity.
  • Heartbeat/ping cadence and subscription quotas are production configuration, not fixed by Draft v0.1.

Snapshot then delta example

Illustrative snapshot
{
  "type": "market.orderbook.snapshot",
  "version": "1.0",
  "event_id": "evtmsg_demo_100",
  "subscription_id": "sub_demo_001",
  "sequence": 88213,
  "resource_time": "2026-08-31T12:00:00.000Z",
  "published_at": "2026-08-31T12:00:00.010Z",
  "resume_cursor": "opaque_cursor_snap_1",
  "data": {
    "market_id": "mkt_demo_001",
    "outcome_id": "out_demo_001",
    "bids": [["0.6300", "500.00"]],
    "asks": [["0.6400", "400.00"]]
  }
}
Illustrative delta
{
  "type": "market.orderbook.delta",
  "version": "1.0",
  "event_id": "evtmsg_demo_101",
  "subscription_id": "sub_demo_001",
  "sequence": 88214,
  "resource_time": "2026-08-31T12:00:00.120Z",
  "published_at": "2026-08-31T12:00:00.130Z",
  "resume_cursor": "opaque_cursor_delta_1",
  "data": {
    "market_id": "mkt_demo_001",
    "outcome_id": "out_demo_001",
    "side": "bid",
    "price": "0.6300",
    "quantity": "350.00"
  }
}

A client applies the delta to the snapshot’s book by price level; a zero quantity removes the level.

Private stream example

Illustrative account.order event
{
  "type": "account.order.updated",
  "version": "1.0",
  "event_id": "evtmsg_demo_200",
  "subscription_id": "sub_demo_002",
  "sequence": 17,
  "resource_time": "2026-08-31T12:01:12.041Z",
  "published_at": "2026-08-31T12:01:12.055Z",
  "resume_cursor": "opaque_cursor_ord_1",
  "data": {
    "order_id": "ord_demo_001",
    "status": "partially_filled",
    "filled_quantity": "60.00",
    "remaining_quantity": "90.00"
  }
}

Schema evolution

Stream messages carry their own version field, independent of the REST /v1 path version, so a topic’s payload schema can evolve without forcing a REST major-version bump. Clients ignore unknown additive fields but MUST NOT ignore an unrecognized type or an unrecognized enum value inside data that changes economic or state meaning.

Where to go next

  • Prices for the REST snapshot endpoints that pair with index.price, market.ticker, and market.orderbook.
  • Orders, Fills, Positions, and Settlement for the REST resources behind the private topics.
  • Errors for the STREAM_* error family.