← Index
Source: docs/features/portfolio-and-market.md (auto-generated by scripts/generate-docs-html.mjs — edit the .md, not this file)

Portfolio & Market

Originally one merge task (below, historical); the two are now separate pages β€” Portfolio (/portfolio, βœ… done) and Market (/market, 🟑 in progress, Hyperliquid trading). This doc covers both.

Portfolio (/portfolio) β€” βœ… Done (2026-06-30)

Merged Investment Summary (/summary) and Portfolio (/dashboard) into one page with DB-backed persistence (Cloud SQL Postgres + Prisma; holdings keyed by user, survive refresh). Details in ../history/2026-06-30-rabbit-history.md.

Market (/market) β€” 🟑 In progress β€” Hyperliquid orderbook + trading

Canonical advanced implementation detail: Hyperliquid advanced market and trading β€” network-safe workspace, WebSocket lifecycle, typed data model, direct-signing and agent-wallet phases, validation rules, recovery behavior, tests, release gates. Use that page for new implementation work; this section is the decision log.

Status:

Latest product decision (2026-07-20, βœ… applied): default market is now ETH perp (was ETC). Build a simple Hyperliquid-backed HTS, prove direct MetaMask trading on testnet, then release a guarded mainnet direct-trading mode.

Design: server route proxies the Hyperliquid REST snapshot; render a compact L2 book above the index cards. Public API β†’ no key. lib/hyperliquid.ts + fetchL2Book; public app/api/orderbook (?coin=); app/market/OrderBook.tsx polls every 5s (asks/spread/bids, depth 8). Price formatter uses 5 significant figures (HL's rule) so sub-dollar ticks don't collapse. middleware.ts: /api/indices + /api/orderbook in PUBLIC_PATHS so the public /market page works logged-out.

Trading β€” auth model & phases (2026-07-07 research)

Hyperliquid auth is pure EIP-712 signatures β€” no API key, no registration; the account exists once funded.

July 21 request (jay): trade Hyperliquid perps on /market on testnet with a test account that already holds mock USDC (account in .env or similar) β€” placed above the ETH Perp info section; basic default inputs/buttons where no UI was specified. Delivered via TradePanel.tsx (see "Done" above).