Repository navigation
Data Contracts
This page records the seed-file import contracts, normalized table schemas and provenance rules. The private seed archive is supplied by the research owner and is never committed to this repository.
| Source | Raw file | Provider | Notes |
|---|---|---|---|
| S&P 500 history | sp500_1950_2018.csv |
OpenIntro / Yahoo Finance | Consume Date and Close as a price index (no dividend adjustment) |
| S&P 500 price index | SP500_FRED.csv |
FRED / S&P Dow Jones Indices | Accept observation_date/DATE + SP500; blank/dot means missing |
| Spot VIX | VIX_History.csv |
Cboe Global Markets |
DATE is MM/DD/YYYY; use CLOSE in index points; record OHLC inconsistencies |
| 12 industry portfolios | 12_Industry_Portfolios_daily_CSV.zip |
Kenneth R. French Data Library | Locate the Daily Average Value Weighted Returns block; read 12 industry columns |
| Financial Stress Index (optional) | ofr_fsi.csv |
Office of Financial Research | Separate context series; signed index level plus contribution fields |
-
OpenIntro: date
YYYY-MM-DD, close is a positive index level; extra OHLC/volume fields are read but only close feeds the analysis series. -
FRED: accepts
observation_dateorDATEplusSP500; blank/dot cells are missing; only observed positive closes are written; the supplied export has 96 blank cells (reported by the parser). -
Cboe:
DATEparsed as MM/DD/YYYY;CLOSEis the analysis input; rows whose reported high or low lies inside the range implied by the remaining OHLC fields are recorded as field-level inconsistencies (47 rows in the supplied snapshot) without rejecting the close. -
French: find the named value-weighted daily block inside the ZIP, stop at the block boundary,
parse
YYYYMMDDkeys, map-99.99and-999to null and divide percentage returns by 100 exactly once; the equal-weighted block stays in the raw archive. - OFR: keep separate from the market tables; publication lag and revisions are documented.
| Column | Unit | Rule |
|---|---|---|
date |
ISO YYYY-MM-DD
|
Observed market session date |
sp500_close |
index points | OpenIntro through 2018-12-07 inclusive, then observed FRED closes strictly after the cutover |
price_source |
string |
openintro or fred
|
sp500_log_return |
natural log return | ln(close_t / previous observed close); first row empty; no forward fill |
| Column | Unit | Rule |
|---|---|---|
date |
ISO date | 26,338 rows in the supplied snapshot |
ind_<code>_return (12 columns) |
decimal simple return | Percent divided by 100 once; missing sentinels null; no interpolation |
Industry codes: nodur, durbl, manuf, enrgy, chems, buseq, telcm, utils, shops,
hlth, money, other.
Sorted complete inner join on exact dates of date, sp500_close, sp500_log_return,
vix_close and the 12 industry returns. No forward fill, no synthetic weekend rows; a missing
observation stays missing (and its next return window is rebuilt). 9,250 rows in the supplied
snapshot.
Each import writes, under the local data directory:
-
raw_hashes.json/raw_hash_registry.json- original filename, source id, SHA-256, received metadata; -
parser_reports.jsonandreports/<source>.json- schema, units, row counts, observation ranges, missing counts and warnings per source; -
normalized/- the three canonical tables plus schema metadata; -
import_manifest.json/manifest.json- file hashes, normalized row counts, sources, snapshot id and schema version; the active snapshot pointer is replaced atomically only after validation.
- Reproduce 19,343
sp500_dailyrows and 9,250tda_dailyrows for the supplied snapshot. - 2018-11-29: OpenIntro and FRED disagree by more than 0.01 index point (2,737.800049 vs 2,737.76); the cutover rule is documented and the discrepancy retained in the audit.
- 2020-03-16: close 2,386.13, VIX 82.69, NoDur value-weighted return -0.0896.
- Re-importing the same bytes changes no logical table (identical normalized table hashes).
topomarket refresh keeps the same table contracts while updating them from fixed HTTPS providers:
- staged payloads are validated through the same adapters as
topomarket import(50 MiB per payload, ZIP member safety); -
sp500_daily: existing rows survive a shorter FRED export; FRED observations are accepted only strictly after the fixed 2018-12-07 OpenIntro cutover and log returns are recomputed over the merged series; -
industries_daily: replaced from the refreshed French archive; -
tda_daily: rebuilt as the complete inner join over the merged prices, VIX history and industry returns (9,250rows for the supplied snapshot; it must not shrink to the FRED export range); - changed overlapping observations produce revision records (
date,source_id,field,old_value,new_value,snapshot_id); - publication is atomic: a complete snapshot directory plus
state/active_snapshot.jsonpointer; failures leave the last good snapshot readable; request validators are committed only after a successful publish; - a single writer lock serializes concurrent refreshes.
See Refresh and recovery runbook for commands and recovery steps.
- Normalized CSVs use UTF-8, comma delimiters, decimal point and ISO dates; ordering is stable.
- Floating-point comparisons in tests use a documented tolerance (returns checked to 1e-9 or equivalent).
- The synthetic demo generator emits the same table schemas from seed 42 and marks every row and manifest as synthetic.