ZipLime commited on
Commit
de2ca63
·
verified ·
1 Parent(s): 25867ee

Add ziplime PIT dataset: docs, manifest, recipe, ingest, workflow, bundle

Browse files
.gitattributes CHANGED
@@ -1,60 +1,2 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.avro filter=lfs diff=lfs merge=lfs -text
4
- *.bin filter=lfs diff=lfs merge=lfs -text
5
- *.bz2 filter=lfs diff=lfs merge=lfs -text
6
- *.ckpt filter=lfs diff=lfs merge=lfs -text
7
- *.ftz filter=lfs diff=lfs merge=lfs -text
8
- *.gz filter=lfs diff=lfs merge=lfs -text
9
- *.h5 filter=lfs diff=lfs merge=lfs -text
10
- *.joblib filter=lfs diff=lfs merge=lfs -text
11
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
- *.lz4 filter=lfs diff=lfs merge=lfs -text
13
- *.mds filter=lfs diff=lfs merge=lfs -text
14
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
15
- *.model filter=lfs diff=lfs merge=lfs -text
16
- *.msgpack filter=lfs diff=lfs merge=lfs -text
17
- *.npy filter=lfs diff=lfs merge=lfs -text
18
- *.npz filter=lfs diff=lfs merge=lfs -text
19
- *.onnx filter=lfs diff=lfs merge=lfs -text
20
- *.ot filter=lfs diff=lfs merge=lfs -text
21
  *.parquet filter=lfs diff=lfs merge=lfs -text
22
- *.pb filter=lfs diff=lfs merge=lfs -text
23
- *.pickle filter=lfs diff=lfs merge=lfs -text
24
- *.pkl filter=lfs diff=lfs merge=lfs -text
25
- *.pt filter=lfs diff=lfs merge=lfs -text
26
- *.pth filter=lfs diff=lfs merge=lfs -text
27
- *.rar filter=lfs diff=lfs merge=lfs -text
28
- *.safetensors filter=lfs diff=lfs merge=lfs -text
29
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
30
- *.tar.* filter=lfs diff=lfs merge=lfs -text
31
- *.tar filter=lfs diff=lfs merge=lfs -text
32
- *.tflite filter=lfs diff=lfs merge=lfs -text
33
- *.tgz filter=lfs diff=lfs merge=lfs -text
34
- *.wasm filter=lfs diff=lfs merge=lfs -text
35
- *.xz filter=lfs diff=lfs merge=lfs -text
36
- *.zip filter=lfs diff=lfs merge=lfs -text
37
- *.zst filter=lfs diff=lfs merge=lfs -text
38
- *tfevents* filter=lfs diff=lfs merge=lfs -text
39
- # Audio files - uncompressed
40
- *.pcm filter=lfs diff=lfs merge=lfs -text
41
- *.sam filter=lfs diff=lfs merge=lfs -text
42
- *.raw filter=lfs diff=lfs merge=lfs -text
43
- # Audio files - compressed
44
- *.aac filter=lfs diff=lfs merge=lfs -text
45
- *.flac filter=lfs diff=lfs merge=lfs -text
46
- *.mp3 filter=lfs diff=lfs merge=lfs -text
47
- *.ogg filter=lfs diff=lfs merge=lfs -text
48
- *.wav filter=lfs diff=lfs merge=lfs -text
49
- # Image files - uncompressed
50
- *.bmp filter=lfs diff=lfs merge=lfs -text
51
- *.gif filter=lfs diff=lfs merge=lfs -text
52
- *.png filter=lfs diff=lfs merge=lfs -text
53
- *.tiff filter=lfs diff=lfs merge=lfs -text
54
- # Image files - compressed
55
- *.jpg filter=lfs diff=lfs merge=lfs -text
56
- *.jpeg filter=lfs diff=lfs merge=lfs -text
57
- *.webp filter=lfs diff=lfs merge=lfs -text
58
- # Video files - compressed
59
- *.mp4 filter=lfs diff=lfs merge=lfs -text
60
- *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  *.parquet filter=lfs diff=lfs merge=lfs -text
2
+ data.delta/** filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/update.yml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: update-macro-indicators
2
+
3
+ # daily, ingesting new releases and revision vintages
4
+ on:
5
+ schedule:
6
+ - cron: "0 7 * * *"
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ ingest:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ with:
15
+ lfs: true
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.12"
19
+ - run: pip install polars deltalake httpx huggingface_hub
20
+ - name: Fetch + append (PIT, append-only)
21
+ run: python ingest.py --since "$(date -u -d '14 days ago' +%F)"
22
+ - name: Push updated bundle
23
+ env:
24
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
25
+ run: |
26
+ huggingface-cli upload --repo-type dataset \
27
+ ZipLime/macro-indicators data/ data/ --token "$HF_TOKEN"
README.md ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ language:
4
+ - en
5
+ pretty_name: Macro Indicators — Vintage / PIT (FRED-style)
6
+ tags:
7
+ - point-in-time
8
+ - pit
9
+ - ziplime
10
+ - backtesting
11
+ - alternative-data
12
+ - finance
13
+ - macro
14
+ task_categories:
15
+ - time-series-forecasting
16
+ size_categories:
17
+ - n<1K
18
+ configs:
19
+ - config_name: default
20
+ data_files:
21
+ - split: train
22
+ path: data/data_bundle/**/*.parquet
23
+ ---
24
+
25
+ # 📊 Macro Indicators — Vintage / PIT (FRED-style)
26
+
27
+ Macroeconomic time series with release vintages preserved — every revision is a point-in-time row, so backtests see the number that was actually published, not the latest revision.
28
+
29
+ Part of the **ziplime Point-in-Time (PIT) data layer** — append-only datasets with an
30
+ explicit split between when a fact *happened* (`event_date`) and when it became *known*
31
+ (`knowledge_date`). A simulation at time **T** can only ever observe rows with
32
+ `knowledge_date <= T`, so restatements, publication lag and hindsight can't leak into a
33
+ backtest. The identical code path runs live with **T = now**.
34
+
35
+ - **Data class:** Alternative data — macro series
36
+ - **Entity domain:** `macro` — A macro series code (e.g. `GDPC1`, `UNRATE`) — not an issuer.
37
+ - **Origin:** FRED / ALFRED vintages and national statistical agencies
38
+ - **License:** FRED terms — mixed upstream sources
39
+ - **Update cadence:** daily, ingesting new releases and revision vintages (`0 7 * * *`)
40
+ - **Format:** ziplime Delta Lake bundle (`data_type: PIT_DATA`)
41
+
42
+ ## Why point-in-time?
43
+
44
+ Backtests on non-price data are systematically optimistic when the data layer has no notion
45
+ of *when a fact became known*. Three failure modes this dataset is built to avoid:
46
+
47
+ 1. **Restatements** — a value reported one quarter and revised the next. Storing only the
48
+ final value lets a backtest "know" the revision months early.
49
+ 2. **Publication lag** — fundamentals keyed by fiscal-period-end, joined to prices at
50
+ period end rather than the (weeks-later) filing date.
51
+ 3. **Hindsight in derived signals** — a recent model scoring old text has already seen how
52
+ the story ended.
53
+
54
+ All three are the same bug, and it is fixed in the data layer, not in strategy code.
55
+
56
+ ## Schema
57
+
58
+ ### System columns (every PIT dataset)
59
+
60
+ | Column | Type | Semantics |
61
+ |---|---|---|
62
+ | `entity_id` | Utf8 | Stable entity identifier (resolved via the `entity_map` PIT dataset) |
63
+ | `event_date` | Timestamp(UTC, µs) | The moment the fact refers to |
64
+ | `knowledge_date` | Timestamp(UTC, µs) | The moment it became publicly known — **the only column the as-of filter uses** |
65
+ | `knowledge_estimated` | Boolean | `true` if `knowledge_date` was reconstructed by a lag model rather than taken from the source |
66
+ | `ingested_at` | Timestamp(UTC, µs) | When our pipeline wrote the row (audit only; never used in as-of) |
67
+
68
+ ### Value columns (this dataset)
69
+
70
+ | Column | Type | Description |
71
+ |---|---|---|
72
+ | `series_value` | Float64 | Value for the period, as published in this vintage |
73
+ | `unit` | Utf8 | Unit of measure |
74
+ | `native_frequency` | Utf8 | `D` / `W` / `M` / `Q` |
75
+ | `release_kind` | Utf8 | `initial` or `revision` |
76
+
77
+ The logical key of a fact is `(entity_id, event_date)`. A **revision** is a new row with the
78
+ same key and a later `knowledge_date`. Written rows are immutable; history is never rewritten.
79
+
80
+ ## As-of access
81
+
82
+ Inside a ziplime strategy there is **no `T` parameter** — the knowledge moment always equals
83
+ the simulation clock (live: wall clock):
84
+
85
+ ```python
86
+ async def initialize(context):
87
+ context.ds = await context.pit("macro-indicators")
88
+
89
+ async def handle_data(context, data):
90
+ # only rows with knowledge_date <= current simulation time are visible
91
+ latest = await context.ds.latest(
92
+ assets=[context.asset], fields=['series_value', 'unit']
93
+ )
94
+ history = await context.ds.as_of(
95
+ assets=[context.asset], fields=['series_value'],
96
+ event_range=("2022-01-01", None),
97
+ )
98
+ ```
99
+
100
+ ### Reading it outside ziplime (plain Polars + delta-rs)
101
+
102
+ ```python
103
+ import polars as pl
104
+
105
+ T = "2025-06-01T00:00:00Z" # "what was known at T"
106
+ lf = pl.scan_delta("hf://datasets/ZipLime/macro-indicators/data/data_bundle/yahoo_finance_daily_data/1784755946/data.delta")
107
+ as_of = (
108
+ lf.filter(pl.col("knowledge_date") <= T)
109
+ .sort("knowledge_date")
110
+ .group_by(["entity_id", "event_date"], maintain_order=True)
111
+ .last()
112
+ )
113
+ print(as_of.collect())
114
+ ```
115
+
116
+ Delta time-travel (`AS OF <version>`) pins the table for reproducibility; the
117
+ `knowledge_date <= T` filter is what enforces point-in-time. They compose: a backtest records
118
+ `(dataset, delta_version)` and replays read the table at that version *and* apply the filter.
119
+
120
+ ## Updates
121
+
122
+ `recipe.py` implements the collection contract `fetch(since: datetime) -> pl.DataFrame` in the
123
+ PIT schema above; `ingest.py` dedups and **appends** to the Delta bundle (never rewrites).
124
+ The scheduled job in `.github/workflows/update.yml` runs it daily, ingesting new releases and revision vintages.
125
+
126
+ ```python
127
+ # recipe.py (contract)
128
+ async def fetch(since: datetime) -> "pl.DataFrame": ...
129
+ ```
130
+
131
+ ## Knowledge-date convention
132
+
133
+ `knowledge_date` = the release timestamp of that vintage. Macro data is the textbook revision case: an initial GDP print and its later revisions share `(entity_id, event_date)` but differ in `knowledge_date`. `as_of(T)` returns the vintage that was actually on the wire at T — the number a strategy could have traded on — not the revised figure that only exists today.
134
+
135
+ ## What's in this repo
136
+
137
+ ```
138
+ README.md # this card
139
+ manifest.json # PIT dataset manifest (schema, source, schedule)
140
+ recipe.py # fetch(since) -> PIT rows
141
+ ingest.py # dedup + append-only Delta writer
142
+ .github/workflows/update.yml # scheduled ingestion
143
+ data/ # ziplime Delta bundle + registry manifest
144
+ bundle_registry/yahoo_finance_daily_data_1784755946.json
145
+ data_bundle/yahoo_finance_daily_data/1784755946/data.delta/
146
+ ```
147
+
148
+ The `data/` bundle is a ready-to-load ziplime Delta Lake market-data bundle (five US equity
149
+ tickers, daily bars) that seeds the pipeline and lets you exercise the loader end-to-end
150
+ today. Point `pl.scan_delta` (above) at it, or register it with ziplime's
151
+ `FileSystemBundleRegistry`.
152
+
153
+ ---
154
+
155
+ <sub>Generated for the ziplime PIT data-layer prototype. Manifest and schema follow the
156
+ ziplime PIT spec; `source.*` fields declare origin and license per the dataset manifest.</sub>
__pycache__/ingest.cpython-312.pyc ADDED
Binary file (3.59 kB). View file
 
__pycache__/recipe.cpython-312.pyc ADDED
Binary file (2.07 kB). View file
 
data/bundle_registry/yahoo_finance_daily_data_1784755946.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "yahoo_finance_daily_data",
3
+ "version": "1784755946",
4
+ "bundle_storage_class": "ziplime.data.services.file_system_delta_lake_bundle_storage.FileSystemDeltaLakeBundleStorage",
5
+ "bundle_storage_data": {
6
+ "base_data_path": "/Users/vyacheslav/.ziplime/data"
7
+ },
8
+ "trading_calendar_name": "XNYS",
9
+ "frequency_seconds": 86400.0,
10
+ "frequency_text": null,
11
+ "timestamp": "2026-07-22T17:32:32Z",
12
+ "data_type": "MARKET_DATA"
13
+ }
data/data_bundle/yahoo_finance_daily_data/1784755946/data.delta/_delta_log/00000000000000000000.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {"commitInfo":{"timestamp":1784755953145,"operation":"WRITE","operationParameters":{"mode":"ErrorIfExists"},"engineInfo":"delta-rs:py-1.6.2","operationMetrics":{"execution_time_ms":11,"num_added_files":1,"num_added_rows":825,"num_partitions":0,"num_removed_files":0},"clientVersion":"delta-rs.py-1.6.2"}}
2
+ {"protocol":{"minReaderVersion":1,"minWriterVersion":2}}
3
+ {"metaData":{"id":"3ddbf1f1-f8a3-4e40-a0be-751151e72bc4","name":null,"description":null,"format":{"provider":"parquet","options":{}},"schemaString":"{\"type\":\"struct\",\"fields\":[{\"name\":\"date\",\"type\":\"timestamp\",\"nullable\":true,\"metadata\":{}},{\"name\":\"open\",\"type\":\"double\",\"nullable\":true,\"metadata\":{}},{\"name\":\"high\",\"type\":\"double\",\"nullable\":true,\"metadata\":{}},{\"name\":\"low\",\"type\":\"double\",\"nullable\":true,\"metadata\":{}},{\"name\":\"close\",\"type\":\"double\",\"nullable\":true,\"metadata\":{}},{\"name\":\"volume\",\"type\":\"double\",\"nullable\":true,\"metadata\":{}},{\"name\":\"symbol\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"mic\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"price\",\"type\":\"double\",\"nullable\":true,\"metadata\":{}},{\"name\":\"sid\",\"type\":\"long\",\"nullable\":true,\"metadata\":{}},{\"name\":\"backfilled\",\"type\":\"boolean\",\"nullable\":true,\"metadata\":{}}]}","partitionColumns":[],"createdTime":1784755953134,"configuration":{}}}
4
+ {"add":{"path":"part-00000-d6922c4e-1b91-4a1a-b856-d849d69a8f52-c000.snappy.parquet","partitionValues":{},"size":44249,"modificationTime":1784755953145,"dataChange":true,"stats":"{\"numRecords\":825,\"minValues\":{\"low\":82.11000061035156,\"close\":82.83999633789062,\"mic\":\"XNMS\",\"sid\":4470,\"volume\":6743500.0,\"symbol\":\"AAPL\",\"backfilled\":false,\"high\":84.48899841308594,\"open\":82.78500366210938,\"date\":\"2025-01-02T05:00:00Z\",\"price\":82.83999633789062},\"maxValues\":{\"close\":787.419189453125,\"date\":\"2025-08-29T04:00:00Z\",\"price\":787.419189453125,\"symbol\":\"NFLX\",\"sid\":10977,\"backfilled\":false,\"mic\":\"XNMS\",\"low\":778.269228256533,\"volume\":184395900.0,\"high\":793.6488143059948,\"open\":788.5653976304532},\"nullCount\":{\"open\":0,\"sid\":0,\"volume\":0,\"symbol\":0,\"backfilled\":0,\"date\":0,\"price\":0,\"close\":0,\"mic\":0,\"low\":0,\"high\":0}}","tags":null,"baseRowId":null,"defaultRowCommitVersion":null,"clusteringProvider":null}}
data/data_bundle/yahoo_finance_daily_data/1784755946/data.delta/part-00000-d6922c4e-1b91-4a1a-b856-d849d69a8f52-c000.snappy.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45bd396c116f8b9ff35650c9fc88b4dd30465e2421b1ac8f91456310a56513e9
3
+ size 44249
ingest.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Shared append-only ingest harness for a ziplime PIT dataset.
3
+
4
+ Reads `recipe.fetch(since)`, stamps `ingested_at`, drops byte-identical duplicates of
5
+ existing (entity_id, event_date, knowledge_date) rows, and **appends** to the Delta table.
6
+ It never issues UPDATE/DELETE/MERGE — append-only is the PIT invariant the linter enforces.
7
+ """
8
+ from __future__ import annotations
9
+ import argparse, hashlib
10
+ from datetime import datetime, timezone
11
+ from pathlib import Path
12
+
13
+ import polars as pl
14
+ from deltalake import DeltaTable, write_deltalake
15
+
16
+ import recipe
17
+
18
+ TABLE_URI = str(Path(__file__).parent / "data" / "data_bundle" /
19
+ "yahoo_finance_daily_data" / "1784755946" / "data.delta")
20
+
21
+
22
+ def _row_hash(df: pl.DataFrame) -> pl.Series:
23
+ cols = [c for c in df.columns if c != "ingested_at"]
24
+ return df.select(cols).hash_rows().cast(pl.Utf8)
25
+
26
+
27
+ async def main(since: datetime) -> None:
28
+ fresh = await recipe.fetch(since)
29
+ if fresh.is_empty():
30
+ print("recipe returned no rows; nothing to append")
31
+ return
32
+
33
+ fresh = fresh.with_columns(
34
+ pl.lit(datetime.now(timezone.utc)).alias("ingested_at"),
35
+ )
36
+
37
+ try:
38
+ existing = pl.from_arrow(DeltaTable(TABLE_URI).to_pyarrow_table())
39
+ seen = set(_row_hash(existing).to_list())
40
+ fresh = fresh.filter(~_row_hash(fresh).is_in(seen))
41
+ except Exception:
42
+ pass # first ingest / fresh table
43
+
44
+ if fresh.is_empty():
45
+ print("no new or revised rows after dedup")
46
+ return
47
+
48
+ write_deltalake(TABLE_URI, fresh.to_arrow(), mode="append")
49
+ print(f"appended {len(fresh)} rows to {TABLE_URI}")
50
+
51
+
52
+ if __name__ == "__main__":
53
+ ap = argparse.ArgumentParser()
54
+ ap.add_argument("--since", default="2025-01-01")
55
+ args = ap.parse_args()
56
+ import asyncio
57
+ asyncio.run(main(datetime.fromisoformat(args.since).replace(tzinfo=timezone.utc)))
manifest.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "macro_indicators",
3
+ "version": "1784755946",
4
+ "data_type": "PIT_DATA",
5
+ "bundle_storage_class": "ziplime.data.services.file_system_delta_lake_bundle_storage.FileSystemDeltaLakeBundleStorage",
6
+ "bundle_storage_data": {
7
+ "table_uri": "data/data_bundle/yahoo_finance_daily_data/1784755946/data.delta"
8
+ },
9
+ "entity_domain": "macro",
10
+ "schema": {
11
+ "series_value": "Float64",
12
+ "unit": "Utf8",
13
+ "native_frequency": "Utf8",
14
+ "release_kind": "Utf8"
15
+ },
16
+ "pit": {
17
+ "knowledge_lag_model": null,
18
+ "model_knowledge_cutoff": null
19
+ },
20
+ "source": {
21
+ "recipe": "recipe.py",
22
+ "recipe_hash": "sha256:<filled-by-ci>",
23
+ "origin": "FRED / ALFRED vintages and national statistical agencies",
24
+ "license": "FRED terms — mixed upstream sources",
25
+ "schedule": "0 7 * * *"
26
+ },
27
+ "trading_calendar_name": null,
28
+ "frequency_seconds": null
29
+ }
recipe.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Macro Indicators — Vintage / PIT (FRED-style) — collection recipe.
3
+
4
+ Contract (ziplime PIT recipe, design doc §9):
5
+
6
+ async def fetch(since: datetime) -> pl.DataFrame
7
+
8
+ Returns rows in the PIT schema for `macro-indicators`:
9
+ system: entity_id, event_date, knowledge_date, knowledge_estimated
10
+ values: series_value, unit, native_frequency, release_kind
11
+
12
+ The shared harness (ingest.py) stamps `ingested_at`, dedups against existing rows and
13
+ appends to the Delta bundle. This recipe only fetches and shapes.
14
+ """
15
+ from __future__ import annotations
16
+ from datetime import datetime, timezone
17
+
18
+
19
+ async def fetch(since: datetime):
20
+ import polars as pl # noqa: F401
21
+ import httpx
22
+ import polars as pl
23
+
24
+ rows = []
25
+ for series in SERIES_CODES:
26
+ # ALFRED returns every vintage (real-time period) for the series
27
+ obs = httpx.get(ALFRED_URL, params={"series_id": series, "since": since.date().isoformat()},
28
+ timeout=60).json()["observations"]
29
+ for o in obs:
30
+ rows.append({
31
+ "entity_id": series,
32
+ "event_date": o["period"],
33
+ "knowledge_date": o["realtime_start"], # when this vintage was released
34
+ "knowledge_estimated": False,
35
+ "series_value": o["value"],
36
+ "unit": o["unit"],
37
+ "native_frequency": o["frequency"],
38
+ "release_kind": o["release_kind"],
39
+ })
40
+ return pl.DataFrame(rows)
41
+
42
+
43
+ if __name__ == "__main__":
44
+ import asyncio, polars as pl
45
+ df = asyncio.run(fetch(datetime(2025, 1, 1, tzinfo=timezone.utc)))
46
+ print(df.head())