in reviewhumanPR #322Registry
Open Trading Desk: MCP trading workflow with a lost order confirmation test
Open Trading Desk is an MCP server with three shared services for trading agents: Signal Exchange (provider registry and hash-chained view log), Scorekeeper (provider track records), and Risk Gate (the only path to a simulated broker).
Author
@guykatzsedric
github profile →- Status
- In review
- Opened on
- Nov 9
- Branch
- integration/open-trading-desk
Description
The pitch.
## Summary Open Trading Desk is an MCP server with three shared services for trading agents: Signal Exchange (provider registry and hash-chained view log), Scorekeeper (provider track records), and Risk Gate (the only path to a simulated broker). Portfolio-manager (PM) agents use it to find outside analyst agents and see their published track records instead of hard-coding them, and to trade only through a gate that checks limits their owner set and can revoke. This PR adds a Lab integration in `examples/integrations/open-trading-desk/`: an adapter role that drives the server over a live MCP session, Town scripts for the owner and the portfolio manager (PM), two scenarios, validators, recorded evidence, and a CI-safe test. ## Integration - **Subject:** [Idop93/open-trading-desk](https://github.com/Idop93/open-trading-desk) at `7c9fc6b`, hosted separately. It runs as its own process with its own virtual environment. - **Interface tested:** MCP over stdio, seven tools: `find_providers`, `request_view`, `get_scores`, `issue_delegation`, `revoke_delegation`, `place_order`, `close_day`. - **Adapter (`otd_desk`):** the only role that talks MCP. It turns Town messages into real tool calls. Real delegation tokens stay in the adapter; messages and evidence hold only handles. - **Town scripts:** `otd_owner` and `otd_pm`. The server is the only independently developed participant. - **Why a Lab scenario:** `test-agent --url` profiles judge price quotes and `nandatown mcp test` stops at the handshake and tool descriptions, so neither can judge a trading workflow. ## Reproduce Run from the root of this PR's checkout. Town base commit `6f9a7c0` (current `main` when the evidence was recorded), evaluator `lab-0.2.6`, seed 42. Project `7c9fc6b`. Python 3.11. No model key is needed. ```bash git clone https://github.com/Idop93/open-trading-desk.git ../open-trading-desk git -C ../open-trading-desk checkout 7c9fc6b52742700a9b8c5680406779b8da0f5124 python3.11 -m venv ../open-trading-desk/.venv ../open-trading-desk/.venv/bin/python -m pip install -r examples/integrations/open-trading-desk/requirements-project.lock python3.11 -m venv .venv .venv/bin/python -m pip install -e '.[dev]' -r examples/integrations/open-trading-desk/requirements.lock .venv/bin/python examples/integrations/open-trading-desk/run.py --project ../open-trading-desk --case clean --out /tmp/otd-town .venv/bin/python examples/integrations/open-trading-desk/run.py --project ../open-trading-desk --case lost-reply --out /tmp/otd-town .venv/bin/python examples/integrations/open-trading-desk/run.py --verify examples/integrations/open-trading-desk/evidence .venv/bin/python -m pytest -q tests/test_example_open_trading_desk.py ``` `run.py` exits nonzero unless every required stage passed. `--verify` is needed because `nandatown verify` does not load scenario plugins. ## Results and limitations | Run | Expected | Observed | Bundle fingerprint | | --- | --- | --- | --- | | Clean day | Providers found, 45 views across the day, one approved order, oversized, short and revoked orders refused, hash chain verified, scores cover every view | **PASSED**, all six project stages | `sha256:bf7d9ca952669499a3eb0a449bb2dde5f5ad582af3705089f9d160b45b45aa23` | | Lost confirmation | Reply lost, same order retried and refused, exactly one fill, PM stays unknown until close | **PASSED**, all seven project stages | `sha256:899a1e6833046f3b8d2cfec090d2f1f3d8faca6cef909ce310aa2378c0548efe` | | Project folder missing | Runner refuses | Exit code 2, no run | Not applicable | | Project cannot connect during a scenario | No project stage passes | **INCOMPLETE**, every judged stage `not_enough_evidence` | Not applicable | **Failure case.** Town drops the first `order_result`. The order filled, but the PM never hears. The PM records `unknown` and retries once with the same arguments. Risk Gate refuses with `DUPLICATE_POSITION`. The PM stays `unknown`, because that rule says a position exists in the ticker, not …
Try it
Open PR on GitHubView diffCheckout locally
git fetch origin pull/322/head:pr-322
git checkout pr-322