pm_ws / README.md
billyyiu747's picture
docs: parquet derivative + streaming access
b14458f verified
|
Raw
History Blame Contribute Delete
4.04 kB
---
license: other
license_name: research-use
license_link: LICENSE
pretty_name: pm_ws anonymised multi-venue crypto microstructure capture
---
# pm_ws — anonymised multi-venue crypto microstructure capture
High-resolution market-microstructure research corpus: multi-day, multi-venue
capture of crypto limit-order-book state, event streams, and settlement-label
observations for short-horizon (5m/15m) binary-option markets and their
underlying spot feeds.
**All identifying values are anonymised at source.** Instruments are stable
`c0..cN` labels, venues are `v0..vN` labels, and identifiers (market ids,
token ids, session/connection ids, hosts) are salted digests. The salt and
the label map are not published and will not be. Prices, sizes, depth
ladders, clocks, sequence numbers, and lifecycle structure are preserved
exactly — the corpus is analysis-ready without the identity map.
## Layout
| path | stream | semantics |
|---|---|---|
| `ws_l2/` | `feed_a_*` | **Event-driven** websocket demux across venues: top-of-book updates (`bookTicker`, `best_bid_ask`, `price_change`), trades (`aggTrade`, `last_trade_price`), parent frame envelopes, market-lifecycle events, connection lifecycle markers. Silence between rows inside an alive epoch is data (no event occurred), not a gap. |
| `pm_l2/` | `feed_b_*` | **Polled** binary-market L2 book snapshots: 10-level `bids`/`asks` ladders, best bid/ask, depth aggregates, OFI inputs, trade prints (`[ts, price, size, signed_aggressor]`), reciprocal-side identity via salted token ids. |
| `oracle/` | `feed_c_*` | Settlement/label observation stream: availability clocks, authentication flags, outcome observation rows. Rows state explicitly what is and is not authenticated. |
Files are gzip JSONL, one JSON object per row, named
`feed_<x>_<YYYYMMDD>[T<HH>].anon.jsonl.gz` (whole-day or hour chunk, UTC).
## Parquet derivative (recommended for analysis)
Every archive also exists as Parquet under `parquet/<stream>/<name>.parquet`
(zstd, nested ladders as list columns, per-`kind` union schema with sparse
nulls; fields whose wire type varies across rows are strings). The gz JSONL
archives remain the canonical bytes; Parquet is the streaming-friendly
derivative.
Stream without downloading:
```python
import duckdb
duckdb.sql("INSTALL httpfs; LOAD httpfs;")
df = duckdb.sql("""
SELECT kind, available_at_ts, bb, ba
FROM 'hf://datasets/billyyiu747/pm_ws/parquet/ws_l2/feed_a_20260725.anon.parquet'
WHERE kind = 'bookTicker' LIMIT 100000
""").df()
```
or with `datasets`/`pyarrow`: `load_dataset("parquet", data_files="hf://datasets/billyyiu747/pm_ws/parquet/pm_l2/*.parquet", streaming=True)`.
Column projection and predicate pushdown make partial reads orders of
magnitude cheaper than fetching the gz archives.
## Row model
- Dispatch on `kind` (ws_l2) / row schema (`schema_version` field where present).
- Clocks: `source_event_ts` (venue), `recv_ts` (capture), `available_at_ts`
(earliest usable time — use THIS for causal feature construction),
`recv_mono_ns` (monotonic).
- Continuity: `session_id` / `connection_id` / `epoch_generation` /
`epoch_id` / `sequence` define continuity spans. Reconnects open a new
epoch and are marked by explicit connection-close/open rows. **Never
compute features across epoch boundaries; missing intervals are unknown,
not zero activity.**
- Venue-prefixed enum values carry the venue label prefix (e.g.
`v0_connection_close`).
## Caveats
- Coverage is not uniform across days; some days have polled-stream coverage
gaps (marked by lifecycle rows, never silently).
- `oracle/` rows with `authenticated=false` are observations, not certified
labels.
- This is raw research capture, not a curated benchmark: validate row-level
invariants before use.
## Provenance
Produced by an allowlist-based, fail-closed anonymisation pipeline: any
unclassified field aborts the export rather than shipping it. Output is
scanned against the identity map before publication; a scan hit refuses the
file.