QuantaTrade AI — Technical Reference¶
Code-grounded reference for the QuantaTrade AI platform as of 2026-05-28. This is an onboarding-grade documentation set for internal engineers; it reflects what is actually built and shipping, with file:line citations to the platform monorepo.
Reading order¶
| # | Document | Audience entry-point |
|---|---|---|
| 01 | System architecture | Start here. Service map, deployment topology, transport choices, data flow. |
| 02 | Trading system | Order lifecycle end-to-end. CLOB, matching engine, OMS, fee tiers, MM substrate. |
| 03 | Ledger & accounting | Double-entry ledger, deposit sync, settleTrade, idempotency guarantees and gaps. |
| 04 | Risk controls | Pre-trade risk-checker, slippage guard, fat-finger, balance fail-open, margin gating. |
| 05 | Services reference | Per-service deep dive: api-gateway, order-router, ledger-service, pms-service, risk-service, ws-gateway, subscription-service, venue-adapter-binance. |
| 06 | Admin panel | Next.js admin UI, AdminService gRPC surface, auth flow, missing halt-market gap. |
| 07 | Data model | Prisma schema overview, key tables and relations, FK + index choices. |
| 08 | Event bus | NATS subjects, RPC patterns, idempotency keys, venue-adapter subscription model. |
| 09 | Deployment & ops | EC2 topology, docker-compose layout, nginx, secrets, observability. |
| 10 | Planned modules | Smart contracts, ICO/presale, custody, compliance, chain indexer — what's specified but not yet code. Pulls from existing spec docs. |
| — | FINDINGS.md | Real bugs and gaps surfaced during this documentation pass. Triage list — not docs. |
What this set covers — and what it doesn't¶
Covered: every running TypeScript service in QuantaTradeAI/platform, the admin-panel (Next.js), the shared packages/, the Prisma data model, the NATS event bus, the EC2 deployment.
Not covered in code-grounded form (cross-referenced from existing spec docs in docs/):
- Smart contracts (QuantaTradeAI/contracts) — token, sale, vesting, staking, revenue-router. M2 / M5 deliverables. See 10-planned-modules.md and docs/tokenomics-proposal.md, docs/staking-system-spec.md.
- Java matching engine internals (QuantaTradeAI/exchange-core) — referenced from the TypeScript order-router's gRPC client perspective; the Java internals are an inherited fork of exchange-core2 and are out of scope here.
- Compliance / KYC / custody microservices — planned, repos exist but minimal code; see 10-planned-modules.md.
- Strategy engine (Python) — M4 deliverable.
Conventions used in this set¶
- File:line citations:
services/order-router/src/risk-checker.ts:138means line 138 of that file onmainat the time of writing. The platform monorepo ishttps://github.com/QuantaTradeAI/platform. - In-flight PRs are marked
[PR#N]where N is the platform-repo PR number. As of 2026-05-28 the relevant in-flight PRs are: - #4 — pre-trade slippage guard
- #6 — venue-adapter-binance scaffold (stacked on #4)
- Mermaid for sequence and component diagrams. Render in GitHub or MkDocs.
- Status emoji: 🟢 in production, 🟡 in flight / partial, 🔴 not built. Borrowed from
docs/milestone-1-status.md.
Related planning documents¶
These are aspirational/contract artefacts, not code reference. Read for context, not for current behaviour.
docs/architecture.md— original delivery-plan architecture diagram (includes services that aren't yet built).docs/components-index.md— milestone-tagged component inventory (status per item).docs/milestone-acceptance-criteria.md— Richard's gate-style checklist.docs/milestone-1-status.md,docs/milestone-2-status.md— most recent status audits.docs/tokenomics-proposal.md,docs/staking-system-spec.md— M2/M5 spec.docs/m5-token-utility-plan.md— staking + buyback + revenue router design.
Maintenance¶
When a new service ships or an existing service changes meaningfully, update the relevant section AND the milestone status doc. Each doc carries an "as-of" date at the top — refresh on substantive change. Trivial typo fixes don't need a date bump.