Skip to main content
Exchange is a high-performance trading platform built in Rust, exposing REST and WebSocket APIs for competition-style trading. Operators provision traders, create markets, and control the exchange lifecycle. Traders submit and manage orders, view positions and fills, and subscribe to live L3 market data.

Base URLs

ProtocolURL
RESThttps://exchange.jamesxu.dev
WebSocketwss://exchange.jamesxu.dev/ws
OpenAPI JSONhttps://exchange.jamesxu.dev/api-doc/openapi.json
Swagger UIhttps://exchange.jamesxu.dev/docs

What you can do

Submit orders

Place, amend, and cancel limit orders via REST or WebSocket.

Stream market data

Subscribe to real-time L3 orderbook snapshots and deltas over WebSocket.

View positions & fills

Query your account state, open orders, fills, and portfolio PnL.

Operator control-plane

Start/stop trading, create markets, settle positions, and manage users.

Authentication model

Exchange uses a simple, key-based authentication model — no passwords, no JWTs, no OAuth.
  • Trader routes authenticate with an assigned API key in the x-api-key header
  • Admin routes authenticate with a bearer token in the Authorization header
  • WebSocket sessions authenticate by sending {"op":"authenticate","api_key":"..."} on the socket
Traders are provisioned by operators. There is no self-registration.

Quickstart

Make your first API call in under 5 minutes.

Authentication

Understand API keys, admin tokens, and WebSocket auth.

REST API reference

Every endpoint, request shape, and response schema.

WebSocket API

Live market data, trading, and user event protocols.

Error codes

HTTP status codes and WebSocket reject/error codes.

Examples

Concrete curl, JavaScript, and WebSocket examples.

Key platform characteristics

Orders are matched in memory for minimal latency. The L3 orderbook tracks every resting order individually — each addition, fill, and cancellation is broadcast as a sequenced delta over WebSocket.
Risk is enforced at order admission time using worst-case net position. Each market has a fixed net position limit of +/-1000. Traders can go long or short from flat without pre-seeding inventory — the exchange tracks signed net positions and accumulated realized PnL.
When STORAGE_BACKEND=postgres is configured, orders, fills, positions, and audit events are durably written via a background batch writer thread. On startup, in-memory orderbooks are rebuilt from persisted open orders before the exchange begins serving traffic.
Authenticated trader REST routes are rate-limited to 100 operations per second per user. Requests over this limit are rejected.

Build docs developers (and LLMs) love