feat(research): download validated retained datasets (RP07)
This commit is contained in:
parent
43ea2cc9b6
commit
b959779ada
14 changed files with 1076 additions and 11 deletions
|
|
@ -110,6 +110,51 @@ an unsaved settings draft does not change a run. Explicit discard, leaving this
|
|||
backtest and reloading do not provide persistent draft recovery. Save settings and
|
||||
resolve retention before leaving if you need to keep the work.
|
||||
|
||||
## Downloading a retained snapshot for local exploration
|
||||
|
||||
Choose **Download retained dataset** beneath a verified dataset in **Settings →
|
||||
Canonical research setup**, or beside a saved canonical result's **Immutable configuration
|
||||
and reporting policy**. The saved-result action uses that run's original dataset hash,
|
||||
even if the editable backtest now selects another dataset. Downloading neither saves
|
||||
settings nor starts a run.
|
||||
|
||||
The file is `dataset-<hash>.json`, containing the complete v2 `{manifest, bars}` snapshot.
|
||||
The API validates retained content and identity before returning it; timestamps,
|
||||
availability delays, source ordinals, null values and any parent hash are preserved.
|
||||
This is identical dataset content, not a promise of original JSON formatting. The
|
||||
manifest hash is the canonical dataset identity, not a checksum of downloaded file bytes.
|
||||
|
||||
Open the file in VS Code or a notebook, or give it to your local AI exploration tools.
|
||||
For a quick TypeScript inspection with Bun:
|
||||
|
||||
```ts
|
||||
const dataset = await Bun.file('/path/to/dataset-<hash>.json').json();
|
||||
console.log(dataset.manifest);
|
||||
console.table(dataset.bars.slice(0, 5));
|
||||
```
|
||||
|
||||
Treat this as inspection of frozen observations, not validation of a trading hypothesis.
|
||||
When testing features, respect each bar's `availableAt`; the file includes the entire
|
||||
historical range, including observations unavailable to an earlier decision.
|
||||
|
||||
To retain the same file in another initialized research database, set
|
||||
`RESEARCH_DATASET_DATABASE_URL` explicitly to that database and use the existing importer:
|
||||
|
||||
```sh
|
||||
bun run scripts/import-research-dataset.ts --file '/path/to/dataset-<hash>.json'
|
||||
```
|
||||
|
||||
The importer validates the full snapshot and repeats safely for an already retained hash.
|
||||
This file is distinct from the source-input JSON accepted by **Prepare dataset from source
|
||||
export**; use the importer for the complete retained snapshot.
|
||||
|
||||
Export supports the existing eligible single-asset canonical dataset selection. Missing,
|
||||
corrupt and unsupported snapshots return an error instead of a file. A failed download
|
||||
offers **Retry dataset download**; changing the selected hash cancels the pending action.
|
||||
The endpoint is `GET /api/v2/datasets/canonical/:hash/export`, using existing read, operator,
|
||||
service or browser-session access. Research-agent tokens remain unable to call dataset
|
||||
routes; a user can supply the downloaded file to local tools explicitly.
|
||||
|
||||
## Verification
|
||||
|
||||
`bun run check` includes complete-range reads without row caps, acceptance beyond the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue