Base URLs
| Protocol | URL |
|---|---|
| REST | https://exchange.jamesxu.dev |
| WebSocket | wss://exchange.jamesxu.dev/ws |
| OpenAPI JSON | https://exchange.jamesxu.dev/api-doc/openapi.json |
| Swagger UI | https://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-keyheader - Admin routes authenticate with a bearer token in the
Authorizationheader - WebSocket sessions authenticate by sending
{"op":"authenticate","api_key":"..."}on the socket
Quick links
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
In-memory matching engine
In-memory matching engine
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.
Position-based risk model
Position-based risk model
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.
PostgreSQL persistence
PostgreSQL persistence
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.Rate limiting
Rate limiting
Authenticated trader REST routes are rate-limited to 100 operations per second per user. Requests over this limit are rejected.