Verified Polymarket examples
Recent on-chain fills
The checked-in query uses the current qualified table name and its partitioning timestamp. It returns both token and USDC amounts, fees, maker attribution and transaction context.
SELECT
block_timestamp,
transaction_hash,
wallet,
asset,
side,
amount_token,
amount_usdc,
fee,
is_maker
FROM polymarket.polymarket_order_filled_v3
PREWHERE block_timestamp >= now() - INTERVAL 1 DAY
ORDER BY block_timestamp DESC, block_number DESC, log_index DESC
LIMIT 100Source: examples/polymarket/recent_fills.sql.
Raw order-book captures
Set the archive directory URL privately:
POLYMARKET_ORDERBOOKS=https://captures.example.com/polymarket/1. Scan the filesystem listing
python3 examples/orderbooks/polymarket.py scanThe scanner accepts local directories and HTTP directory listings. It keeps
only .log and .log.zst captures from the configured origin and rejects an
oversized listing.
2. Download one bounded capture
Choose a name returned by the scanner:
python3 examples/orderbooks/polymarket.py download \
MARKET_CAPTURE.log.zst /tmp/market.log.zstThe downloader rejects path traversal and files larger than its configured 64 MiB safety limit.
3. Reconstruct one asset
python3 examples/orderbooks/polymarket.py reconstruct \
/tmp/market.log.zst CLOB_TOKEN_IDEach raw line is either JSON or capture_timestamp<TAB>JSON. A book event
replaces both sides of the selected asset's book. Later price_change entries
set a price level to the supplied size, or delete it when the size is zero. The
command prints the final best bid, best ask and level counts.
The docs build performs a real scan of the configured archive and an end-to-end scan, download, decompression and replay against a deterministic capture. This tests the complete reconstruction path without making the build depend on the size of an arbitrary production file.
Strict 24-hour cross-venue build check
The Docker checker stage also computes UTC now - 24 hours, finds the nearest
captured Bitcoin five-minute Up/Down event, and resolves its Up and Down CLOB
token IDs by joining the event and market metadata. It then downloads the
special capture named exactly after that market slug, reads its high-resolution
best-bid/ask series, and independently replays both books to market close. The
same five minutes are reconstructed from HyperLiquid raw files and rendered in
the cross-venue example.
The same timestamp-bounded operation is available directly for an already downloaded capture:
python3 examples/orderbooks/polymarket.py reconstruct-at \
/tmp/market.log.zst TARGET_UNIX_MILLISECONDS