export_portfolio_dataset
Export an auditable portfolio dataset by freezing a local copy and paging through transactions, realized P&L, holdings, or NAV history as JSON or CSV.
Instructions
Freeze an auditable portfolio dataset locally, then return small pages.
Only for an explicit request to export, save or freeze a dataset. A dated portfolio value series is get_portfolio_returns(include_series=true), which stores nothing.
Transaction exports default to YTD (365 days with end_date alone); pass start_date (e.g. 2024-01-01) or period="ALL" for older history.
Writes only local dataset copies and never places orders or uploads data. First call (no dataset_id) captures normalized inputs through existing engine paths. Later calls supply dataset_id and next_cursor as cursor; they read only the frozen copy, with no provider/FX refetch. Returned manifest identifies the original dates and filters; replay does not reapply collection parameters. IDs are content hashes. The latest 20 datasets are retained; expired/unknown IDs return DATASET_EXPIRED and never silently rebuild. Start a new first call explicitly to collect changed inputs. Missing money stays null with a status.
JSON rows have record_type, row_id, data. CSV has those first two columns and data_json (canonical JSON preserving nested fields, null and statuses). Supporting holdings, cash, source coverage, cost FX, quantity breaks and NAV components are paged audit records. Manifest descriptors name their row types; read every page to reconstruct/hash the entire dataset. Totals sum frozen input money by type/currency; reporting summaries retain their stated period. Account IDs are opaque keyed hashes. Human account labels are retained only when already exposed, and raw broker payloads/credentials are excluded.
Args: dataset: transactions, realized_pnl, holdings, or nav_history period: reporting period (default YTD); explicit ISO dates override it start_date: ISO YYYY-MM-DD; realized inputs include earlier basis history end_date: ISO YYYY-MM-DD. Holdings export is current, not historic backfill dataset_id: frozen ID for replay; omit only for a new collection cursor: opaque next_cursor from the preceding page; requires dataset_id format: json or csv; both carry the same typed audit rows page_size: 1–200, additionally limited to 64 KiB of row data per page account: existing account filter; nav_history requires all accounts symbol: optional existing symbol filter; not applicable to nav_history input_snapshot_ids: nav_history only, exact E-store versions; bounds use their dates when no explicit dates are supplied
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | ||
| format | No | json | |
| period | No | YTD | |
| symbol | No | ||
| account | No | all | |
| dataset | Yes | ||
| end_date | No | ||
| page_size | No | ||
| dataset_id | No | ||
| start_date | No | ||
| input_snapshot_ids | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||