ZipLime commited on
Commit
6ed0b9a
·
verified ·
1 Parent(s): 0baf180

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-finance-yahoo-data
2
+
3
+ # every US trading day, shortly after the 16:00 ET close
4
+ on:
5
+ schedule:
6
+ - cron: "0 22 * * 1-5"
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/finance-yahoo-data data/ data/ --token "$HF_TOKEN"
README.md ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ language:
4
+ - en
5
+ pretty_name: Yahoo Equity Daily Bars (PIT)
6
+ tags:
7
+ - point-in-time
8
+ - pit
9
+ - ziplime
10
+ - backtesting
11
+ - alternative-data
12
+ - finance
13
+ - us_equities
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
+ # 📈 Yahoo Equity Daily Bars (PIT)
26
+
27
+ Daily OHLCV bars for US equities, delivered as a point-in-time ziplime bundle.
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:** Market data — daily equity OHLCV
36
+ - **Entity domain:** `us_equities` — US-listed equity, keyed by ticker (resolves via the `entity_map` dataset).
37
+ - **Origin:** Yahoo Finance (`yfinance`), auto-adjusted daily bars
38
+ - **License:** Yahoo Finance terms — research use only
39
+ - **Update cadence:** every US trading day, shortly after the 16:00 ET close (`0 22 * * 1-5`)
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
+ | `open` | Float64 | Session open (auto-adjusted) |
73
+ | `high` | Float64 | Session high |
74
+ | `low` | Float64 | Session low |
75
+ | `close` | Float64 | Session close (auto-adjusted) |
76
+ | `volume` | Float64 | Session volume |
77
+ | `price` | Float64 | Convenience alias of close |
78
+
79
+ The logical key of a fact is `(entity_id, event_date)`. A **revision** is a new row with the
80
+ same key and a later `knowledge_date`. Written rows are immutable; history is never rewritten.
81
+
82
+ ## As-of access
83
+
84
+ Inside a ziplime strategy there is **no `T` parameter** — the knowledge moment always equals
85
+ the simulation clock (live: wall clock):
86
+
87
+ ```python
88
+ async def initialize(context):
89
+ context.ds = await context.pit("finance-yahoo-data")
90
+
91
+ async def handle_data(context, data):
92
+ # only rows with knowledge_date <= current simulation time are visible
93
+ latest = await context.ds.latest(
94
+ assets=[context.asset], fields=['open', 'high']
95
+ )
96
+ history = await context.ds.as_of(
97
+ assets=[context.asset], fields=['open'],
98
+ event_range=("2022-01-01", None),
99
+ )
100
+ ```
101
+
102
+ ### Reading it outside ziplime (plain Polars + delta-rs)
103
+
104
+ ```python
105
+ import polars as pl
106
+
107
+ T = "2025-06-01T00:00:00Z" # "what was known at T"
108
+ lf = pl.scan_delta("hf://datasets/ZipLime/finance-yahoo-data/data/data_bundle/yahoo_finance_daily_data/1784755946/data.delta")
109
+ as_of = (
110
+ lf.filter(pl.col("knowledge_date") <= T)
111
+ .sort("knowledge_date")
112
+ .group_by(["entity_id", "event_date"], maintain_order=True)
113
+ .last()
114
+ )
115
+ print(as_of.collect())
116
+ ```
117
+
118
+ Delta time-travel (`AS OF <version>`) pins the table for reproducibility; the
119
+ `knowledge_date <= T` filter is what enforces point-in-time. They compose: a backtest records
120
+ `(dataset, delta_version)` and replays read the table at that version *and* apply the filter.
121
+
122
+ ## Updates
123
+
124
+ `recipe.py` implements the collection contract `fetch(since: datetime) -> pl.DataFrame` in the
125
+ PIT schema above; `ingest.py` dedups and **appends** to the Delta bundle (never rewrites).
126
+ The scheduled job in `.github/workflows/update.yml` runs it every US trading day, shortly after the 16:00 ET close.
127
+
128
+ ```python
129
+ # recipe.py (contract)
130
+ async def fetch(since: datetime) -> "pl.DataFrame": ...
131
+ ```
132
+
133
+ ## Knowledge-date convention
134
+
135
+ For quotes `knowledge_date ≈ event_date`: a daily bar is only complete once its session closes, so it is stamped visible from the close of that session. OHLCV is the one class the design doc keeps out of full PIT treatment — this dataset is the bootstrap bundle that seeds the format.
136
+
137
+ ## What's in this repo
138
+
139
+ ```
140
+ README.md # this card
141
+ manifest.json # PIT dataset manifest (schema, source, schedule)
142
+ recipe.py # fetch(since) -> PIT rows
143
+ ingest.py # dedup + append-only Delta writer
144
+ .github/workflows/update.yml # scheduled ingestion
145
+ data/ # ziplime Delta bundle + registry manifest
146
+ bundle_registry/yahoo_finance_daily_data_1784755946.json
147
+ data_bundle/yahoo_finance_daily_data/1784755946/data.delta/
148
+ ```
149
+
150
+ The `data/` bundle is a ready-to-load ziplime Delta Lake market-data bundle (five US equity
151
+ tickers, daily bars) that seeds the pipeline and lets you exercise the loader end-to-end
152
+ today. Point `pl.scan_delta` (above) at it, or register it with ziplime's
153
+ `FileSystemBundleRegistry`.
154
+
155
+ ---
156
+
157
+ <sub>Generated for the ziplime PIT data-layer prototype. Manifest and schema follow the
158
+ 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.44 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,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "finance_yahoo_data",
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": "us_equities",
10
+ "schema": {
11
+ "open": "Float64",
12
+ "high": "Float64",
13
+ "low": "Float64",
14
+ "close": "Float64",
15
+ "volume": "Float64",
16
+ "price": "Float64"
17
+ },
18
+ "pit": {
19
+ "knowledge_lag_model": null,
20
+ "model_knowledge_cutoff": null
21
+ },
22
+ "source": {
23
+ "recipe": "recipe.py",
24
+ "recipe_hash": "sha256:<filled-by-ci>",
25
+ "origin": "Yahoo Finance (`yfinance`), auto-adjusted daily bars",
26
+ "license": "Yahoo Finance terms — research use only",
27
+ "schedule": "0 22 * * 1-5"
28
+ },
29
+ "trading_calendar_name": null,
30
+ "frequency_seconds": null
31
+ }
recipe.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Yahoo Equity Daily Bars (PIT) — 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 `finance-yahoo-data`:
9
+ system: entity_id, event_date, knowledge_date, knowledge_estimated
10
+ values: open, high, low, close, volume, price
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 yfinance as yf
22
+ import polars as pl
23
+
24
+ universe = ["META", "AAPL", "AMZN", "NFLX", "GOOGL"]
25
+ raw = yf.download(
26
+ tickers=universe, interval="1d", start=since, threads=1,
27
+ group_by="Ticker", auto_adjust=True, multi_level_index=False, progress=False,
28
+ )
29
+ frames = []
30
+ for sym in universe:
31
+ d = pl.from_pandas(raw[sym], include_index=True).rename({
32
+ "Date": "event_date", "Open": "open", "High": "high",
33
+ "Low": "low", "Close": "close", "Volume": "volume",
34
+ })
35
+ d = d.with_columns(
36
+ pl.lit(sym).alias("entity_id"),
37
+ # a daily bar is known at its own session close
38
+ pl.col("event_date").alias("knowledge_date"),
39
+ pl.lit(False).alias("knowledge_estimated"),
40
+ pl.col("close").alias("price"),
41
+ )
42
+ frames.append(d)
43
+ return pl.concat(frames)
44
+
45
+
46
+ if __name__ == "__main__":
47
+ import asyncio, polars as pl
48
+ df = asyncio.run(fetch(datetime(2025, 1, 1, tzinfo=timezone.utc)))
49
+ print(df.head())