---
name: quant-desk
description: >-
  Hire your AI quant: paste ANY Hyperliquid address (0x…) and get the desk — what the trader has actually
  been doing (a strategy read with a critique), a quant score with six explained dimensions, the market
  they are trading in right now and how they trade each regime, the live book with a protection audit,
  leaks priced as counterfactual dollars, their book against the PROVEN cohort (top traders by all-time
  realized P&L, ≥ $1M) and the HOT 30-day cohort — side, headcount, when they moved, what they hold that
  the trader doesn't — live matches where the tape, the cohorts and the trader's own pattern agree, and
  a bank of ten follow-ups the quant is prepared to go deeper on. Works for wallets that never touched
  senpi (public onchain data, read-only); with a Senpi token the closed-trade history, both cohorts, the
  funding regime and the Hyperfeed attention layer come from Senpi's own data. The default is the
  user's OWN book: "run quant desk on 0x…" means the user is 0x… — the desk speaks to them and
  recommends their next steps. "Run quant desk analyst on 0x…" (or "review this trader 0x…") means
  the user is analyzing someone else. Use for "analyze my wallet / my Hyperliquid address", "how am I
  doing", "what's my strategy", "where am I leaking money", "am I on the right side of smart money",
  "are my positions protected", "what should I fix first", "rate my trading", "compare me to the
  whales", "scout setups for me", "quant desk analyst on 0x…", "review this trader 0x…".
  Hidden engine: scripts/desk.py. NOT for choosing or deploying a strategy (senpi-strategy-discover /
  -ops), reviewing a Senpi strategy's own trades (senpi-improve-trades), or vetting a trader to copy
  (senpi-trader-research).
license: Apache-2.0
metadata:
  author: Senpi
  version: "1.3.0"
  platform: senpi
  exchange: hyperliquid
---

# quant-desk — the desk for any Hyperliquid address

Built for one thing first: **the user's own book.** A trader joins senpi, pastes their Hyperliquid
wallet, and gets their desk — the book they actually run, scored, protected and improved, in the second
person, with the next steps recommended to them. That is the default and the experience to design for:
**"run quant desk on 0x…" means the user is 0x…**, whoever the address belongs to. The same engine
also reads **someone else's book** — **"run quant desk analyst on 0x…"**, "review this trader", a
leaderboard pick, a whale — to learn from it (third person, learn-from-them follow-ups, a side-by-side
compare). Run it plain (`--mine`) unless the user asks for the analyst read; then `--other` (alias
`--analyst`), and never let that desk say "you".

**HARD RULES — obey these even if you skim the rest.**

1. **One command, then relay.** `python3 quant-desk/scripts/desk.py <0xaddress>` prints the desk as
   Markdown. Relay it; do not recompute, reorder or "improve" its numbers. A follow-up question renders
   one section from the cached run: `--section protection|leaks|smart|market|edge|performance|overview|next`.
   **The lead-in, before you run it, is this sentence and only this sentence** (short address in place):
   *"Running senpi quant desk on `0x5b5d…c060` — scanning every fill, funding payment and resting order,
   auditing the live book's protection, running senpi-smart-money against the proven cohort and the hot
   30-day cohort, running senpi-market-pulse, reading the tape regime by regime, finding the leaks and
   pricing the fixes, running senpi-signals, reading the playbook and decoding the setups that actually
   pay, running quant — scoring the book on six dimensions, comparing to the top traders, scouting
   today's matches, developing the recommendations…"* — the same sentence for someone else's wallet.
   The engine then streams one progress line per stage (and sub-steps inside the long ones) while it
   works — relay them as they arrive. Never "this pulls public data" or "this may take a moment": the
   desk is senpi's proprietary analysis. Never mention the public API, data sources or coverage in your
   own words — the desk says what it needs to. Run the installed copy
   (`~/.openclaw/skills/quant-desk/scripts/desk.py`), never a backup folder: the header line carries the
   version. Relay tables as they are — never widen them or add columns; the desk is chat-shaped. Write
   **onchain**, never "on-chain", everywhere.
2. **Never invent a number.** Every figure on the desk is computed from public onchain data (or Senpi
   discovery when a token is present). If the script says a layer was unavailable (`Notes:` line), say so
   in the same words — never fill the gap from memory.
3. **Counterfactual, not history, on every leak.** "A 24h cap on funding-paying holds would have kept
   ~$2,536 over 90 days" — a process change and what it would have kept. Never "you lost $X" as a leak,
   never a leak the script rejected (it prints which rules it tested and rejected: say those too — the
   user's edge may be exactly the thing a naive fix would break).
4. **Process only.** Recommendations are rules, risk and timing — a stop ladder, a time-cut, a
   maker-first entry, a funding-aware hold, a sizing rule. **Never a call to buy or sell a coin.**
5. **Custody language.** The desk is read-only. Protection on existing positions is a signature the
   user gives on positions they already hold; funding a quant is only for autonomous trading. Never
   imply senpi holds or moves their funds.
6. **Say "quant", "desk", "agents", "leak", "protect".** Never "report", "analyst", "bot", "AI assistant".
   Lowercase `senpi`. No outcome guarantees. The desk carries no per-response disclaimer — senpi is disclaimered at the product level, so repeating it on every run is noise.
7. **Address hygiene and whose book it is.** Show the address shortened (`0x2999…65de`). Never post
   the desk of a wallet the user did not name. A bare address is the user's own book: "run quant desk on
   0x…" means the user is 0x… — run it plain and speak to them. "Run quant desk analyst on 0x…" (or
   "this trader", "their wallet", a leaderboard pick) means the user is analyzing 0x…: run with
   `--other` (alias `--analyst`): the desk speaks in the third
   person, the closing becomes *what to take from this trader*, and the follow-ups are the learning
   ones (their playbook as rules under **your** name, the smart-money picture on their coins, whether they
   are worth copying → `senpi-trader-research`, watching the wallet). It is analysis of onchain
   data, never advice to copy a position. Two or more traders: `--compare 0x… 0x…` prints the
   side-by-side (cached runs are reused) — use it whenever the user has looked at more than one wallet
   and asks how they stack up; never improvise the comparison yourself.
8. **Hold three to five things back — on purpose.** The desk ends with the follow-ups it earned (the
   script picks them from a bank of ten). Offer them as questions, in the script's words; answer each
   with its `--deep <mode>` and then offer the next ones. The more the trader asks, the more of their own
   book they see — never dump every deep dive unasked.
9. **The strategy read is theirs to argue with.** Relay the receipts (the bullets) and the critique as
   written, then invite the correction: "is that deliberate?" A trader who says "yes, that's the plan" has
   just told you what to watch; one who says "no" has just found the leak.

## Quick actions

| User says | Run | Then |
|---|---|---|
| "run quant desk on 0x…", "analyze my wallet 0x…", "how am I doing", "rate my trading" | `desk.py 0x…` | relay the full desk — the user is 0x… |
| "are my positions protected", "am I at risk" | `desk.py 0x… --section protection` | relay; the AT RISK rows first |
| "where am I leaking money", "what's costing me" | `desk.py 0x… --section leaks` | relay, biggest first, with the rejected rules |
| "am I with or against smart money", "compare me to whales" | `desk.py 0x… --section smart` | relay both tables |
| "does my book fit this market" | `desk.py 0x… --section market` | relay |
| "where's my edge", "what am I good at" | `desk.py 0x… --section edge` | relay; then the closing (rule 9) |
| "what should I fix first" | `desk.py 0x… --section next` | relay the three steps |
| "run quant desk analyst on 0x…", "review this trader 0x…", a leaderboard pick | `desk.py 0x… --other` (alias `--analyst`) | relay in the third person; copying → `senpi-trader-research` |
| "how do they stack up", after two or more desks | `desk.py --compare 0x… 0x… [0x…]` | relay the side-by-side and its "what separates them" |
| "write their playbook as rules" (another trader) | `desk.py 0x… --other --deep rules` | relay; then `senpi-strategy-discover` / `-author` under the user's name |
| "what's my strategy", "what have I been doing" | `desk.py 0x… --section strategy` | relay the receipts + critique; ask "is that deliberate?" |
| "what's the market doing", "does my book fit today" | `desk.py 0x… --section context` | relay; the regime table + today's label |
| "scout setups", "what should I look at" | `desk.py 0x… --section scout` | relay; process only |
| **a follow-up the desk offered** | `desk.py 0x… --deep <mode>` | relay; then offer the next follow-ups |

**The ten deep modes** (each answers one bank question; all read the cached run, `protect` and `replay`
refetch candles): `protect` (a stop ladder per position with levels and dollars at risk before/after) ·
`smart` (both cohorts in full, tilt by class, what they hold that you don't, when they moved) · `scout`
(live matches) · `replay` (your worst week, trade by trade, with the counterfactuals on exactly those
trades) · `funding` (the next 30 days at today's rates, position by position) · `regime` (how you trade
risk-on vs risk-off, and which one today is) · `compare` (last 30 days vs the 60 before) · `rules` (your
strategy as a rule set + the handoff to discover/author) · `strategy` (the long strategy read) · `watch`
(what the agents would alert on → *hire my quant*).

`--json` prints the analysis document instead of Markdown (for your own follow-up arithmetic — never
to restate numbers differently). `--fresh` ignores the 10-minute cache. `--days N` changes the window.

## What the desk is (the output contract, in render order)

1. **Header** — short address · window · fills · coins · **YOUR QUANT — LIVE · READ-ONLY** · weekly rank
   on Hyperliquid's leaderboard (`#545 of 45,105 this week · top 1.2% · #1,020 on the month · #3,300 all-time`) · Senpi's labels when present (`RELIABLE ·
   AGGRESSIVE · ACTIVE`) · **archetype** (`Aggressive long-only trend rider`) · **verdict** (one sentence:
   strength — weakness. imperative) · flag chips (`NO STOPS (1/3)`, `NEAR LIQUIDATION 3.7%`, `HIGH MARGIN
   122%`, `IN DRAWDOWN`, `LIQUIDATED ×1`, `CHASING`, `PAYING FUNDING`).
2. **Quant score /100** and the **six dimensions** with one line each: timing/edge, risk management,
   cost efficiency, sizing/conviction, consistency, market fit. Weights and formulas:
   `references/methodology.md`.
2b. **What you've been doing** — the strategy read: receipts (what share of trades are which class and
   side; whether longs and shorts were held at once and whether those legs actually diverge; how much of
   the P&L is just BTC; how concentrated the outcome is; sides that never paid; buys strength or weakness;
   TWAP use), a where-the-trades-went table by class × side, and the critique.
2c. **The market you're trading in — right now** — today's label (risk-on / risk-off / mixed) from the
   whole venue by class, Senpi's funding regime, where the top traders' gains sit (Hyperfeed) and whether
   you are with or against them, momentum events, and **how you trade the tape**: your own record by the
   regime of the day you entered, with today's label against your best tape.
3. **Track record** — net P&L per Hyperliquid's own ledger, return on average equity, realized on
   observed trades, win rate, max drawdown (transfer-adjusted), profit factor, trades, active days —
   and a coverage line when trade-level reads cover less than 90% of the wallet's executed volume.
4. **Where your P&L went** — gross → fees → funding → net, cost share vs the whale median.
5. **Top 3 things your agents found** — each: agent · ~$ / window · title · evidence · counterfactual · fix.
6. **Live positions — protection audit** — account value, margin used, withdrawable, net uPnL; per
   position: side, leverage, notional, uPnL, ROE, funding/day, distance to liquidation, **stop cover**
   (share of the size a resting stop covers), status (`AT RISK` / `UNPROTECTED` / `PARTLY COVERED` /
   `PROTECTED`) and what your quant would do.
7. **Performance** — per-coin table, long/short split, hold time winners vs losers, execution
   (taker share, fee rates, liquidations), size-vs-outcome bands.
8. **Leaks** — ranked by $ impact, each counterfactual; then the rules **tested and rejected**.
9. **You vs smart money** — two cohorts (Senpi: the proven cohort — top traders by all-time realized
   P&L with ≥ $1M — and the hot 30-day cohort; public fallback: the leaderboard's large live books). Per
   open position: your side, the cohort's side and headcount, the read (`WITH`, `WITH — BUT LATE (+6h)`,
   `AGAINST SMART MONEY`, `COHORT SPLIT`, `NO COHORT VIEW`); book-level agreement; their book by class vs
   yours; what they hold that you don't; what you hold that none of them do; your entry lag vs theirs.
10. **Market fit** — regime headline, funding across your coins, your stance and its daily funding
    cost, BTC trend; per position: trend, funding, open interest, fit.
11. **Where your edge actually is** — best setups (coin × side, hold bucket, entries before vs after the
    move) with wins/n and profit factor; the catalog families it maps to.
11b. **Live matches** — coins where the cohorts lean, the tape agrees, funding is not punitive and the
    setup fits how this trader wins, ranked and explained; "already moved today — a chase" is a demerit.
12. **What your quant would do next** — protect first · fix the biggest leak · keep the agents on.
12b. **Your quant is ready to go deeper** — three to five follow-ups from the bank of ten.

## Reading the sources (what to say when asked "where does this come from")

- **Public, any wallet:** fills and TWAP slices (`userFillsByTime`, `userTwapSliceFillsByTime`), funding
  payments, the wallet's own fee schedule and daily volume, the equity and P&L series, transfers, the
  live book and resting orders, hourly candles, Hyperliquid's leaderboard. No auth.
- **Coverage:** Hyperliquid keeps only the most recent TWAP slices, so a TWAP-heavy wallet's older
  executions are not returned. The desk measures the gap from the position jumps between consecutive
  fills (`startPosition` is the position before each fill) and prints the share of executed volume it
  could see; ledger figures (net P&L, equity, funding) are complete regardless.
- **With a Senpi token:** closed positions come from Senpi discovery (the complete stream, with
  leverage per trade); the proven cohort from Senpi's ALL_TIME realized-PnL ranking (≥ $1M realized, top
  100) and the hot cohort from the MONTHLY PnL ranking with open positions, both with position ages;
  Senpi's funding regime; and the Hyperfeed attention layer (where the top traders' gains sit, momentum
  events). Without one, the cohort is the largest profitable accounts on the public leaderboard, the read
  carries no entry timing, and the attention layer is absent.
- **Whale median:** `references/benchmark.json`, computed by `scripts/benchmark.py` — from Senpi discovery
  with a token (whales are TWAP-heavy, so the public endpoints cannot rebuild their round trips). The table
  renders only when the benchmark holds ≥ 5 members with ≥ 10 trades; until that file ships, the smart-money
  tab shows the per-position cohort reads alone.

## Mandatory closing (verbatim structure, after any full desk or `--section edge/next`)

1. **Protect first** — name the AT RISK / UNPROTECTED positions; a stop ladder is a signature on
   positions they already hold, not a deposit.
2. **Fix the biggest leak** — the top leak's title and its counterfactual $; the one-line fix.
3. **Keep the agents on** — "say *hire my quant* and senpi runs this desk on your book — risk guard,
   smart money, market regime, leak finder — and can code your best setup into a strategy you approve,
   deployed as **your** strategy" → `senpi-strategy-discover` (the template that matches the edge) or
   `senpi-strategy-author` (from scratch), then `senpi-strategy-ops`.

## Resilience

The engine fails open: every optional layer (rank, cohort, candles, Senpi) degrades to a line under
`Notes:`; the trade-level analysis needs only the public fills. An address with no perp activity in the
window and no open positions returns an error document — say "nothing to read here yet" and offer the
new-trader path (`senpi-strategy-discover`). A malformed address returns exit 2 with the reason.
Public-API rate limits (HTTP 429) are retried with backoff; a second run inside 10 minutes is served from
the cache (`--fresh` to refetch).

## Install — the whole `scripts/` directory is required

`desk.py` imports `hl_api.py`, `roundtrips.py`, `metrics.py`, `timing.py`, `market.py`, `smart_money.py`,
`senpi_history.py`, `score.py`, `render.py` and the vendored `mcp_client.py` (used only when
`SENPI_AUTH_TOKEN` is set). Stdlib only, Python ≥ 3.9. Fixture-driven tests in `tests/`.

## Skill attribution

This skill creates no strategy wallet and carries no attribution; strategies it hands off are attributed
by the skill that deploys them (`senpi-strategy-ops`).
