Skip to main content
A time-weighted average price (TWAP) represents an asset’s price across a lookback window. This page covers Chainlink-computed 30-second and 60-second TWAPs.
Chainlink Data Streams mainnet TWAP feeds are available now. You can use your existing standard or sponsored Data Streams credentials. Polymarket RTDS is scheduled to launch August 4, 2026.
Chainlink is still completing development and soak testing through August 4, 2026. The feeds are available for integration now but may be updated before then.
Use Chainlink Data Streams for direct mainnet access, the latest report before streaming, or the original signed report. Find an asset’s TWAP: 30s or TWAP: 60s ticker in the Chainlink Data Streams catalog, then copy its feed ID. Run this only on a trusted backend; never expose Chainlink credentials to browsers or mobile apps.
1

Install and Connect

Use Node.js 20+ and TypeScript 5.3+. Install the Chainlink SDK:
Create the mainnet client:
The SDK signs each request. Keep the server clock within five seconds of Chainlink’s server time.
2

Map and Decode Reports

Store the feed IDs from the catalog in server-side environment variables, then map each ID to its asset and window. Preserve the signed E18 price instead of converting it to a JavaScript number:
3

Fetch Latest TWAP

Fetch each feed’s latest report before streaming:
4

Stream Updates

Subscribe to the selected feed IDs:
The SDK authenticates and reconnects automatically. Monitor error, disconnected, and reconnecting; restart the stream if retries are exhausted.
The TWAP feeds use Chainlink report schema V2. decodeReport() exposes the encoded benchmarkPrice as decoded.price. Reports do not include symbol or window labels. Maintain that mapping yourself, never infer the window from update frequency, and use observationsTimestamp for freshness checks.
decodeReport() parses the report fields; it does not verify the DON signatures. Follow Chainlink’s verification requirements before using a report for settlement or another trust-sensitive action.

Find a Feed ID

Open the Chainlink Data Streams catalog and search for the asset and window you need, such as BTC / USD - TWAP: 30s or BTC / USD - TWAP: 60s. Copy the feed ID from the product page and use it with your existing standard or sponsored Data Streams credentials. The 30-second and 60-second values are lookback windows, not publication cadences. Chainlink computes and signs the TWAP. Define a freshness threshold and a fallback for report gaps instead of trying to infer the calculation from the incoming updates. Chainlink does not currently publish the custom feed’s sampling boundaries, weighting, rounding, or missing-input behavior, so do not independently reproduce the value without a specification from Chainlink. For production requirements, see Chainlink’s TypeScript SDK reference, authentication reference, and developer responsibilities.

Use Polymarket RTDS

RTDS is the recommended production integration. Starting August 4, 2026, it will relay Chainlink-computed mainnet TWAP updates without credentials.
RTDS TWAP is scheduled for August 4, 2026. Before activation, subscriptions may return topic not found and emit no events. Install and deploy now, then create or recreate the subscription after launch; a rejected prelaunch subscription may not retry on an open socket. The SDK versions below need no update when RTDS activates.
Use lowercase, slash-delimited symbols such as btc/usd. Omit a symbol filter to receive every available pair.
Requires Node.js 24+ and @polymarket/client 0.3.0 or later:
Matching bindings are included. See the TypeScript SDK guide for general setup.Subscribe with an explicit window and any symbols you need:
Set windowSeconds to 30 or 60. Omit symbols to receive every available pair. The same subscription works with a SecureClient.
payload.value is an exact decimal string derived from Chainlink’s fixed-point value. Keep it as a decimal string instead of converting it to a JavaScript number. Use payload.timestamp as the Chainlink observation time; the outer timestamp is when the publisher submitted the update to RTDS.Once accepted, the SDK restores the subscription after disconnects. It does not retry a prelaunch rejection on an otherwise open socket.

Select a Window

Choose 30 or 60 seconds for each subscription. Subscribe twice for both.

Stream Behavior

Subscriptions start with the next update. There is no snapshot, history, or replay after a disconnect.