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 testnet is available now with authorized credentials. Polymarket RTDS is the recommended production integration and is scheduled to launch August 4, 2026.
Use Chainlink Data Streams for live testnet access, the latest report before streaming, or the original signed report. Run it only on a trusted backend; never expose Chainlink credentials to browsers or mobile apps.
These URLs and feed IDs are testnet-only. Mainnet access, including the production URLs and TWAP feed IDs, will be available August 4, 2026.
1

Install and Connect

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

Map and Decode Reports

Map each feed 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 testnet TWAP feeds listed below 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.

Testnet Feed IDs

Use these feed IDs directly. Custom TWAP feeds may not appear in listFeeds() even when your credentials can fetch and stream them.

Mainnet Availability

On August 4, replace the testnet feed IDs with the mainnet IDs released by Chainlink. Confirm the mainnet report schema and price scale before reusing the decoder. High Availability mode is mainnet-only; keep haMode: false on testnet. 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-beta.0:
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.