Skip to content

Commit 539fe61

Browse files
hihihhicodex
andcommitted
feat: add point-in-time market data catalog
Add an immutable SQLite-backed provenance catalog, a bounded read-only Polymarket Gamma adapter, CLI commands, adversarial tests, and V0.11 traceability updates. Co-Authored-By: Codex <noreply@openai.com>
1 parent c3a4d2a commit 539fe61

22 files changed

Lines changed: 2066 additions & 33 deletions

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@ QRAE is a local-first, human-gated quantitative research operating system. The r
44

55
## Current truth
66

7-
Source release candidate: `0.10.0`. Verify any hosted surface separately; a deployment timestamp or endpoint response never proves that the local research kernel ran.
7+
Source release candidate: `0.11.0`. Verify any hosted surface separately; a deployment timestamp or endpoint response never proves that the local research kernel ran.
88

99
Implemented and tested:
1010

1111
- strict, hash-bound research work orders;
1212
- point-in-time CSV price contracts and data-quality quarantine;
13+
- a durable SQLite point-in-time catalog with immutable hash-addressed raw/normalized objects, provenance, idempotency, tamper checks, and non-regressing latest pointers;
14+
- one bounded, unauthenticated, read-only Polymarket Gamma market-metadata adapter capped at `E0`;
1315
- a delayed-fill lagged-momentum baseline with registered entry/liquidation costs and chronological train/validation/test splits;
1416
- immutable run bundles, atomic latest pointers, and tamper-evident state logs;
1517
- metric/accounting recomputation, evidence ceilings, claim ledgers, decision records, compact reports, and knowledge records;
1618
- an optional local Codex broker with fixed tasks, an isolated read-only permission profile, bounded output, no state-promotion authority, and deterministic no-Codex fallback;
1719
- legacy read-only Vercel dashboard/API views; deployment content may lag this branch and is not execution evidence.
1820

19-
Not yet implemented: production market adapters, remote storage/batch adapters, walk-forward and nested model selection, event-driven replay, portfolio/risk engines, ML challengers, a complete Obsidian brain, allocator-grade report generation, authenticated web review, or any paper/live execution system.
21+
Not yet implemented: historical/streaming production market adapters, remote storage/batch adapters, walk-forward and nested model selection, event-driven replay, portfolio/risk engines, ML challengers, a complete Obsidian brain, allocator-grade report generation, authenticated web review, or any paper/live execution system.
2022

2123
The committed dashboard artifacts and legacy synthetic tournament are demonstrations, not evidence that those missing systems ran.
2224

@@ -36,6 +38,15 @@ python -m qrae.cli verify --run-dir .quantos/runs/<run-id>
3638

3739
The bundled dataset is synthetic and its work order is capped at `E0`. It proves mechanics and artifact integrity only.
3840

41+
Fetch and independently rehash one bounded public metadata snapshot:
42+
43+
```text
44+
python -m qrae.cli polymarket-fetch --catalog-root .quantos/catalog --request-id pm-YYYYMMDD-001 --limit 100
45+
python -m qrae.cli catalog-verify --catalog-root .quantos/catalog
46+
```
47+
48+
The adapter performs no trading, authentication, pagination, or historical reconstruction. “Observed at retrieval” data remains `E0` and cannot support a historical-alpha claim.
49+
3950
## Local Codex review
4051

4152
Codex is optional and never owns metrics or state transitions. Prepare a fixed review task from a verified run:
@@ -63,7 +74,7 @@ To invoke the locally authenticated Codex CLI, repeat with `--enable-codex`. The
6374
## Repository map
6475

6576
```text
66-
src/qrae/ deterministic contracts, kernel, state, artifacts, baseline, Codex broker
77+
src/qrae/ kernel plus PIT catalog, public-data adapter, and Codex broker
6778
tests/ positive and negative deterministic tests
6879
examples/price_baseline/ synthetic E0 work order and price fixture
6980
scripts/qrae_run_cycle.py compatibility wrapper for the local kernel

api/_qrae.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ function readJson(relativePath, fallback) {
1313
}
1414

1515
const runtimeConfig = readJson('configs/qrae_runtime.json', {});
16-
const VERSION = runtimeConfig.version || '0.10.0';
16+
const VERSION = runtimeConfig.version || '0.11.0';
1717
const GENERATED_AT = '2026-07-05T00:00:00.000Z';
1818

1919
const qraeRuntime = {
2020
system: 'QRAE-RD',
2121
version: VERSION,
22-
mode: runtimeConfig.mode || 'v0.10-local-first-e0-kernel',
22+
mode: runtimeConfig.mode || 'v0.11-local-first-e0-kernel-catalog',
2323
environment: process.env.QRAE_ENVIRONMENT || process.env.VERCEL_ENV || 'local',
2424
liveTradingEnabled: false,
2525
automatedLlmEnabled: false,

api/quality/gates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = function handler(req, res) {
44
if (!methodGuard(req, res)) return;
55
const gates = artifactJson('configs/qrae_quality_gates.json', {
66
system: 'QRAE-RD',
7-
version: '0.10.0',
7+
version: '0.11.0',
88
quality_guard_status: 'missing',
99
test_cases: [],
1010
fatal_failures: [],

api/requirements/traceability.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = function handler(req, res) {
44
if (!methodGuard(req, res)) return;
55
const traceability = artifactJson('configs/qrae_requirements_traceability.json', {
66
system: 'QRAE-RD',
7-
version: '0.10.0',
7+
version: '0.11.0',
88
traceability_status: 'missing',
99
requirements: [],
1010
});

api/trials/parallel-latest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = function handler(req, res) {
44
if (!methodGuard(req, res)) return;
55
const trial = artifactJson('configs/qrae_parallel_trial_001.json', {
66
system: 'QRAE-RD',
7-
version: '0.10.0',
7+
version: '0.11.0',
88
trial_id: 'missing',
99
instances: [],
1010
aggregate_feedback: {},

configs/qrae_parallel_trial_001.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"system": "QRAE-RD",
3-
"version": "0.10.0",
3+
"version": "0.11.0",
44
"trial_id": "parallel_trial_001",
55
"trial_mode": "three-instance-prod-orchestration-dry-run",
66
"generated_at": "2026-07-05T19:00:00Z",

configs/qrae_quality_gates.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"system": "QRAE-RD",
3-
"version": "0.10.0",
3+
"version": "0.11.0",
44
"quality_guard_status": "active",
55
"purpose": "Outcome-quality guardrail and test-case suite for QRAE-RD research outputs.",
66
"decision_labels": ["AUTO_REJECT", "AUTO_REVISE", "AUTO_DEEPEN", "HUMAN_REVIEW_REQUIRED", "PAPER_TRADE_CANDIDATE"],

configs/qrae_requirements_traceability.json

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"system": "QRAE-RD",
3-
"version": "0.10.0",
3+
"version": "0.11.0",
44
"traceability_status": "active",
55
"generated_from": "rebaselined against executable repository evidence on 2026-07-11",
66
"status_legend": {
@@ -302,13 +302,17 @@
302302
"id": "DATA-001",
303303
"area": "data_pipeline",
304304
"requirement": "Handle data downloading/fetching/pulling, cleansing, categorizing, labeling, validation, and storage/database access.",
305-
"status": "documented",
305+
"status": "partial",
306306
"implemented_in": [
307-
"docs/ARCHITECTURE.md",
308-
"api/cron/daily-research.js",
309-
"configs/qrae_runtime.json"
307+
"src/qrae/data_catalog.py",
308+
"src/qrae/polymarket.py",
309+
"tests/test_data_catalog.py",
310+
"tests/test_polymarket_adapter.py"
310311
],
311-
"notes": "V0 provides contracts, quality validator, and cron trigger shell. Durable DB/Blob persistence is V1 setup."
312+
"notes": "V0.11 implements one bounded read-only public metadata fetch, normalization, durable PIT catalog, and immutable object storage. Broader sources, labels, pagination, and production ingestion remain unimplemented.",
313+
"verification": [
314+
"python -m pytest -q tests/test_data_catalog.py tests/test_polymarket_adapter.py"
315+
]
312316
},
313317
{
314318
"id": "DATA-002",
@@ -329,11 +333,16 @@
329333
"id": "DATA-003",
330334
"area": "storage_policy",
331335
"requirement": "Use DB/object storage for artifacts and avoid putting heavy tick data in ChatGPT or ordinary Postgres rows.",
332-
"status": "documented",
336+
"status": "partial",
333337
"implemented_in": [
338+
"src/qrae/data_catalog.py",
339+
"tests/test_data_catalog.py",
334340
"docs/ARCHITECTURE.md"
335341
],
336-
"notes": "V0 stores artifacts in repo for deployability. V1 should move mutable data/artifacts to Postgres + Blob/S3/R2."
342+
"notes": "V0.11 separates SQLite metadata from immutable hash-addressed raw/normalized objects locally. Remote object storage and heavy tick-data tiers remain future work.",
343+
"verification": [
344+
"python -m pytest -q tests/test_data_catalog.py"
345+
]
337346
},
338347
{
339348
"id": "DATA-004",

configs/qrae_runtime.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"system": "qrae-rd",
3-
"version": "0.10.0",
4-
"mode": "v0.10-local-first-e0-kernel",
3+
"version": "0.11.0",
4+
"mode": "v0.11-local-first-e0-kernel-catalog",
55
"liveTradingEnabled": false,
66
"automatedLlmEnabled": false,
77
"directorModeWhenAutomated": "disabled",

docs/ARCHITECTURE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The current kernel implements one generic price-series baseline:
7474
8. create a claim ledger, decision proposal, knowledge record, report, manifest, and hash-chained state log;
7575
9. stop at `HUMAN_REVIEW` or fail closed at `QUARANTINED`.
7676

77-
This V0 slice is capped at E0 mechanics evidence. E1 remains blocked until authenticated provenance and a registered market adapter exist. It does not model realistic fills, capacity, borrow, funding, settlement, portfolio constraints, or market-specific events.
77+
The catalog slice adds SQLite metadata, immutable content-addressed raw/normalized objects, point-in-time resolution, provenance hashes, and a bounded read-only Polymarket Gamma metadata adapter. Because Gamma availability is only observed when fetched and API terms remain unverified, these snapshots are capped at E0. E1 still requires a licensed source with defensible historical availability timestamps plus a compatible backtest contract. No current slice models realistic fills, capacity, borrow, funding, settlement, portfolio constraints, or market-specific events.
7878

7979
## State machine
8080

@@ -101,8 +101,8 @@ Codex output is draft evidence with `requested_transition=NONE`. Disabled or una
101101

102102
## Planned planes
103103

104-
1. **Kernel:** typed contracts, SQLite catalog, budgets, retries, approvals, and recovery.
105-
2. **Data:** source registry; raw/normalized/feature layers; DuckDB/Polars/Parquet; point-in-time timestamps and licenses.
104+
1. **Kernel:** extend the initial SQLite catalog with budgets, retries, approvals, and recovery.
105+
2. **Data:** extend the first Gamma metadata adapter into a source registry; raw/normalized/feature layers; DuckDB/Polars/Parquet; licensed historical point-in-time timestamps.
106106
3. **Research:** hypothesis tournament, cheap falsification, WFO, replay, portfolio construction, independent replication.
107107
4. **Knowledge:** Obsidian-compatible objects, full-text search, typed provenance graph, negative results and lessons.
108108
5. **Model:** simple baselines before regularized, boosted-tree, neural, ensemble, and eventually simulator-gated RL challengers.

0 commit comments

Comments
 (0)