Focused quant research system for four AI compute value-chain stocks:
TSM: foundry and advanced packaging bottleneckNVDA: AI accelerator platform leaderAMD: second-source AI accelerator and server CPU challengerGOOGL: hyperscaler demand, cloud, search cash flow, and AI capex
The first version is deliberately a research system, not an auto-trading system.
- A DuckDB database at
data/duckdb/quant_learn.duckdb - Daily prices for core tickers and market benchmarks
- SEC filing metadata and selected XBRL facts
- TSMC monthly revenue from the official investor page
- Factor dashboard metrics: returns, volatility, drawdown, rolling beta, residual returns
- Event-study helpers for earnings, TSMC monthly revenue, and hyperscaler capex events
- Manual CSV import path for verified segment KPIs
- Event-level return windows and data-quality flags in
event_returns - Rule-based event review summaries in
event_reviews - SEC-derived segment KPI extraction for GOOGL/NVDA/AMD filing tables
- Flexible segment KPI layer with
segments_viewandsegment_features - Event data-quality markdown report
- PIT-safe
fundamentals_quarterly_normalizedsnapshots with cash-flow lineage cash_flow_featuresfor CapEx / OCF and FCF margin evidence- PIT three-factor residual model using
QQQ + SOXX + Δ10Y bps - PIT trailing valuation metrics and valuation features
evidence_cardssynthesized from event, segment, cash-flow, factor, and valuation layersresearch_stanceandreports/decision_memo.mdwith falsifiers and caveats- Stance audit tables and
reports/stance_audit_report.mdfor score contributions, confidence caps, and conflict flags - Audit-driven stance modifiers such as
factor_led,factor_conflicted,mixed_cash_flow,valuation_capped, anddata_quality_capped - Research auditability tools:
pipeline_runs, evidence/stance history tables, residual concentration diagnostics, andreports/weekly_digest.md - AI trusted-execution framework tracker with leading indicators,
falsifiable predictions, scenario weights, portfolio bands, and
reports/ai_execution_tracker.md
For the design rationale and table definitions, see docs/system_design.md.
For the current loophole audit, see docs/strategy_loopholes.md.
For the trusted-execution tracker workflow, see docs/ai_framework_tracker.md.
For the Phase 1 systematic-discretionary strategy workflow, see
docs/ai_strategy_system.md.
For the daily website refresh and GitHub Pages deployment workflow, see
docs/ai_framework_daily_automation.md.
For the public $1,000 paper-portfolio tracker, see docs/portfolio_tracker.md.
uv syncSet a real SEC user agent before hitting SEC endpoints:
export SEC_USER_AGENT="Your Name your.email@example.com"uv run python -m scripts.init_dbPrices:
uv run python -m scripts.ingest_prices --start 2018-01-01The price ingestion step also updates return_1d, return_5d, return_20d, and return_60d.
SEC facts and filings:
uv run python -m scripts.ingest_secTSMC monthly revenue:
uv run python -m scripts.ingest_tsmc_revenue --years 2018 2019 2020 2021 2022 2023 2024 2025 2026Manual events:
uv run python -m scripts.import_events data/manual/events_ai_compute.csv
uv run python -m scripts.import_event_impacts data/manual/event_impacts_ai_compute.csv
uv run python -m scripts.import_event_metrics data/manual/event_metrics_ai_compute.csv
uv run python -m scripts.build_event_returns --benchmarks QQQ SOXX SMH
uv run python -m scripts.build_event_reviews
uv run python -m scripts.build_event_data_quality_reportevents records the event itself, event_impacts records which stocks the event can
move, and event_metrics stores surprise/KPI evidence. event_returns is a
long-format attribution table keyed by event, affected ticker, return window,
and benchmark. event_reviews turns the event loop into readable review rows with
raw reaction, benchmark attribution, metric surprise, thesis impact, confidence,
and data-quality status.
Manual segment KPIs:
uv run python -m scripts.import_segments data/manual/segment_kpis_googl.csv
uv run python -m scripts.import_segments data/manual/segment_kpis_nvda.csv
uv run python -m scripts.import_segments data/manual/segment_kpis_amd.csv
uv run python -m scripts.import_segments data/manual/segment_kpis_tsm.csv
uv run python -m scripts.build_tsmc_segment_kpis --months 24
uv run python -m scripts.build_sec_segment_kpis --tickers GOOGL NVDA AMD --max-filings 16
uv run python -m scripts.build_company_segment_kpis --tickers GOOGL NVDA AMD --quarters 8
uv run python -m scripts.build_segment_features
uv run python -m scripts.build_segment_dashboardsegment_kpis is manual-first for company segment disclosures. TSMC monthly revenue is
bridged automatically from the official tsmc_monthly_revenue table. GOOGL/NVDA/AMD
segment rows can be extracted from official SEC filing tables with
build_sec_segment_kpis; review the exported CSV before treating any extracted value
as investment evidence. The split files under data/manual/segment_kpis_*.csv are the
versioned, reviewable seed set for the AI compute segment layer.
SEC-derived quarterly fundamentals and cash-flow features:
uv run python -m scripts.build_fundamentalsThis creates both fundamentals_quarterly_normalized and the legacy-compatible
fundamentals_quarterly export. Cash-flow fields are stored as YTD and derived
quarterly values; CapEx is normalized as a positive outflow and FCF is calculated
as operating_cash_flow_quarterly - capex_quarterly. Use available_date /
filed_date for point-in-time research.
DuckDB allows many readers but only one writer. Run ingestion scripts sequentially when writing to the same database file.
Generate a daily factor dashboard snapshot:
uv run python -m scripts.build_factor_dashboardGenerate PIT three-factor exposures, residuals, and factor-model event attribution inputs:
uv run python -m scripts.build_factor_model
uv run python -m scripts.build_event_returns --benchmarks QQQ SOXX SMH
uv run python -m scripts.build_event_reviewsbuild_factor_model uses QQQ, SOXX, and daily 10-year yield changes. With Yahoo
^TNX, the system normalizes ^TNX.diff() * 10 into basis points. Rolling exposures
use prior observations only: the exposure dated t is estimated from the window ending
at t-1, then applied to date t returns.
Generate evidence cards, research stance, and the decision memo:
uv run python -m scripts.build_valuation
uv run python -m scripts.build_evidencebuild_valuation creates PIT trailing valuation metrics and valuation features from
available fundamentals and prices. For TSM, where normalized ADR fundamentals are
incomplete, the system can use the latest valuation_snapshots row as a low-confidence
current-screening fallback and marks those features as snapshot_fallback.
evidence_cards converts event reviews, segment features, cash-flow features, factor
residuals, and valuation features into source-linked evidence rows. research_stance
turns those rows into a research stance with confidence caps, stance modifiers,
falsifiers, next catalysts, and data-quality caveats. It also writes stance audit tables
for component contribution, confidence-cap lineage, and explicit conflict flags.
build_evidence archives the prior evidence/stance/audit rows into history tables
before rebuilding, records a pipeline_runs row, adds a data_snapshot_hash to the
memo, and writes an ignored point-in-time memo copy under reports/history/. The
output is a research memo, not a buy/sell instruction.
Generate the weekly governance digest:
uv run python -m scripts.build_weekly_digestRun the analytics pipeline sequentially with freshness checks:
uv run python -m scripts.run_pipeline --fullIf you intentionally skip stale upstream steps, pass --force-stale; otherwise the
runner fails fast when core upstream tables are stale or empty.
Generate the visual research report:
uv run python -m scripts.build_visual_reportGenerate forward scenario estimates and an investability scorecard:
uv run python -m scripts.ingest_valuation
uv run python -m scripts.build_forward_analysisGenerate the AI trusted-execution tracker and decision system:
uv run python -m scripts.import_ai_framework
uv run python -m scripts.build_ai_framework_tracker
uv run python -m scripts.build_ai_strategy_signalsUpdate the public $1,000 portfolio tracker:
uv run python -m scripts.update_portfolioNotebook entry points:
notebooks/01_factor_dashboard.ipynb
notebooks/02_event_study.ipynb
Run event study:
uv run python -m scripts.run_event_study --event-type earnings --window-before 5 --window-after 20
uv run python -m scripts.run_event_study --event-type tsmc_monthly_revenue --window-before 1 --window-after 20
uv run python -m scripts.run_event_study --event-type hyperscaler_capex --window-before 1 --window-after 20Exports are written to data/exports/.
Weeks 1-2: Build the data base layer. Run price, SEC, TSMC, and manual KPI ingestion.
Weeks 3-4: Review factor dashboard outputs. Validate beta, residual return, drawdown, and correlation behavior.
Weeks 5-8: Build event logs for earnings, TSMC monthly revenue, and hyperscaler capex. Use event study outputs for repeatable post-event reviews.
Weeks 9-12: Add scoring. Treat scores as research priorities and risk flags, not buy/sell commands.