adl.tradedesk · ADL 0.5.1 Trade Desk
Every order meets its limit before it meets the market.
Order management with pre-trade risk controls across multi-asset trading books: every ticket is checked at release against its book's active max-order limit, compliance's restricted list, and firm or desk kill switches, over-limit overrides require four-eyes approval from a different risk officer, kill switches require independent sign-off to lift, and append-only executions govern completion.
trader → book (desk) + exposurelimit (active | suspended) + instrument (tradable | restricted + note) → ticket (draft → pre-trade release checks → released → complete | cancel | daily 21:05 expire) · override (four-eyes approve | reject) · killswitch (firm/desk/book engaged → two-person release) · append-only fill
Why Trade Desk Exists
Under the SEC’s Market Access Rule (Rule 15c3-5) and FINRA’s market-access oversight guidance, broker-dealers, proprietary trading desks, and institutional funds cannot rely on post-trade exception emails or client-side warning banners to contain aberrant order flow. Pre-trade controls have to stand directly in front of order release: checking pre-set order thresholds, blocking restricted securities, halting flow immediately when a kill switch is pulled, and preventing any single trader or risk officer from overriding their own controls under pressure.
Trade Desk implements that deterministic control layer — deliberately with zero probabilistic AI in the pre-trade path — as a single declarative ADL 0.5.1 suite (adl.tradedesk) running on the Kalos C++20 engine and PostgreSQL:
- Pre-trade refusal at the moment of release: Every order enters as a
draftticket. Transitioning a ticket viareleaseexecutes three server-side AEL checks atomically beforereleasedAtis stamped: noengagedfirm or deskkillswitch(killSwitchBlocksRelease),tradable == trueon the referencedinstrument(restrictedInstrumentsBlocked), andnotionalwithin the book’sactivemax_order_notionalexposurelimitunless anapprovedoverrideis on file (orderWithinLimitOrOverridden). - Four-eyes separation on both overrides and kill switches: Traders can request an
override, but onlyrisk(oradmin) holds the transition guard toapproveorrejectit — andfourEyesOnOverridesrejects any approval where$record.approver == $record.requestedBy. Likewise,riskoropscan engage an emergencykillswitchatfirm,desk, orbookscope, whilekillSwitchReleasedBySomeoneElserefuses resumption by whoever engaged it. - Execution-backed blotter & live 3D exposure floor: Venue
fillrows attach only toreleasedtickets (fillsOnlyOnReleasedTickets) and are append-only for operations staff,ticket.completerefuses to mark an orderfilledwithout executions on file (completeNeedsAFill), unfilleddaytickets expire automatically at21:05(expireDayOrders), and/exposure/renders all 12 books’ live working and draft exposure against 3D limit planes in Three.js with an automatic 2D SVG fallback.
Nothing is simulated in browser JavaScript: every blotter filter, role console, 3D bar, Try-It button (frontend/kit.json), and 422 RULE_VIOLATION refusal talks live to /api/v1/tradedesk/*.
Inside the 5-Desk, 12-Book Demonstration Floor
Every trader, book code, symbol, price, and execution venue in seeds/seed.yaml (deterministically generated by seeds/gen_seed.py with privileges: user role attribution) is fictional, spanning 12 books across five asset desks:
- 12 Books & 24 Exposure Limits: Equities (
EQ-CORE,EQ-EVENT,EQ-QUANT—$2Mmax order), Rates (RT-CURVE,RT-BASIS,RT-FLOW—$25Mmax order, withRT-FLOW’s position limit currentlysuspendedbyrisk1), FX (FX-G10,FX-FLOW—$10Mmax order), Crypto (CR-SPOT,CR-ARB—$500Kmax order), and Commodities (CM-ENERGY,CM-METALS—$3Mmax order). - 12 Instruments Including an Active M&A Restriction (
CRST): Equities (NWND,BLUP,CRST), Treasuries (UST-10Y,UST-2Y), FX pairs (EURUSD,USDJPY,GBPUSD), spot crypto (BTC-USD,ETH-USD), and commodity futures (CL-F27,GC-G27).Crestline Biotech(CRST) sits on the restricted list (tradable: false) with its required compliance note explaining the firm is advising on a pending acquisition. - 58 Tickets Across Every Lifecycle & Control Outcome:
- 25
filledorders backed by 64 venuefilllegs, including 5 over-limit block orders released only after a different risk officer approved an override — such asTD-20296(Sell 32,100 NWNDfor$2,697,414,135%ofEQ-CORE’s$2Mlimit, entered bytrader1, approved byrisk1, and filled byops1onEXCH-B). - 16
releasedworking orders, including 14 partially executed orders,TD-20300($31.32MUST-10Yat125%ofRT-BASIS’s$25Mlimit, working under an override approved byrisk1), and unexecutedTD-20280(Buy 2.7322 BTC-USD, ready to testcompleteNeedsAFill). - 7
canceledorders (3 client pulls, 3 canceled after risk rejected an override recommending child orders, andTD-20307canceled on restrictedCRST) plus 4expiredday orders swept at market close. - 6
draftorders poised to test every pre-trade refusal live:TD-20292(BTC-USD) andTD-20293(ETH-USD) held behind the crypto kill switch,TD-20304($3.31MNWND,165%of limit) andTD-20305($3.85MGC-G27,128%of limit) waiting inoverridesPending,TD-20306blocked on restrictedCRST, and within-limitTD-20294(CL-F27, ready to testfillsOnlyOnReleasedTickets).
- 25
- 10 Kill Switches (
engagedKillSwitches+ Audit Trail): Nine historical halts acrossfirm,desk, andbookscopes (stale consolidated feed, frozen venue prices, runaway strategy sending 40 orders in 2 seconds, central-bank spike, exchange halt) each record distinctengagedByandreleasedByactors. One kill switch is engaged right now onDesk crypto(engaged byrisk2after a venue paused withdrawals), halting all new crypto releases untilrisk1(oradmin) lifts it.
How ADL Enforces Pre-Trade Risk Controls on the Server
When a chief risk officer, internal auditor, or market-access examiner asks how a breach order reached a venue or whether a trader could bypass a desk halt via direct API calls, five declarative invariants in backend/domain.yaml guarantee the answer lives in PostgreSQL:
- Atomic three-gate release check (
killSwitchBlocksRelease,restrictedInstrumentsBlocked,orderWithinLimitOrOverridden): FiringPOST /api/v1/tradedesk/tickets/{id}/transitions/releaseevaluates cross-resource AELquery()expressions inside Kalos before committingstatus: 'released'andsets: { releasedAt: now() }. Any engagedfirmor matchingdeskkill switch, anyinstrumentwithtradable == false, or anynotionalexceeding the book’sactivemax_order_notionallimit without anapprovedoverrideaborts the transaction with HTTP422 RULE_VIOLATION. - Role-separated, four-eyes limit overrides (
overridestate machine &fourEyesOnOverrides): Traders ([trader, admin]) may create anoverrideinrequested, surfacing it in the risk-onlyoverridesPendingview (permissions: [risk, admin]). Only[risk, admin]can fireapproveorreject,rejectrequires bothapproveranddecisionNote, andfourEyesOnOverridesrejects$record.approver == $record.requestedBy. - Emergency halts with independent resumption (
killswitch&killSwitchReleasedBySomeoneElse): Bothriskandopscan create anengagedkillswitchimmediately when a venue or feed misbehaves, broadcasting it throughengagedKillSwitches. Lifting the switch requires[risk, admin], a mandatoryreleaseNotecaptured into the switch’shistorytimeline ("Released: {releaseNote}"), and$record.releasedBy != $record.engagedBy. - Append-only executions & scheduled close expiry (
fillsOnlyOnReleasedTickets,completeNeedsAFill,expireDayOrders): Only[ops, admin]can createfillrecords, updates/deletes are restricted toadmin,fillsOnlyOnReleasedTicketsblocks booking executions against non-releasedtickets,completeNeedsAFillprevents transitioning a ticket tofilledwhenlen(query('fill', { ticket: $record.id })) == 0, andexpireDayOrdersruns daily at21:05to transition unfilledreleaseddaytickets toexpired. - Mandatory explanations & immutable audit trails (
restrictionsExplained,history,features: { audit: true }): Marking an instrument non-tradable withoutrestrictionNotefails field validation (tradable == true || restrictionNote != null), canceling any ticket requirescancelNote(recorded as"Canceled: {cancelNote}"intickethistory), and every create, update, and transition across all 8 resources writes an immutable actor-stamped audit entry in Kalos.
Zero Sign-Up · Live Kalos Sessions
Sit at a Bench and Try It Live
Each card below signs directly into a real role-scoped JWT session on the production Kalos backend so you can test role queues, transitions, and server refusals immediately.
trader as trader1 Equities & Multi-Asset Trader
Enter draft tickets across books, release within-limit orders through pre-trade checks, inspect filled $2.70M block trade TD-20296 and pending gold override TD-20305, or cancel working orders with a mandatory reason.
Launch trader1 bench ↗trader as trader3 Crypto & Block-Flow Trader
Click Release on within-limit crypto ticket TD-20292 to trigger the live 422 kill-switch refusal, or try releasing $3.31M equities draft TD-20304 (165% of EQ-CORE's limit) before risk approves its override.
Launch trader3 bench ↗risk as risk1 Risk Officer
Review the 2 pending limit overrides in overridesPending, test the four-eyes approver gate on TD-20304, independently release the crypto kill switch engaged by risk2, or suspend and reinstate book exposure limits.
Launch risk1 bench ↗ops as ops1 Trade Operations
Book append-only venue executions against released tickets, test why unexecuted ticket TD-20280 refuses completion without fills on record, expire unfilled day orders, and maintain the CRST restricted list.
Launch ops1 bench ↗Production Interface Walkthrough
Inside Trade Desk — Screen by Screen
Captured directly from the live Kalos deployment. Click any screenshot to inspect full resolution or jump straight to that screen in the running application.
Declarative Server Enforcement
What the Kalos Server Refuses — Whoever Asks
These invariants live in the ADL domain definition, not in client-side UI JavaScript. Every REST request is checked by Kalos before touching PostgreSQL, and any violation returns a structured error naming the rule.
| Attempted Operation | Enforced ADL Rule / Guard | Regulatory Alignment |
|---|---|---|
| Release any ticket while a firm-wide or matching desk kill switch is engaged | killSwitchBlocksRelease | SEC Rule 15c3-5(b) · FINRA Market Access emergency kill-switch controls |
| Release a ticket for an instrument on the compliance restricted list (tradable == false) | restrictedInstrumentsBlocked · instrument.restrictionsExplained | SEC Rule 15c3-5(c)(2) · Restricted-security & M&A watch-list blocking |
| Release a ticket whose notional exceeds its book's active max-order limit without an approved override | orderWithinLimitOrOverridden | SEC Rule 15c3-5(c)(1)(i) · Pre-trade capital & order-size thresholds |
| Approve a book-limit override when the recorded approver is the same person who requested it | fourEyesOnOverrides · override.approve [risk, admin] | Four-eyes supervisory sign-off on credit & limit breaches |
| Release an engaged firm, desk, or book kill switch as the same person who engaged it | killSwitchReleasedBySomeoneElse · killswitch.release (releaseNote) | Independent two-person sign-off before resuming market access |
| Book a venue execution fill against a draft, canceled, expired, or already completed ticket | fillsOnlyOnReleasedTickets · fill permissions (append-only) | Order-to-execution blotter integrity |
| Mark a released ticket filled when zero execution fills are on record for that ticket | completeNeedsAFill · expireDayOrders (daily 21:05 schedule) | Verified execution reconciliation & end-of-day order expiry |
| Cancel a ticket, reject an override, or restrict an instrument without recording a written reason | ticket.cancel (cancelNote) · override.reject (decisionNote) · restrictionsExplained | Reconstructable supervisory & compliance audit trail |
Domain Footprint
ADL Suite Inventory
Resources (8)
traderbookinstrumentexposurelimitticketoverridekillswitchfill RBAC Roles (4)
traderriskopsadmin Declarative Views (3)
blotteroverridesPendingengagedKillSwitches