P5-W2: Hyperliquid Analytics Pack — Gold datasets and dashboard endpoints#128
P5-W2: Hyperliquid Analytics Pack — Gold datasets and dashboard endpoints#128user1303836 merged 1 commit intomainfrom
Conversation
…s (P5-W2) Add Gold-tier hl_pnl_summary and hl_trade_history datasets materialized from Silver fills and funding, plus /v1/analytics/hl/trader and /v1/analytics/hl/market endpoints for dashboard-ready Hyperliquid performance analytics. Proves a Hyperliquid dashboard can consume Spectraplex outputs directly without raw chain parsing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: cd35feb7cb45
Remote Review — P5-W2: Hyperliquid Analytics PackReviewed the full diff against the eight review-focus items. Summary below. PnL Computation ✅
Trade Grouping ✅
Gold Layer Isolation ✅All new code is purely additive:
Auth and Scoping ✅Both analytics routes are inside the auth middleware layer. Tests No Wallet-Only Assumptions ✅
Migration Forward-Compatibility ✅Both tables use CSV Export ✅Column order matches struct field order. Both converters follow the existing pattern (manual Backward Compatibility ✅Three dedicated compat tests confirm wallet, P5-W1, and dataset endpoints remain routed. Queryable datasets: 8 → 10, Exportable datasets: 8 → 10. DatasetName enum: 9 → 11. All counts verified in tests. Non-blocking Notes
VerdictRemote review pass is clear. No blocking issues found. The PR is well-structured, tests are thorough, the PnL formula is correct, and the implementation is purely additive with no Silver/shared pollution. Ready to merge once CI completes green. |
Summary
Phase 5, Work Packet 2: Adds Gold-tier Hyperliquid analytics datasets and dashboard-ready endpoints, proving a Hyperliquid dashboard can consume Spectraplex outputs directly without raw chain parsing.
hl_pnl_summary(closed PnL + funding − fees) andhl_trade_history(open→close sequences with weighted avg entry price), materialized from Silverhl_fillsandhl_funding/v1/analytics/hl/traderand/v1/analytics/hl/marketfor dashboard-ready aggregations, behind auth20260310300000_add_hl_analytics_gold.sqlwithIF NOT EXISTSguards and proper indexesDatasetName::all()returns 11 datasets;QUERYABLE_DATASETSandEXPORTABLE_DATASETSeach contain 10 entries including the two new onesKey files
adapters/src/hl_analytics.rscore/src/materializer.rsadapters/src/v2_repo.rsapi/src/main.rs/v1/analytics/hl/traderand/v1/analytics/hl/marketroute handlersmigrations/20260310300000_add_hl_analytics_gold.sqlREADME.mdValidation
cargo fmt --all --checkcleancargo clippy --workspace --all-targets -- -D warningscleancargo build --release --workspacesucceedsnet_pnl = closed_pnl + funding - feesTest plan
cargo test --workspace)hl_analytics.rs/v1/analytics/hl/traderand/v1/analytics/hl/marketroute correctly behind auth🤖 Generated with Claude Code