SPB Git

spb/wp40_uqo

Public MIT
12.4 KB

# docs/audit.md — Phase 0 audit (2026-11-02)

All facts below were measured on 2026-11-02 (America/Toronto) from the owner's laptop; raw probe outputs are in docs/evidence/ (per-node probe files, FinData OpenAPI snapshot). Nothing is assumed from older inventories.

# 1. UQO Research repository

  • Root: ~/Desktop/UQO/Recherche/Recherche-UQO/ — one directory per working paper, grouped by domain (immobilier/, finance/, economie/, ia/, methodes/, mathematiques/), each paper is its own git repository with origin = gitsrv:srv/git/wpN_uqo.git (spbgit on M1M32). Highest existing number: WP 39 (wp39_uqo.git, finance/invisible-balance-sheet, created 2026-11-02 morning). RAID is therefore WP 40, repository wp40_uqo.git (to be created on first push), directory finance/wp40_raid/ as requested by the charter.
  • Form standard: HARMONISATION.md — paper/main.tex with the \WP* macros, sections/titlepage.tex copied verbatim from _modele-working-paper/, natbib [authoryear,round,semicolon] + aer.bst, \WPdate = Month YYYY, latexmk Makefile, paper/main.pdf committed, data never committed, README with fixed section order (TL;DR, Status, What this paper does, Headline results, Layout, Quick start, Data, Methodology, Figures & tables, Limitations, Citation, Author, Notes).
  • Prior volatility research to build on (not to re-do): WP 12 finance/realized-volatility-horse-race (HAR family, GARCH/GJR/EGARCH/Realized GARCH, 25 assets, 5-min subsampled RV target, QLIKE/DM/MCS; Python, src/wp12), WP 6 intraday-volatility-connectedness (Diebold–Yilmaz on intraday FX/fixed income), WP 15 intraday-fragility, WP 39 invisible-balance-sheet (first FinData OS consumer: rate limiter, export caps, duplicate last session). Systems-paper precedents in the same repository: WP 33 TITAN-MoE (ia/titan-moe: raw logs under benchmarks/raw/, artifacts/manifest.json with SHA-256 per artifact, hypotheses with bootstrap CIs) and WP 30.
  • No existing CMake/C++ template in the repository: every prior WP is Python/LaTeX. RAID introduces the first C++/Metal build; it reuses only the LaTeX template, README standard and git conventions.
  • Git practice: main branch, commit messages in English, paper/main.pdf tracked, SSRN uploads tracked in _soumissions/.

# 2. FinData OS (mandatory data API) — live audit

  • Base https://findata.spboucher.ai/api/v1, OpenAPI 3.1 snapshot saved to docs/evidence/findata_openapi_2026-11-02.json (45 routes). /health → status: ok, Postgres ok, backup verified 9.6 h old, lake 564.65 GB curated / 303 GB free, cold root /Volumes/ssd/findata (2.98 TB free), SSD SMART verified.
  • Catalog: 64 active datasets. Relevant for RAID: market_bars.stock.1m.raw (6.70 G rows, 2000-01-03 → 2026-10-30, 16 195 symbols incl. -DELISTED), market_bars.etf.1m.raw (908 M rows), market_bars.stock.5m.raw (2.06 G), market_bars.stock.1d.raw (21 M), market_bars.index.1m.raw (204 M, 2008→), futures continuous/contracts, FX, crypto, options.eod (4.23 G rows), fundamentals.*. market_ticks = unsupported (vendor provides bars only): Tier C order-flow / Hawkes methods have no admissible input in this project.
  • Bars endpoint (GET /market/bars): interval ∈ {1m,5m,1d}, adjustment ∈ {raw,split,split_div}, format ∈ {json,arrow,csv}, limit default 5 000 (max 10 000), cursor pagination, version pin. Verified Arrow IPC stream response: content-type: application/vnd.apache.arrow.stream, headers x-dataset-id, x-dataset-version (5162 for ETF 1m), x-request-id; schema v1 with metadata findata.timestamp_convention = bar_open. SPY 2024-03-08 → 03-11 (DST weekend): 794 + 805 bars, first bar 09:00 UTC (= 04:00 EST) on 03-08, last bar 23:59 UTC (= 19:59 EDT) on 03-11: DST handled at the source; extended session 04:00–19:59 ET.
  • Sessions endpoint (GET /market/sessions): per-session bar_count vs expected_bars (391 regular; 211 on the 2024-11-29 early close, with extended bars until 16:59 that day). This is the calendar truth RAID must reproduce.
  • Exports (POST /exports → 202 → poll → download): SPY+QQQ 1m January 2024 = 34 607 rows, 0.65 MB Parquet, ready in 1.5 s, download 0.3 s; response records snapshot.version = 5162, files_scanned, bytes, row_count; Parquet key-value metadata carries the schema version and timestamp convention. SHA-256 of the file is recorded by RAID. WP 39 found: ≤ 12 years per export request (HTTP 413 beyond), last lake session may appear twice (base + delta layouts) → RAID deduplicates on (instrument_id, timestamp_utc) and reports it in the QualityReport.
  • Query playground (POST /query): one read-only statement, 30 s, ≤ 100 000 rows; views carry partition columns symbol, year; /query/views lists them. Used only for coverage/universe selection, never for bar transport.
  • Fundamentals (GET /fundamentals/{entity}?as_of=): PIT semantics documented; available_at = filing_date + 1 day is a proxy; no delisted entities (survivorship) — relevant only if a HAR-X design uses accounting covariates (not planned for the methods paper).
  • Rate limit: 600 req/min per key (no RateLimit-* headers exposed; WP 39 observed HTTP 429 with Retry-After). RAID client: token bucket ≤ 5 req/s, exponential backoff on 429/5xx, bounded concurrency (≤ 4), honours Retry-After.
  • License: FirstRate Data private use — no redistribution of raw bars; license_class = frd-private. Consequence: real-data experiment inputs live in an ignored cache (datasets/cache/), results/figures publish only aggregates; the repository ships synthetic fixtures only. Attribution "FirstRate Data via FinData OS" in the paper.
  • API key for this project: the owner's Claude Code key (~/Desktop/Cluster/secrets/findata/api-key-claude-code.txt, scopes read:market, read:fundamentals, query, export, admin). RAID never needs admin scope; a least-privilege key can be created later with findata create-key on M3U96a (the POST /admin/keys route returned 500 for WP 39).

# 3. Hardware and toolchains (measured)

# Laptop (primary development and benchmark machine)

Apple M5 Max, 18 CPU cores (6 P + 12 E as reported by hw.perflevel*), 40 GPU cores, 48 GB unified memory, macOS 27.0 (26A5425a), Xcode 27.2 (27B52), Apple clang 21.0.0, SDK 27.2, Metal 4, GPU families Apple1–Apple10, maxBufferLength 28 753 MB, recommendedMaxWorkingSetSize 38 338 MB, threadgroup max 1 024, SIMD width 32, unified memory. Metal Toolchain (offline metal/metallib, version 32023.922) was absent and was downloaded during the audit (xcodebuild -downloadComponent MetalToolchain). Runtime shader compilation (newLibraryWithSource:) works without it (34.6 ms for a trivial kernel, first compile). double is rejected by the Metal compiler (verified: "'double' is not supported in Metal") — all GPU numerics are FP32 (with compensated/pairwise reductions) and FP64 lives on the CPU. Disk 1.0 TB free. Load average 2.1 (27 days uptime). Tools: cmake 4.3.2, uv 0.11.7, Python 3.14.4 system / 3.12.13 for the project venv, R 4.6.1, pandoc 3.9, TeX Live 2026, Homebrew openblas 0.3.33, libomp 22.1.8, fmt 12.1. Installed for RAID during the audit: Homebrew eigen, apache-arrow, catch2, nlohmann-json, ninja (see docs/capabilities.md for versions once the install finished); R highfrequency 1.0.3, rugarch 1.5.6, xts 0.14.3; Python venv .venv (3.12): nanobind 3.1.0, numpy 2.5.4, pyarrow 26.0.0, arch 8.0.0, statsmodels 0.15.0, scipy 1.18.1, polars 2.1.0, duckdb 2.0.0, exchange-calendars 4.13.2.

# MacLustr nodes (probe 2026-11-02 14:1x ET, docs/evidence/nodes/*.txt)

22 of 29 nodes reachable over SSH; unreachable (timeout): m2m16, M2M32, M2M32b, M4M36, m4ma, m4mb, m4mc — excluded from any plan until they answer mld discover. All reachable nodes report Metal 4 and no thermal/performance warning.

Node Chip CPU GPU cores RAM macOS Xcode / CLT Load 1m Free disk PM2 apps Role for RAID
M1M32 M1 Max 10 24 32 26.5.1 Xcode 26.4.1 0.94 197 Gi gateway E7 generation point (M1), short runs only (gateway host)
M2M32c M2 Max 12 30 32 26.5.1 CLT 1.08 416 Gi 0 E7 (M2 Max)
M2U64 M2 Ultra 24 60 64 26.5 Xcode 26.6 1.17 315 Gi apps (spb-cloud, uqo-eval…) E7 (M2 Ultra), off-hours
M3BA24 / M3BA16 M3 8 10 24 / 16 26.5.1 CLT 1.1–1.3 409–420 Gi 0 E7 (M3 base, laptops)
M3U96a M3 Ultra 28 60 96 26.6 Xcode 26.6 5.96 281 Gi 17 (FinData OS host) not used for benchmarks (production FinData host, loaded)
M3U96b M3 Ultra 28 60 96 26.4 Xcode 26.6 1.80 395 Gi 8 E7 (M3 Ultra), largest-panel runs
M4M64a / M4M64b M4 Max 16 40 64 26.5.1 Xcode 26.6 1.2–1.5 540 / 54 Gi 10 / 11 avoid (agentd / Ka hosts; M4M64b low disk)
M4M64c M4 Max 16 40 64 26.4 CLT 1.94 318 Gi 0 E7 (M4 Max)
M4BP48 / M4BP36 M4 Max 16 / 14 40 / 32 48 / 36 26.5.1 CLT 1.2 843 Gi 0 E7 alternates
m4mm / m4mn M4 Pro 12 16 48 26.5.1 CLT 1.4–1.8 370 Gi 0 E7 (M4 Pro)
m4md / m4ml M4 10 10 16 26.6.2 / 26.7 CLT 1.6–1.8 180–195 Gi 0 E7 (M4 base, 16 GB memory-pressure case)
M5M36 M5 Max 18 32 36 27.0 CLT (SDK 27.0) 1.22 355 Gi 0 E7 (M5 Max, 32-core GPU variant)
m5ma M5 Pro 15 16 24 27.0 CLT 1.13 382 Gi 0 E7 (M5 Pro)
m6ma / m6mb M6 12 12 24 27.0 CLT 0.9–1.2 395 Gi 0 E7 (M6 base, newest generation)
m2m8a / m2m8b M2 8 10 8 26.5.1 CLT / none 1.5 196–425 Gi 0 8 GB memory-pressure stress (m2m8b has no developer tools → binary bundle only)

Observations that shape the plan: (i) most nodes have only the Command Line Tools and no Homebrew in the non-interactive SSH PATH (cmake/ninja/brew empty in the probe) → E7 ships a self-contained arm64 bundle (static Eigen, bundled .metallib + MSL source for runtime fallback, no Arrow dependency at run time) built on the laptop with -mmacosx-version-min=26.0; nothing is installed on the nodes; (ii) GPU core counts span 10 → 60, memory 8 → 96 GB: the generation sweep E7 covers M1 Max, M2 (base/Max/Ultra), M3 (base/Ultra), M4 (base/Pro/Max), M5 (Pro/Max), M6; (iii) M3U96a (FinData host, load 6) and M4M64a/b (Ka/agentd hosts) are excluded from timing runs.

# 4. Competing implementations (versions verified locally)

Software Version Role in RAID validation
R highfrequency 1.0.3 (Boudt, Kleen & Sjørup, JSS 2022) reference for RV, BPV, semivariance, realized quarticity, rCov, HAR (HARmodel), BNS jump test
R rugarch 1.5.6 (Ghalanos) reference for GARCH(1,1), GJR, EGARCH (Gaussian / Student-t) estimates, SE, forecasts
Python arch 8.0.0 (Sheppard) second GARCH reference; HAR via OLS; bootstrap (stationary/circular block)
Python statsmodels 0.15.0 OLS/WLS, HC0–HC3, HAC (Newey–West, Bartlett), cluster-robust covariance
NumPy / SciPy 2.5.4 / 1.18.1 FP64 reference linear algebra (QR/SVD/Cholesky), optimizers
Polars / DuckDB / pyarrow 2.1.0 / 2.0.0 / 26.0.0 columnar baselines for ingestion and rolling computations
Eigen (C++) Homebrew, see capabilities CPU backend dense algebra
Apple Accelerate macOS 27 BLAS/LAPACK (-framework Accelerate, ACCELERATE_NEW_LAPACK)
Julia not installed not used (listed in the charter; optional reference, not required for gates)

Mathematical equivalence is established per method in docs/methods/registry.md (Phase 4), with the exact option settings of each competitor (e.g. highfrequency::rBPCov uses the µ₁⁻² = π/2 constant and no finite-sample factor by default; rugarch uses variance targeting off and sample-variance initialisation unless told otherwise).

# 5. Licensing

  • RAID code: MIT. Dependencies: Eigen (MPL-2.0), Apache Arrow (Apache-2.0), nanobind (BSD-3), Catch2 (BSL-1.0), nlohmann/json (MIT), Accelerate and Metal (Apple proprietary system frameworks, linked, not redistributed).
  • Metal is proprietary: the GPU backend is optional (RAID_ENABLE_METAL), the CPU backend builds on Linux without it.
  • Data: FirstRate Data private-use via FinData OS — no raw bars in git, synthetic fixtures in CI, attribution in paper.
  • Reference software licenses do not affect RAID (used only to produce validation tables).
Files · f82ea5cc1b8ea301bc056ee35ba9c755df76f43f
Menu

Theme