I'll create a comprehensive crypto & forex trading analytics dashboard. Let me start by exploring the project structure.
Let me examine the rest of the setup files.
I now understand the setup: React 19, Vite 7, Tailwind CSS 4, with a cn utility and @ alias. Let me build a polished trading analytics dashboard. I'll start by installing charting/icon libraries and setting up the foundation.
Foundation is set. Now let me create the data layer (types, realistic data generation, metrics), theme context, and chart theme hook.
Now the metrics engine, theme context, and chart theme hook.
I left some convoluted logic in getRange. Let me rewrite metrics.ts cleanly.
The data and theme layers are complete. Now let me build the UI primitives and shared components (Card, Badge, tooltip, Header, FilterBar, KPI cards).
Now the FilterBar (segment + date-range controls) and the KPI cards with sparklines.
Let me enhance the shared tooltip to support a couple more use cases, then build the charts.
Let me read the current state of the tooltip file to see what happened.
The edits got out of sync. Let me just rewrite the tooltip file cleanly.
Now the four charts — equity area, daily P&L bars, instrument P&L horizontal bars, and allocation donut.
Now the sortable, filterable, paginated trades table.
Now the main App.tsx that wires everything together with live-filtered state.
Let me refine the secondary stats strip to use a cleaner flex-wrap of tiles instead of a grid with empty cells.
Now let me build the project to verify everything compiles correctly.
The build succeeded. Let me harden the equity chart's Y-axis domain so it never collapses when a narrow range produces flat data.
Let me verify the equity chart file is correct after both edits.
Both edits are in place correctly. Let me run a final build to confirm everything compiles cleanly.
The build is clean and the dashboard is complete. Here's what I built — Apex · Crypto & Forex Trading Analytics:
Architecture
- Data layer (
src/lib/): A seeded RNG generates a realistic, stable dataset of ~330 trades across 8 crypto and 8 forex pairs over 150 days, with drifting prices, leverage, R-multiples, and open/closed positions. metrics.ts handles filtering, KPI computation, equity-series building, bucketing, and allocation roll-ups.
- Theme:
ThemeContext + useChartTheme hook drive a class-based dark mode (Tailwind v4 @custom-variant) with a no-flash inline script and persistence, plus theme-aware chart colors.
Features delivered
- KPI cards (Net P&L, Win Rate, Total Volume, Profit Factor) — each with a gradient icon, an inline sparkline, and a trend chip comparing to the previous equivalent period (delta shown as %, pp, or absolute).
- Mixed charts with hover tooltips & smooth transitions: a gradient equity area (line) chart, daily P&L bar chart, P&L-by-instrument horizontal bars, and an allocation donut with a centered total + legend. A shared, theme-aware
ChartTooltip powers all of them.
- Trade Ledger table — sortable on every column, with search, side/status filters, page-size control, and pagination.
- Live filters — segment pills (All / Crypto / Forex), date presets (7D/30D/90D/YTD/All), and custom date pickers. Every KPI, chart, stat tile, and table row recomputes instantly.
- Dark/light toggle, a live clock + pulsing "Live" indicator, and a fully responsive layout that collapses gracefully from 4-col KPIs down to mobile.
Visual style
Glassmorphic cards with subtle borders/shadows, ambient gradient backgrounds, Inter typography, emerald/rose semantics for wins/losses, staggered entrance animations, and hover micro-interactions throughout.
Everything builds successfully (dist/index.html, ~210 kB gzipped).
Files built: index.html, src/index.css, src/lib/format.ts, src/lib/random.ts, src/lib/types.ts, src/lib/data.ts, src/lib/metrics.ts, src/context/ThemeContext.tsx, src/hooks/useChartTheme.ts, src/components/ui/Card.tsx, src/components/ui/Badge.tsx, src/components/ChartTooltip.tsx, src/components/Header.tsx, src/components/FilterBar.tsx, src/components/KpiCard.tsx, src/components/charts/EquityChart.tsx, src/components/charts/DailyPnlChart.tsx, src/components/charts/InstrumentPnlChart.tsx, src/components/charts/AllocationDonut.tsx, src/components/TradesTable.tsx, src/App.tsx