Hanzo

CEX (cexd)

Internal Alternative Trading System with CLOB matching engine, pre/post-trade compliance, and regulatory reporting.

CEX — Central Limit Order Book ATS

cexd is Lux's internal Alternative Trading System (ATS). It provides a central limit order book matching engine with integrated pre-trade compliance gating, post-trade surveillance, and regulatory reporting for FINRA, SEC, and international equivalents.

Architecture

Client -> Gateway (HTTP/JWT) -> Engine -> Matcher (CLOB)
                                  |
                            Compliance (pre-trade)
                                  |
                            Surveillance (post-trade)
                                  |
                            Reporting (FINRA/ATS)

API Endpoints

All endpoints require JWT authentication (via CEX_JWT_SECRET). In dev mode (no secret set), endpoints are open.

Markets

MethodPathDescription
GET/api/v1/marketsList all active markets
GET/api/v1/markets/{symbol}Get market details
GET/api/v1/markets/{symbol}/bookOrder book snapshot (?depth=20)

Orders

MethodPathDescription
POST/api/v1/accounts/{accountId}/ordersSubmit order (compliance-gated)
GET/api/v1/accounts/{accountId}/ordersList account orders
GET/api/v1/accounts/{accountId}/orders/{orderId}Get order details
DELETE/api/v1/accounts/{accountId}/orders/{orderId}Cancel order

Accounts

MethodPathDescription
POST/api/v1/accounts/{accountId}/registerRegister with compliance status
GET/api/v1/accounts/{accountId}/statusGet compliance status

Admin (requires admin role)

MethodPathDescription
GET/api/v1/admin/reports/finraFINRA OATS reports
GET/api/v1/admin/reports/atsATS-N quarterly report
GET/api/v1/admin/surveillance/alertsSurveillance alerts (?status=open)
POST/api/v1/admin/markets/{symbol}/haltHalt trading (circuit breaker)
POST/api/v1/admin/markets/{symbol}/resumeResume trading

Order Types

TypeDescription
limitLimit order at specified price
marketMarket order at best available price

Time in Force

ValueDescription
GTCGood 'til cancelled
IOCImmediate or cancel
FOKFill or kill
DAYDay order (cancelled at market close)

Pre-Trade Compliance Flow

Every order submission passes through the compliance engine before reaching the matcher:

  1. Sanctions check — blocked accounts cannot trade
  2. PEP screening — direct/related PEPs require EDD + source of funds verification
  3. Adverse media — flagged accounts require EDD completion
  4. FATF high-risk country — requires enhanced KYC (level 3)
  5. KYC level — per-jurisdiction, per-asset-class minimums (30+ jurisdictions)
  6. Offering-type gating — Reg D (accredited only), Reg S (non-US only), etc.
  7. Order size limits — per-account max order size and daily limits
  8. Market status — halted markets reject all orders

Configuration

Env VarDefaultDescription
CEX_JWT_SECRET(none)JWT signing secret; empty = dev mode
CEX_JWT_ISSUERhttps://hanzo.idExpected JWT issuer
CEX_ADDR:8080Listen address

Source

  • Repository: luxfi/cex
  • Language: Go
  • Key packages: pkg/engine, pkg/compliance, pkg/surveillance, pkg/reporting, pkg/gateway

How is this guide?

Last updated on

On this page