Files
quant-trading/web
Gahow Wang cd0721eada fix(backtest): settle delisted US holdings (engine v3), PIT membership before 2011, registry causality test
- execution/trader: a held US stock with no print for 5 sessions that has left
  the index is sold at its last print (execution.SETTLE_AFTER_SESSIONS), in both
  the batch replay and the live session ledger. Acquired names used to stay at
  their last mark forever: lowrisk_top20 ended 2017-12..2026-10 with 11 of 26
  dead positions, and CAGR rises 1.7-5.5pp once they settle. ENGINE_VERSION
  cash-ledger-pit-v3; the API cache key follows.
- universe_history: current members whose pre-2011 addition the Wikipedia change
  log missed now start at the list page's "Date added" (80 of 94 current members
  added 2001-2010 were open-start, e.g. ISRG, MA, BKNG). Membership from 2016 on
  is unchanged; the research panel cache now keys on the membership intervals.
- research/lab/registered: pure-ETF strategies replay on the ETF panel (they ran
  as all-cash books or crashed); prepare_strategy refuses an ETF strategy that
  lacks its ETF universe.
- research/lab/factors: trend_hzz uses a month's regression betas only from the
  session its forward returns end (short months read 1-2 sessions ahead).
- tests: every registered strategy (US and CN) is truncation-invariant on the
  production signal path; batch and live ledgers settle a delisting identically.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 00:21:49 -07:00
..

quant-trading web

Web UI and API for the quant-trading repository: strategy backtests and live books (via ../bridge.py), plus a personal watchlist agent.

统一个人股票监控 MVP,支持 A股、港股、美股自选股,按日生成监控报告。数据接口固定使用 IPADS Responses API,密钥从仓库根目录 .env 的 IPADS_API_KEY 读取。

Run

npm install
npm run dev

Frontend: http://127.0.0.1:5173

Backend: http://127.0.0.1:8787

LAN access:

HOST=0.0.0.0 CLIENT_PORT=5174 PORT=8787 npm run dev

Open http://gahow-pc.ipads-lab.se.sjtu.edu.cn:5174 from another device on the same network.

IPADS API

配置文件:

IPADS_API_KEY=your_api_key

固定服务端配置:

base_url = "http://tianx.ipads-lab.se.sjtu.edu.cn:8319/v1"
wire_api = "responses"
env_key = "IPADS_API_KEY"

The backend calls:

POST http://tianx.ipads-lab.se.sjtu.edu.cn:8319/v1/responses
Authorization: Bearer ${IPADS_API_KEY}

The response output text must be JSON matching the stock snapshot schema used by the agent. If IPADS_API_KEY is blank, the app uses deterministic demo data so the dashboard remains usable.

Features

  • Add/remove watchlist symbols such as 600519, 000001.SZ, 00700.HK, AAPL, MSFT.US.
  • Normalize symbols into A股、港股、美股 markets.
  • Generate a daily report with earnings timing, peer stocks, valuation discount/premium, related news, and buy-watch/hold/avoid recommendations.
  • Refreshes the cached daily report every 24 hours while the backend process is running.
  • View each watchlist stock with locally cached D/W/M/Y K-line chart data, zoom controls, MA5/MA20/MA60, RSI14, MACD, volume, and cached financial statements. US K-line and quote/research fields use Nasdaq as the fixed data source and target at least 5 years of verified daily OHLCV history when available.
  • Cache related market context such as sector, liquidity, volatility, drawdown, relative strength, capital flow, sentiment, and risk flags.
  • Run an agent-backed quantitative analysis across technical, valuation, growth, quality, liquidity, sentiment, and risk factors to classify each stock as buy-watch/hold/avoid.
  • Add tags to every watchlist stock and filter the watchlist by tag.
  • In configured provider mode, prompts require verified data and do not permit approximate or fabricated values; missing data is surfaced instead of being filled with synthetic values.
  • K-line cache updates incrementally: once 5 years of daily bars exist locally, refreshes request only the latest missing window and merge by date.

Local cache

Web state lives in the repo-level data/web/ (see src/server/paths.ts): watchlist.json, per-stock snapshot/K-line/financial data under cache/, and backtest results under strategy_cache/. The strategy page reads data/precomputed/backtest_results.json, written by precompute_backtest.py at the repo root.

Production runs as systemd services; see "Server Deployment" in the root CLAUDE.md.