You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(outcome): add outcome view — symmetric Yes/No book + underlying gap
Outcome markets have a complementary Yes/No structure where Yes BID +
No ASK ≈ 1.0. Agents and humans need a single snapshot that exposes
both books plus directional context (current underlying mark vs the
binary's targetPrice) — not a multi-call combination of `book` +
`market mid`.
Adapter:
- HyperliquidOutcomeAdapter.getView(outcome, depth) fetches both sides'
books in parallel via Promise.all + a single allMids round-trip. From
allMids it derives:
- per-side mid + impliedProb
- midSum (deviation from 1.0 = arbitrage hint)
- underlying perp mid (parsed from description.underlying — currently
only HL native perps; HIP-3 dex perps not referenced by HIP-4 yet)
- gap = mark - target, gapPct, in-the-money side (priceBinary only)
- New OutcomeView / OutcomeViewSide / OutcomeViewUnderlying types in
outcome-interface.ts.
CLI:
- `perp outcome view <outcome> [--depth N=10]` (alias `status`)
- TTY: header (target / current / gap / inTheMoney / expiry / implied
probabilities) followed by stacked Yes/No book tables.
- JSON: full OutcomeView struct.
MCP:
- new tool `get_outcome_view` (public read, no API key).
- Total tools: 21 → 22.
Skill bundle:
- references/commands.md highlights `outcome view` as the preferred
agent entry point and shortens the recommended workflow from 6 steps
to 5 (drops the separate `market mid` lookup).
- SKILL.md MCP tool count + tool name list updated.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: skills/perp-cli/SKILL.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -320,7 +320,7 @@ When the user first sets up a wallet, ask:
320
320
321
321
## MCP Server
322
322
323
-
The package also ships a 21-tool MCP server (no API keys required for read-only market data — `get_markets`, `get_orderbook`, `get_funding_rates`, `get_prices`, `get_outcome_markets`, `get_outcome_book`, plus 15 account/advisor tools):
323
+
The package also ships a 22-tool MCP server (no API keys required for read-only market data — `get_markets`, `get_orderbook`, `get_funding_rates`, `get_prices`, `get_outcome_markets`, `get_outcome_view`, `get_outcome_book`, plus 15 account/advisor tools):
6. perp --json outcome positions # confirm fill / monitor
162
+
5. perp --json outcome positions # confirm fill / monitor
157
163
```
158
164
165
+
`outcome view` replaces the old multi-call pattern (separate `book` + `market mid` lookups). One round-trip returns everything an agent needs to decide direction.
166
+
159
167
Settlement at `expiryMs` is venue-side: winning side → 1 USDH per share, losing → 0. Decide before expiry whether to self-close or let the venue settle.
Copy file name to clipboardExpand all lines: src/mcp-server.ts
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -323,6 +323,28 @@ server.tool(
323
323
},
324
324
);
325
325
326
+
server.tool(
327
+
"get_outcome_view",
328
+
"Get a combined view of one outcome market: all sides' books in parallel + underlying mark price gap (vs targetPrice) + time to expiry + per-side implied probability (mid sum). For binary markets, the symmetric structure means Yes bid + No ask ≈ 1.0 — the view exposes both sides in a single round-trip and surfaces directional context (e.g., is BTC currently above the target). Public read.",
329
+
{
330
+
outcome: z.number().int().nonnegative().describe("Outcome id from outcomeMeta (e.g., 1 for the BTC binary daily)"),
331
+
depth: z.number().int().min(1).max(50).optional().default(10).describe("Number of book levels per side"),
0 commit comments