> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ocx.global/llms.txt
> Use this file to discover all available pages before exploring further.

# Architecture

> A high-level view of how OCX is put together — the API gateway, matching engines, market-data pipeline, and public streams.

OCX presents a single public entry point — the **API gateway** — in front of the
matching engines and market-data services. You always call the gateway; it
authenticates your request and routes it to the right venue. This keeps one base
URL, one auth model, and one streaming contract across every product.

## System overview

```text theme={null}
                        ┌───────────────────────────────┐
    You                 │          OCX platform         │
 ┌────────┐             │                               │
 │ Browser│             │   ┌───────────────────────┐   │
 │  Bot   │──REST/SSE──▶│   │      API gateway      │   │
 │ Agent  │             │   │  (auth + routing)     │   │
 └────────┘             │   └───────────┬───────────┘   │
                        │       ┌───────┴────────┐      │
                        │       ▼                ▼      │
                        │  ┌─────────┐     ┌──────────┐ │
                        │  │  Perp / │     │ Options /│ │
                        │  │ futures │     │   spot   │ │
                        │  │  engine │     │  engine  │ │
                        │  └────┬────┘     └────┬─────┘ │
                        │       │  order books  │       │
                        │       └───────┬───────┘       │
                        │               ▼               │
                        │      ┌──────────────────┐     │
                        │      │  Market data      │     │
                        │      │  (CME via CQG) +  │     │
                        │      │  pricing/marks    │     │
                        │      └──────────────────┘     │
                        └───────────────────────────────┘
```

## The pieces

<CardGroup cols={2}>
  <Card title="API gateway" icon="door-open">
    The single public endpoint. Verifies your session or API key, applies rate
    limits, and proxies both REST and long-lived streams to the engines.
  </Card>

  <Card title="Matching engines" icon="scale-balanced">
    A perpetuals/futures engine and a central limit order-book engine for options
    and spot. Both match on price–time priority and support GTC, IOC, and FOK.
  </Card>

  <Card title="Market data" icon="satellite-dish">
    Institutional reference data from the CME markets, delivered in real time via
    CQG, feeds the index, mark, and volatility-surface pipelines.
  </Card>

  <Card title="Pricing & marks" icon="function">
    OCX computes its own index/mark prices, funding, and a fitted option
    volatility surface. See <a href="/methodology/overview">Methodology</a>.
  </Card>
</CardGroup>

## Order books and matching

Orders rest on a central limit order book per market and match on price–time
priority. Every order supports a time-in-force:

| TIF   | Behavior                                                  |
| ----- | --------------------------------------------------------- |
| `gtc` | Rests on the book until filled or cancelled.              |
| `ioc` | Fills whatever it can immediately, then cancels the rest. |
| `fok` | Fills fully and immediately, or is rejected.              |

`postOnly` rejects an order that would take liquidity (keeping you on the maker
side); `reduceOnly` prevents an order from increasing your position. Multi-leg
option strategies execute all-or-none.

## Market data and pricing

OCX prices every listed product against institutional reference data from the CME
markets, delivered through CQG. From that source, OCX derives perpetual index and
mark prices, the funding rate, dated-futures fair value, and a fitted
implied-volatility surface for options. These are OCX's published marks — used
for reference and risk. The **tradable** prices are always the live order book.

<Tip>
  Marks and IV are informational; you always trade against the order book. For a
  conceptual walk-through of each pricing pipeline, see the
  [Methodology](/methodology/overview) section.
</Tip>

## The API surface

Two request styles cover everything you do:

<Tabs>
  <Tab title="REST">
    Request/response over HTTPS with JSON bodies. Used for market-data reads,
    placing and cancelling orders, quoting, and account queries.
  </Tab>

  <Tab title="Streaming (SSE)">
    Long-lived Server-Sent Events connections for live order books, trades, your
    positions, the options board, and portfolio balances. Connect with any SSE /
    `EventSource` client and reconnect on drop.
  </Tab>
</Tabs>

Public market data needs no credentials. Trading and account endpoints require an
authenticated session or an API key — see [Authentication](/get-started/authentication).
