Documentation: gap_supplement + orderfilled_daily_utc (schema & usage)

#2
by wilsonwangwang - opened

This post documents two extensions hosted on this dataset (Polymarket_data_fixed, forked from the original Polymarket release):

gap_supplement/ — on-chain gap recovery and derived *_fix_gap Parquets.
orderfilled_daily_utc/ — UTC daily OrderFilled Parquets and an optional run report.
Root layout (same semantics as the upstream DATA_DESCRIPTION / card): the historical monolithic trades / quant / users / orderfilled Parquets at repo root remain the primary bulk tables; the two prefixes above are add-ons for continuity and operations.


1) Gap fix — how it works (gap_supplement/)

  • Problem: A block-range gap in the main pipeline (e.g. missed eth_getLogs windows) leaves missing trades relative to a trusted baseline.
  • Principle: Re-fetch only the missing ranges from Polygon using the same CTF exchange contract addresses and OrderFilled log topic as the main collectors.
  • Execution: Parallel workers + adaptive batching (widen on success, split by 5 on failure) + multi-RPC (first successful node wins; throttling / node lists are tunable). Unrecoverable ranges are audited in worker logs.
  • Output: The recovered raw stream is reprocessed into trades_fix_gap.parquet, quant_fix_gap.parquet, users_fix_gap.parquet (and related artifacts) under gap_supplement/, to be merged with the global tables using the same primary keys and transforms as the upstream merge docs ((transaction_hash, log_index, …) style linkage).
  • Intent: Patch missing history without re-downloading the full chain; not a second independent schema.

Usage (research)

  • Download the gap_supplement/*.parquet you need, left-join or union on the same keys as in trades / quant / users from the base files, then deduplicate if a row already existed in the baseline.
  • Prefer trades_fix_gap when you need the same semantics as root trades for the gap window only.

2) Daily OrderFilled — files & structure (orderfilled_daily_utc/)

  • What it is: One Parquet per UTC calendar day of decoded OrderFilled events, keyed by the event’s timestamp (UTC day boundary).
  • Naming: orderfilled_utc_{YYYY-MM-DD}.parquet
  • Deduplication: Logical row key is (transaction_hash, log_index) after normalizing transaction_hash (lowercased) and log_index to a consistent string form; duplicates in a run use last-wins when re-run or re-merged (aligned with the repo’s merge_orderfilled idea).
  • Relationship to orderfilled_partN.parquet: The incremental job resumes from the last HF orderfilled_part* block; daily files are the day-granular product for incremental fetch + smaller downloads and continuous sync. Schema aligns with raw orderfilled-style fields (on-chain OrderFilled row layout; see base dataset card for column meanings).
  • incremental_run_report.json (optional): Per-run metadata (paths, date coverage, dedupe counters, etc.) for the jsonl → Parquet stage; safe to ignore for pure analytics.

Quality (operational, not a formal proof)

  • Pipelines can run gap checks (block order / random RPC spot checks on suspicious jumps). A zero on spot checks does not replace a full chain audit.

3) How to use on Hugging Face (minimal)

pip install huggingface_hub pyarrow  # and pandas or polars as you prefer
# Example: one daily file (use hf_hub_download or Datasets' data_files filter)
import pandas as pd
from huggingface_hub import hf_hub_download

path = hf_hub_download(
    repo_id="wilsonwangwang/Polymarket_data_fixed",
    filename="orderfilled_daily_utc/orderfilled_utc_2026-04-01.parquet",
    repo_type="dataset",
)
df = pd.read_parquet(path)
# Example: gap supplement — same pattern, e.g. trades side
from huggingface_hub import hf_hub_download
path = hf_hub_download(
    repo_id="wilsonwangwang/Polymarket_data_fixed",
    filename="gap_supplement/trades_fix_gap.parquet",
    repo_type="dataset",
)

For full mirror of a folder prefix, use the Hugging Face CLI:
huggingface-cli download wilsonwangwang/Polymarket_data_fixed --include "orderfilled_daily_utc/*" --repo-type dataset
(Adjust --include for gap_supplement/*.)


4) License & credit

Upstream dataset and methodology follow the original Polymarket data release and MIT terms as stated in the dataset card. The fix/daily artifacts are derivative operational outputs; cite the dataset URL and, if applicable, the upstream paper / HF citation block from the card.

Sign up or log in to comment