T-57: M1.3b — trial_ledger + vault_evaluations append-only PostgreSQL migration (research track)
This commit is contained in:
parent
2ea7316af6
commit
5025286e49
8 changed files with 920 additions and 11 deletions
|
|
@ -86,6 +86,34 @@ Computed on any synchronous screen/experiment return matrix $M \in \mathbb{R}^{T
|
|||
- Physically fenced in `MarketDataStore` (`scope = 'vault_fenced'`), with `/export` disabled for `sb-research.*` tokens and campaign containers blocked from DB ports.
|
||||
- **One-shot human burn:** Triggered only on operator `Validated → Paper` action (`<= 10` evaluations/year enforced by an append-only `vault_evaluations` table). Requires Vault post-cost Sharpe $> 0.5$ and within $1.5\sigma$ of CPCV fold distribution.
|
||||
|
||||
### Vault Evaluations Schema (Append-Only)
|
||||
|
||||
Protected against `UPDATE`/`DELETE`/`TRUNCATE` by `reject_research_evidence_mutation()`. A `BEFORE INSERT` trigger forces `evaluated_at := now()` under a schema-scoped transaction advisory lock and rejects inserts once 10 evaluations exist in the rolling 1-year window (`evaluated_at > now() - interval '1 year'`), paired with a statement-level `AFTER INSERT` check so multi-row inserts cannot bypass the cap:
|
||||
|
||||
```sql
|
||||
CREATE TABLE IF NOT EXISTS vault_evaluations (
|
||||
evaluation_id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
evaluated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
principal_id TEXT NOT NULL
|
||||
CHECK (principal_id = 'operator'),
|
||||
strategy_ref TEXT NOT NULL
|
||||
CHECK (length(btrim(strategy_ref)) > 0),
|
||||
expression_hash CHAR(64) NOT NULL
|
||||
CHECK (expression_hash ~ '^[0-9a-f]{64}$'),
|
||||
vault_cutoff_date DATE NOT NULL,
|
||||
vault_start DATE NOT NULL,
|
||||
vault_end DATE NOT NULL,
|
||||
n_obs INTEGER NOT NULL
|
||||
CHECK (n_obs >= 2),
|
||||
sharpe_post_cost DOUBLE PRECISION NOT NULL
|
||||
CHECK (sharpe_post_cost <> 'NaN'::double precision AND sharpe_post_cost > '-Infinity'::double precision AND sharpe_post_cost < 'Infinity'::double precision),
|
||||
passed BOOLEAN NOT NULL,
|
||||
notes TEXT,
|
||||
CHECK (vault_start <= vault_end),
|
||||
CHECK (vault_start >= vault_cutoff_date)
|
||||
);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. IBKR Margin, USD/CAD, TSX Microstructure & Dual Drift Rules
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue