TheDocumentation Index
Fetch the complete documentation index at: https://docs.struct.to/llms.txt
Use this file to discover all available pages before exploring further.
polymarket_trades room exposes a status filter with three values: confirmed (default, post-block), pending (mempool, pre-confirmation), or all (both). Pending trades arrive seconds before they land on-chain, so a copy-trading pipeline can react before the original fill is confirmed and reconcile against the confirmed event afterwards.
When to use this
pending: fastest reaction, mirrors a watched wallet from the mempool. Trades may not land, so size mirrors conservatively.confirmed: safe but slower. Use when you only want to react to fills that actually settled.all: hybrid pipelines that act on pending and reconcile when the confirmed event arrives.
Subscribe to a target trader’s trades
Passtraders (lowercase 0x-prefixed) and status to polymarket_trades. The room accepts up to 500 total filters per client.
Reading a trade_stream_update
The payload is a discriminated union narrowed by trade_type. For copy trading, the two types you care about are OrderFilled and OrdersMatched. Both expose condition_id, position_id, outcome, outcome_index, side (Buy / Sell), usd_amount, shares_amount, price, and probability.
Pending trades omit fields that only exist after a block lands: block, confirmed_at, log_index, block_index, order_hash, taker, fee, fee_shares, fee_pct. They include received_at (Unix milliseconds) instead. Use received_at for ordering pending events.
See Trade Types for the full discriminated union.
A copy-mirror loop
Once a watched trader’sOrderFilled arrives, place a proportional order on the same condition_id and outcome via your own execution path. A minimal sketch:
usd_amount client-side if you only want to mirror whale fills.
Common combinations
| Goal | Subscribe payload |
|---|---|
| Mirror one trader from the mempool | traders=[0x...]&status=pending |
| Confirmed-only mirror for safer fills | traders=[0x...]&status=confirmed |
| Hybrid (act on pending, reconcile on confirmed) | traders=[0x...]&status=all |
| Watch multiple wallets | traders=[0x...,0x...]&trade_types=[OrderFilled,OrdersMatched] |
| Whale-only mirror (size in client) | traders=[0x...]&status=all, then drop trades below a USD threshold in your handler |
Reconciling pending against confirmed
Withstatus: "all" you receive each trade up to twice: once as pending, once as confirmed. Key by trade id (or hash) and track which side has arrived. Pending events that never see a confirmed counterpart within a window (typically 30 to 60 seconds on Polygon) should be treated as dropped.
Verifying the trader actually held the position
After mirroring, confirm the position landed on the trader’s book by subscribing topolymarket_trader_positions with the same traders filter. The next trader_position_update for that wallet will reflect the new current_shares_balance once the trade clears.