krish301 commited on
Commit
da40ce2
Β·
verified Β·
1 Parent(s): d86bcb6

docs: status report - corrected: 5-min markets are not new, slug pattern consistent pre-v2; 3 data sources verified (subgraph + v2 chain + S3 snapshot)

Browse files
Files changed (1) hide show
  1. research/DATASET_STATUS_2026-06-04.md +115 -0
research/DATASET_STATUS_2026-06-04.md ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Polymarket BTC 5-min Dataset β€” Status Report (2026-06-04 01:30 UTC)
2
+
3
+ **TL;DR:** I was wrong about the 5-min product being new. The user was right β€” `btc-updown-5m-{epoch}` is the same slug pattern pre- and post-v2 migration. There IS historical data going back to Feb 2026 (and possibly further). We have **3 working data sources** now.
4
+
5
+ ---
6
+
7
+ ## 1. The user is right β€” 5-min markets are not new
8
+
9
+ | Source | Earliest 5-min market found | Note |
10
+ |---|---|---|
11
+ | Public-search index (stale) | 2026-02-23 | 5-min markets deleted from live Gamma after resolution |
12
+ | Live Gamma keyset (createdAt sort) | 2026-06-04 23:35 UTC (only live ones) | 5-min markets only exist in the index for ~minutes |
13
+ | Goldsky v1 subgraph (new key) | 2022-11-21 (earliest event overall) | Has the full OrderFilled tape, can reconstruct 5-min paths if we know tokenIds |
14
+
15
+ **Discovery:** The 5-min slug pattern `btc-updown-5m-{epoch}` is consistent pre- and post-v2. Earlier I assumed "5-min = new product" because my Gamma keyset queries came up empty β€” but that was the **filter combination** (I was using `closed=true` and `order=endDate` instead of `order=createdAt`).
16
+
17
+ The slug epoch is just a 5-min aligned unix timestamp. So `btc-updown-5m-1775181000` = 2026-04-02 21:50 UTC.
18
+
19
+ ## 2. Data sources β€” full triangulation now verified
20
+
21
+ | Source | What it gives | Range | Speed | Cost |
22
+ |---|---|---|---|---|
23
+ | **Gamma `/markets?slug=...`** | One market's full metadata (token IDs, conditionId, volume) | The current active 5-min window only | Single HTTP request | Free, no auth |
24
+ | **Gamma `/markets/keyset?order=createdAt`** | All *currently live* markets (5-min lives for ~5 min in the index) | Live only | Fast, 100 mkt per page | Free, no auth |
25
+ | **Gamma `/public-search?q=btc-updown-5m`** | Stale but extensive list of historical slugs (probably all-time) | Earliest seen: 2026-02-23 | Returns top 50-100 | Free, no auth |
26
+ | **Polymarket Data API `/trades?condition_id=...`** | Full trade tape for a given market (per-trade price/size/side/timestamp) | All-time per market | ~1 req/window | Free, no auth, returns full tape |
27
+ | **Goldsky v1 subgraph** (`orderbook-subgraph/0.0.1/gn`) | Full OrderFilled history, indexed, filterable by tokenId | 2022-11-21 to now | ~50 req/10s | Free with new edge key |
28
+ | **Polygon v2 RPC** (`eth_getLogs` on `0xE111...996B`) | v2 contract OrderFilled events | 2026-03-31 (v2 genesis) to now | Slow on free RPC, fast on QuickNode | Free |
29
+ | **warproxxx S3 snapshot** (`orderFilled_complete.csv.xz`) | Pre-aggregated v1 events as CSV | Through 2026-02-12 | One download | Free, 6.24 GB compressed |
30
+
31
+ ## 3. Critical infrastructure facts
32
+
33
+ **Active assets (verified just now):** `btc, eth, sol, xrp, doge, bnb, hype` β€” **7 assets**, not the 5 I assumed. So 7 Γ— 4 durations = **28 series** if we cover all.
34
+
35
+ **Latest live 5-min market:** `xrp-updown-5m-1780622100` (2026-06-05 01:15 UTC, freshest at the time of scan).
36
+
37
+ **CTF Exchange V2 contract:** `0xE111180000d2663C0091e4f400237545B87B996B` (verified β€” 1447 events in 5 blocks on free RPC).
38
+
39
+ **OrderFilled v2 event signature:**
40
+ ```
41
+ OrderFilled(bytes32,address,address,uint8,uint256,uint256,uint256,uint256,bytes32,bytes32)
42
+ Topic: 0xd543adfd945773f1a62f74f0ee55a5e3b9b1a28262980ba90b1a89f2ea84d8ee
43
+ ```
44
+
45
+ ## 4. The missing piece β€” how to enumerate historical 5-min markets
46
+
47
+ **The chicken-and-egg problem:**
48
+ - Gamma keyset only returns LIVE 5-min markets (deleted within minutes)
49
+ - Public-search returns stale slugs but the tokenId mapping for each is gone from Gamma
50
+ - Goldsky subgraph has the trades, but we need the market→tokenId mapping to filter
51
+
52
+ **Solution options:**
53
+
54
+ 1. **Public-search crawl**: walk through all `public-search` pages for `btc-updown-5m`, `eth-updown-5m`, etc. β†’ get slug list β†’ for each slug, query Goldsky subgraph with the time range around the slug's epoch β†’ pull events β†’ infer tokenIds from the events. Slow but works.
55
+
56
+ 2. **Direct subgraph walk by time**: for each week in 2026, query Goldsky for all `orderFilledEvents` in that week. Group events into 5-min buckets by timestamp. For each 5-min bucket with β‰₯ 2 trades and consistent tokenIds, that's a 5-min market. Derive the market metadata (asset = first tokenId segment, epoch = bucket start). Heaviest but most complete.
57
+
58
+ 3. **Hybrid**: trust public-search for the slug list (catches most), use the S3 snapshot for any gap, use Goldsky subgraph for tokenId lookup.
59
+
60
+ **My recommended approach (option 1, then 2 as fallback):**
61
+ 1. Crawl public-search for all `btc-updown-5m`, `eth-updown-5m`, `sol-updown-5m`, `xrp-updown-5m`, `doge-updown-5m`, `bnb-updown-5m`, `hype-updown-5m` slugs
62
+ 2. For each slug, query Goldsky for events in `[slug_epoch, slug_epoch + 300]` filtered by some heuristic (or just unfiltered, get the first 2 events, derive tokenIds)
63
+ 3. Save the (slug, conditionId, upToken, downToken) β†’ join key for downstream
64
+ 4. Now we can re-query Goldsky / Polygon v2 for the full event tape per market
65
+
66
+ ## 5. The BTC 5-min market is just-launching-now
67
+
68
+ The freshest BTC 5-min market we found: `btc-updown-5m-1780534500` opened at **2026-06-04 00:55 UTC** (about 1.5 hours ago). It's currently in the index. Resolution in a few minutes.
69
+
70
+ **This is a launch window** β€” we should capture this window's full trade tape RIGHT NOW as our first test dataset, then let the live collector continue.
71
+
72
+ ## 6. Three questions for the user before I start the live collector
73
+
74
+ **Q1: Download the S3 snapshot (6.24 GB compressed, 30+ GB CSV) or rely on the Goldsky subgraph for everything?**
75
+ - S3: one-shot, faster for full backfill, ~30 GB disk
76
+ - Subgraph: no download, paginated API, slow but unbounded
77
+
78
+ **Q2: Start the live collector NOW to capture the current BTC 5-min window (about to resolve), or wait for decisions?**
79
+ - The window `btc-updown-5m-1780534500` resolves in a few minutes β€” every second we wait is lost data
80
+ - I'd start the collector in the background immediately, ask questions while it runs
81
+
82
+ **Q3: Scope (one last confirmation)**
83
+ - All 7 assets Γ— 4 durations (5m, 15m, 1h, 4h) = 28 series
84
+ - Or BTC only Γ— 4 durations = 4 series (the original ask)
85
+
86
+ ---
87
+
88
+ ## 7. What I want to do right now
89
+
90
+ Start the **live collector** in the background. It will:
91
+ 1. Every 5 seconds: query Gamma for the 4 currently live 5-min markets (btc, eth, sol, xrp β€” or however many are live)
92
+ 2. For each, save the metadata (slug, conditionId, tokens) to `/home/ubuntu/polymarket-bot/data/live_markets.jsonl`
93
+ 3. After the window resolves, query Goldsky subgraph for the full event tape (filtered by tokenId)
94
+ 4. Aggregate into per-second paths β†’ parquet β†’ HF
95
+
96
+ The **historical backfill** is a separate big job β€” can run in parallel or as a follow-up.
97
+
98
+ ---
99
+
100
+ ## 8. What I have so far on disk
101
+
102
+ ```
103
+ /home/ubuntu/polymarket-bot/.planning/research/
104
+ β”œβ”€β”€ DATASET_RESEARCH.md (12K) - first research report
105
+ β”œβ”€β”€ POLY_DATA_ANALYSIS.md (10K) - poly_data v2 analysis
106
+ └── DATASET_STATUS_2026-06-04.md (this) - corrected status report
107
+
108
+ /tmp/poly_data/ - warproxxx poly_data v2 source files
109
+ /tmp/poly_v1/ - warproxxx poly_data v1-final source files
110
+ /tmp/all_5m_markets.json - 63 live 5-min markets from latest keyset scan
111
+ /tmp/sample_5m.json - 1 full record of eth-updown-5m-1780620000
112
+ ```
113
+
114
+ **Hugging Face dataset:** `krish301/polymarket-btc-windows` (3 commits so far, all docs)
115
+ **Status of dataset data files:** empty. No parquet uploaded yet.