SPB Git forge
1commits 1branches 0releases
189.0 KBsize
maindefault branch
4 h agolast push
Python 54.7% TypeScript 42.5% SQL 1.9%
2.2 KB · 39 lines markdown
Rendered Raw Blame History
1# ktrade web terminal (`apps/web`)23Next.js 16 (App Router, TypeScript), Tailwind CSS v4, TanStack Query, TradingView `lightweight-charts`.4Dark "trading terminal" UI for the ktrade API (`apps/api`). All data comes from the API; nothing is mocked.56## Commands78```bash9pnpm install10pnpm dev -p 8471                      # dev server (API must run on 127.0.0.1:8470)11pnpm lint && pnpm tsc --noEmit        # zero errors expected12pnpm build13pnpm next start -H 0.0.0.0 -p 8471    # production14```1516## Environment1718| Variable       | Default                  | Purpose                                                      |19|----------------|--------------------------|--------------------------------------------------------------|20| `API_UPSTREAM` | `http://127.0.0.1:8470`  | Where `/api/:path*` is rewritten to (read at build/start)    |21| `PORT`         | —                        | Use `-p 8471` on the `next start` command line instead       |2223`/api/*` is proxied by a Next.js rewrite (`next.config.ts`); Server-Sent Events (`/api/market/stream`) stream through it24without buffering (verified with `curl -N`), so no custom server is needed. Session cookie `ktrade_session` is checked for25presence by `src/proxy.ts` (Next 16 name for middleware); the API validates it on every call and the client redirects to26`/login` on 401 (`src/lib/api.ts`).2728## Pages2930`/login`, `/` overview, `/market` (candles + volume, live order book with checksum flag, trade tape, microstructure, data31quality), `/lab` (strategy catalog → parameter form generated from `ParamSpec`, cost model, holdout, walk-forward,32sensitivity), `/backtests` (+ compare up to 8 runs) and `/backtests/[id]` (metrics with bootstrap CI and deflated Sharpe,33equity vs benchmarks, underwater, rolling Sharpe, holdout, walk-forward, sensitivity heatmap, stress, shuffled trades,34ledger, rejected orders, provenance), `/portfolio` / `/paper` / `/execution` (Phase 3–5 placeholders; live tab locked),35`/risk` (limits, kill switch with confirmation, what-if evaluator, risk events, audit chain), `/reports` and36`/reports/[id]` (printable research report), `/settings` (credential status, preflight, balances, environment).3738Screenshots from a real session are in `screenshots/`.39