Polymarket now provides official Chainlink-computed Time-Weighted Average Price (TWAP) feeds for 30-second and 60-second windows.
These are the values the platform uses (or will use) for settlement on short-horizon crypto markets. If you are building bots, resolution logic, or training labels, you should understand how to access them correctly.
What is a TWAP Here?
A TWAP is the average price of an asset over a fixed lookback window (30s or 60s).
Chainlink computes and signs these values. Polymarket relays them.
Two access methods exist:
- Direct Chainlink Data Streams (available now)
- Polymarket RTDS (recommended production path, scheduled for August 4, 2026)
1. Direct Chainlink Data Streams
Use this when you need the original signed reports or want to start integrating before RTDS is fully live.
Setup
npm install --save-exact @chainlink/data-streams-sdk@1.2.1
Create a client with your Chainlink credentials:
import { createClient, decodeReport } from "@chainlink/data-streams-sdk";
const client = createClient({
apiKey: process.env.CHAINLINK_CLIENT_ID!,
userSecret: process.env.CHAINLINK_CLIENT_SECRET!,
endpoint: "https://api.dataengine.chain.link",
wsEndpoint: "wss://ws.dataengine.chain.link",
});
Important Rules
- Never expose credentials in the browser or mobile apps
- Keep the server clock within 5 seconds of Chainlink time
- Preserve the price as a bigint / decimal string (E18 fixed-point) — do not convert to JavaScript
number - Map feed IDs yourself (reports do not include symbol or window labels)
- Use
observationsTimestampfor freshness checks
Streaming Updates
Subscribe to the feed IDs for BTC / USD - TWAP: 30s and BTC / USD - TWAP: 60s from the Chainlink Data Streams catalog.
The SDK handles authentication and reconnection. You still need to monitor error, disconnected, and reconnecting events.
2. Polymarket RTDS (Recommended)
Starting August 4, 2026, Polymarket RTDS will relay the same Chainlink TWAP updates without requiring Chainlink credentials.
This is the preferred production integration for most bots.
TypeScript Example
import { createPublicClient } from "@polymarket/client";
const client = createPublicClient();
const stream = await client.subscribe([
{
topic: "prices.crypto.chainlink.twap",
windowSeconds: 60, // or 30
symbols: ["btc/usd"],
},
]);
for await (const event of stream) {
console.log({
symbol: event.payload.symbol,
value: event.payload.value, // exact decimal string
windowSeconds: event.payload.windowSeconds,
observedAt: new Date(event.payload.timestamp).toISOString(),
});
}
Python Example
from polymarket import AsyncPublicClient
from polymarket.streams import CryptoPricesChainlinkTwapSpec
async with AsyncPublicClient() as client:
async with await client.subscribe(
CryptoPricesChainlinkTwapSpec(
window_seconds=60,
symbols=["btc/usd"],
)
) as stream:
async for event in stream:
print(event.payload.symbol, event.payload.value)
Key Details
-
payload.valueis an exact decimal string — keep it as a string orDecimal -
payload.timestampis the Chainlink observation time - The outer
timestampis when RTDS published the update - Omit
symbolsto receive every available pair - The SDK restores subscriptions after disconnects (once accepted)
Note: Before August 4, subscriptions may return topic not found. Deploy the code now and recreate the subscription after launch.
Best Practices for Bots
- Prefer the 60-second TWAP for resolution if that is what the market settles on.
- Always implement a freshness / staleness check.
- Keep gamma
outcomePricesas a fallback. - Never try to reverse-engineer the TWAP calculation yourself — use the signed value.
- Log both the TWAP value and its observation timestamp for every resolved slot.
Why This Matters
Using a single-price snapshot instead of the official TWAP introduces systematic label error.
Previous measurements showed meaningful divergence (around 26% flip rate in some samples).
Aligning your resolution and training data with the real settlement source is no longer optional if you want accurate paper trading results and model labels.
The combination of Chainlink Data Streams (available now) and Polymarket RTDS (coming August 4) gives developers a clean, official path to the correct price.
If you are running any short-horizon BTC/ETH/SOL Up/Down system, update your resolution logic before the cutover.
If you have more questions, please feel free to contact me at any time: https://t.me/abrownfox001
My Polymarket Activity: https://polymarket.com/@abrownfox001?tab=activity
#Polymarket #Chainlink #TWAP #TradingBot #PredictionMarkets #CryptoData #RTDS
Top comments (0)