# FinanceManager Trader Desk bridge

Use when adding Hyperliquid Trader Desk visibility to the FinanceManager/JARVIS dashboard.

## Boundary

FinanceManager/JARVIS is display, approval/audit, and operator context. It must not be the Hyperliquid executor.

Required flags in every API/UI layer:

```text
execution_allowed=false
dashboard_executes_orders=false
live_order_allowed=false
mainnet_signed_action=false
approval_is_audit_only=true
trader_must_recheck_gates=true
```

## Safe data flow

```text
CryptoTrader Trader Desk report
→ sanitized finance bridge JSON in finance runtime
→ backend endpoint GET /api/finance/trader-desk
→ FinancePage read-only cards
→ optional approval audit later
→ CryptoTrader re-reads approval and rechecks all gates before any possible execution
```

Runtime file used by the latest-intents bridge can be configured via:

```text
CRYPTO_TRADER_DESK_BRIDGE_PATH
```

Runtime file used by the shadow scorecard bridge can be configured via:

```text
CRYPTO_TRADER_DESK_SCORECARD_PATH
```

The dashboard endpoints must not leak these paths in responses.

When CryptoTrader also emits shadow performance evidence, read it as a separate scorecard snapshot instead of mixing it into current trade intents:

```text
/home/agent/jarvis_runtime/finance-system/crypto_trader/trader_desk_scorecard_latest.json
schema_version=trader_desk_shadow_scorecard.v1
```

Recommended endpoint/UI split:

```text
GET /api/finance/trader-desk            -> latest sanitized trade_intents
GET /api/finance/trader-desk/scorecard  -> historical shadow evidence/quality
```

The scorecard endpoint is still read-only and must preserve the same safety flags/path sanitization.

## UI shape

FinancePage section:

- Title: `Hyperliquid Trader Desk` / `CryptoTrader Decision Center`
- KPI cards: Tiny Live Candidates, Shadow Watch, Blocked, Best Signal
- Safety Boundary banner explaining dashboard is read-only/audit-only
- Trade Intent Cards: coin, side, signal, mode, status, score, setup, entry, stop, TP, blockers
- Shadow Performance Panel from the scorecard: open shadow positions, closed hypotheses, wins/losses/scratch, winrate, realized R, average R, by-coin/by-setup/by-score-bucket breakdowns

Avoid order-terminal language and buttons. Forbidden UX labels include:

```text
Buy now
Sell now
Jetzt kaufen
Jetzt verkaufen
Order ausführen
```

## Verification

- Backend unit tests for endpoint sanitization and missing-file fallback for both latest-intents and scorecard endpoints.
- Frontend test that FinancePage renders Trader Desk cards, Shadow Performance/Scorecard evidence, and no execution language.
- Dashboard client/type updates for both `traderDesk()` and `traderDeskScorecard()`.
- `npm run build` and API smoke with `contains_path=false` for both endpoints.
- OpenAPI export/check after adding or changing either endpoint; include `/api/finance/trader-desk` and `/api/finance/trader-desk/scorecard` in expected path checks.

If repository-wide `make verify` fails on pre-existing unrelated safety fixtures, report it as pre-existing and provide targeted green evidence for the bridge.
