Skip to main content

Polymarket WebSocket API: live trades, odds and market streams

The Bitquery Polymarket WebSocket API pushes Polymarket live data to your app as it settles on Polygon. You write a GraphQL subscription, open one WebSocket, and receive every matching trade, price update, new market or payout. Use it as a Polymarket real time API for dashboards, alerts, copy-trading tools and bots.

Each stream below is a complete subscription that runs as pasted in the Bitquery IDE.

StreamWhat it gives
Live trades of all marketsEvery Polymarket fill with market, outcome, price, size and wallets
Live trades of one marketFills of a single market, selected by market ID
Live odds of one outcomePrice updates of one outcome token, such as the Yes side of a market
Live odds of a market seriesPrice updates of every market whose title matches a phrase
Large tradesFills above a USD size you choose
Live trades of one walletBuys and sells of a single trader
New marketsMarkets as they are created, with their outcomes
RedemptionsPayouts to winners after a market resolves
Last few minutes of tradesA plain query for a snapshot before you subscribe

How to connect​

All Polymarket WebSocket streams use one endpoint:

wss://streaming.bitquery.io/graphql

A minimal Node.js client with the ws package:

const { WebSocket } = require("ws");

const connection = new WebSocket(
"wss://streaming.bitquery.io/graphql?token=YOUR_TOKEN",
["graphql-ws"]
);

connection.on("open", () => {
connection.send(JSON.stringify({ type: "connection_init" }));
});

connection.on("message", (data) => {
const response = JSON.parse(data);

if (response.type === "connection_ack") {
connection.send(
JSON.stringify({
type: "start",
id: "1",
payload: {
query: `
subscription {
EVM(network: matic) {
PredictionTrades(
where: {
TransactionStatus: { Success: true }
Trade: {
Prediction: { Marketplace: { ProtocolName: { is: "polymarket" } } }
}
}
) {
Block { Time }
Trade {
OutcomeTrade { Buyer Seller Amount CollateralAmountInUSD Price }
Prediction { Question { Title MarketId } Outcome { Label } }
}
Transaction { Hash }
}
}
}
`,
},
})
);
}

if (response.type === "data") {
console.log(JSON.stringify(response.payload.data));
}

if (response.type === "error") {
console.error(response.payload.errors);
}
});

connection.on("close", () => {
console.log("Disconnected. Reconnect and subscribe again.");
});

Python, Rust and other clients follow the same steps. Working samples are on the subscription examples page.

Fields​

Trade streams read the PredictionTrades cube on EVM(network: matic). Market and payout streams read PredictionManagements and PredictionSettlements on the same root.

FieldWhat it holds
Block.TimeTime of the Polygon block that settled the event
Transaction.HashTransaction of the fill, creation or payout
Trade.OutcomeTrade.Buyer, SellerWallets on the two sides of the fill
Trade.OutcomeTrade.AmountNumber of outcome shares traded
Trade.OutcomeTrade.CollateralAmount, CollateralAmountInUSDSize of the fill in the collateral token and in USD
Trade.OutcomeTrade.Price, PriceInUSDPrice of one share, between 0 and 1. Read it as the implied probability of the outcome
Trade.OutcomeTrade.IsOutcomeBuyDirection of the fill. See trade direction
Trade.Prediction.Question.Title, MarketId, IdMarket question, its numeric market ID and its question ID
Trade.Prediction.ConditionIdCondition ID of the market
Trade.Prediction.Outcome.LabelOutcome that was traded, such as Yes, No, Up or a team name
Trade.Prediction.OutcomeToken.AssetIdToken ID of the outcome. Use it to follow one side of one market
Trade.Prediction.CollateralToken.SymbolToken the trade settles in
Management.EventTypeCreated or Resolved on market streams
Settlement.EventTypeSplit, Merge or Redemption on payout streams
Settlement.BeneficiaryWallet that receives the payout

Full field lists are on the Prediction Trades API, Prediction Managements API and Prediction Settlements API pages.

Examples​

Live trades of all markets​

This stream returns every Polymarket trade as it settles. Run in the IDE.

  • ProtocolName: { is: "polymarket" } keeps Polymarket fills only.
  • TransactionStatus: { Success: true } keeps successful transactions.
subscription {
EVM(network: matic) {
PredictionTrades(
where: {
TransactionStatus: { Success: true }
Trade: {
Prediction: { Marketplace: { ProtocolName: { is: "polymarket" } } }
}
}
) {
Block {
Time
}
Trade {
OutcomeTrade {
Buyer
Seller
Amount
CollateralAmount
CollateralAmountInUSD
Price
PriceInUSD
IsOutcomeBuy
}
Prediction {
ConditionId
Question {
Title
MarketId
Id
}
Outcome {
Label
}
OutcomeToken {
AssetId
}
CollateralToken {
Symbol
}
}
}
Transaction {
Hash
}
}
}
}

Live trades of one market​

This stream returns the trades of a single market. Run in the IDE.

  • Question.MarketId selects the market. 2772194 is "Will Shakhtar Donetsk win the 2026-27 UEFA Champions League Championship?".
  • To follow several markets on one stream, use MarketId: { in: ["...", "..."] }.
subscription {
EVM(network: matic) {
PredictionTrades(
where: {
TransactionStatus: { Success: true }
Trade: {
Prediction: {
Marketplace: { ProtocolName: { is: "polymarket" } }
Question: { MarketId: { is: "2772194" } }
}
}
}
) {
Block {
Time
}
Trade {
OutcomeTrade {
Buyer
Seller
Amount
CollateralAmountInUSD
Price
IsOutcomeBuy
}
Prediction {
Question {
Title
MarketId
}
Outcome {
Label
}
}
}
Transaction {
Hash
}
}
}
}

Live odds of one outcome​

This stream returns a price update each time one outcome token trades. Run in the IDE.

  • OutcomeToken.AssetId selects one side of one market. The ID below is the Yes token of the market in the previous example.
  • Price is the latest odds of that outcome, from 0 to 1. Multiply by 100 for a percentage.
subscription {
EVM(network: matic) {
PredictionTrades(
where: {
TransactionStatus: { Success: true }
Trade: {
Prediction: {
Marketplace: { ProtocolName: { is: "polymarket" } }
OutcomeToken: {
AssetId: {
is: "33339798372916037220786136133406478491116150628220441951753426683441228279665"
}
}
}
}
}
) {
Block {
Time
}
Trade {
OutcomeTrade {
Price
PriceInUSD
Amount
CollateralAmountInUSD
}
Prediction {
Question {
Title
MarketId
}
Outcome {
Label
}
OutcomeToken {
AssetId
}
}
}
}
}
}

Live odds of a market series​

This stream returns price updates for every market whose title contains a phrase. Run in the IDE.

  • Question.Title: { includes: "Bitcoin Up or Down" } matches the recurring Bitcoin markets, so the stream keeps running as new rounds open.
  • Outcome.Label: { is: "Up" } keeps one side. Remove it to receive both Up and Down.
subscription {
EVM(network: matic) {
PredictionTrades(
where: {
TransactionStatus: { Success: true }
Trade: {
Prediction: {
Marketplace: { ProtocolName: { is: "polymarket" } }
Question: { Title: { includes: "Bitcoin Up or Down" } }
Outcome: { Label: { is: "Up" } }
}
}
}
) {
Block {
Time
}
Trade {
OutcomeTrade {
Price
PriceInUSD
CollateralAmountInUSD
}
Prediction {
Question {
Title
MarketId
}
Outcome {
Label
}
}
}
}
}
}

Large trades stream​

This stream returns only the fills above a USD size, across all markets. Run in the IDE.

  • CollateralAmountInUSD: { gt: "1000" } sets the minimum size. Raise it to "10000" or more to follow whales only.
  • Add a Question.Title or MarketId filter to watch large trades in one market.
subscription {
EVM(network: matic) {
PredictionTrades(
where: {
TransactionStatus: { Success: true }
Trade: {
Prediction: { Marketplace: { ProtocolName: { is: "polymarket" } } }
OutcomeTrade: { CollateralAmountInUSD: { gt: "1000" } }
}
}
) {
Block {
Time
}
Trade {
OutcomeTrade {
Buyer
Seller
Amount
CollateralAmountInUSD
Price
IsOutcomeBuy
}
Prediction {
Question {
Title
MarketId
}
Outcome {
Label
}
}
}
Transaction {
Hash
}
}
}
}

Live trades of one wallet​

This stream returns each trade where one wallet is the buyer or the seller. Run in the IDE.

  • The any list is an OR filter: the first entry matches the wallet as Buyer, the second as Seller.
  • Replace the address with any Polymarket trader wallet. To follow a list of wallets, use in: ["0x...", "0x..."] in both entries.
subscription {
EVM(network: matic) {
PredictionTrades(
where: {
TransactionStatus: { Success: true }
any: [
{
Trade: {
Prediction: { Marketplace: { ProtocolName: { is: "polymarket" } } }
OutcomeTrade: {
Buyer: { is: "0x821dab0565ebf5b327f51db06223fdcfe01acf16" }
}
}
}
{
Trade: {
Prediction: { Marketplace: { ProtocolName: { is: "polymarket" } } }
OutcomeTrade: {
Seller: { is: "0x821dab0565ebf5b327f51db06223fdcfe01acf16" }
}
}
}
]
}
) {
Block {
Time
}
Trade {
OutcomeTrade {
Buyer
Seller
Amount
CollateralAmountInUSD
Price
IsOutcomeBuy
}
Prediction {
Question {
Title
MarketId
}
Outcome {
Label
}
}
}
Transaction {
Hash
}
}
}
}

New markets stream​

This stream returns each Polymarket market at the moment it is created. Run in the IDE.

  • EventType: { is: "Created" } keeps market creations. Change it to "Resolved" to stream resolutions instead.
  • Condition.Outcomes lists every outcome of the new market with its label and ID.
subscription {
EVM(network: matic) {
PredictionManagements(
where: {
Management: {
EventType: { is: "Created" }
Prediction: { Marketplace: { ProtocolName: { is: "polymarket" } } }
}
}
) {
Block {
Time
}
Management {
EventType
Prediction {
Question {
Title
MarketId
Id
CreatedAt
}
Condition {
Id
Outcomes {
Id
Index
Label
}
}
CollateralToken {
Symbol
}
}
}
Transaction {
Hash
}
}
}
}

Redemptions stream​

This stream returns payouts as winners redeem their shares after a market resolves. Run in the IDE.

  • EventType: { is: "Redemption" } keeps payouts. Split and Merge are the other values.
  • IsRepeat: false returns each payout once.
  • Beneficiary is the wallet that is paid, and Outcome.Label is the winning outcome.
subscription {
EVM(network: matic) {
PredictionSettlements(
where: {
Settlement: {
EventType: { is: "Redemption" }
IsRepeat: false
Prediction: { Marketplace: { ProtocolName: { is: "polymarket" } } }
}
}
) {
Block {
Time
}
Settlement {
EventType
Holder
Beneficiary
Amounts {
Amount
CollateralAmount
CollateralAmountInUSD
}
Prediction {
Question {
Title
MarketId
}
Outcome {
Label
}
CollateralToken {
Symbol
}
}
}
Transaction {
Hash
}
}
}
}

Last few minutes of trades (query)​

A subscription starts with the next event. This plain query returns the trades of the last 10 minutes, newest first, so your app has data on screen before the stream takes over. Run in the IDE.

  • since_relative: { minutes_ago: 10 } bounds the time window.
  • orderBy and limit return the 50 newest trades. Add the same market, wallet or size filter that your subscription uses.
query {
EVM(network: matic) {
PredictionTrades(
limit: { count: 50 }
orderBy: { descending: Block_Time }
where: {
TransactionStatus: { Success: true }
Block: { Time: { since_relative: { minutes_ago: 10 } } }
Trade: {
Prediction: { Marketplace: { ProtocolName: { is: "polymarket" } } }
}
}
) {
Block {
Time
}
Trade {
OutcomeTrade {
Buyer
Seller
Amount
CollateralAmountInUSD
Price
IsOutcomeBuy
}
Prediction {
Question {
Title
MarketId
}
Outcome {
Label
}
}
}
Transaction {
Hash
}
}
}
}

Kafka for high volume​

Kafka is the production option when you consume all Polymarket activity at high volume or need the lowest latency. The same trades, market events and settlements are delivered on the matic.predictions.proto topic. See Kafka streaming concepts for topics, consumers and credentials.

WebSocket subscriptions fit filtered streams, such as one market, one wallet or large trades only, and anything you want to prototype in the IDE first.

Things to know​

  • Billing: you are charged per subscription, not per WebSocket. See streaming pricing.
  • Delivery: events arrive block by block. One message can carry several trades, so loop over the array in each message.
  • Filters: a subscription accepts the same where filters as a query. Test a filter as a query first, then change query to subscription.
  • Start point: a stream delivers events from the moment it starts. Run the snapshot query first if you need recent trades.
  • Stopping: close the WebSocket to end a stream.
  • Reconnecting: if the connection closes, open it again and send the subscription again. Patterns are on the reconnect guide.
  • Prices: Price is between 0 and 1 and reads as the probability of the outcome.
  • History: for past data and long time ranges, use the queries on the Polymarket historical data page, or the Data Store export for bulk files.

Frequently Asked Questions

Does Polymarket have a WebSocket API for on-chain data?

Yes. The Bitquery Polymarket WebSocket API streams every settled trade, market creation, resolution and payout from Polygon over GraphQL subscriptions at wss://streaming.bitquery.io/graphql.

How do I stream live Polymarket trades?

Open a WebSocket to wss://streaming.bitquery.io/graphql with your token in the URL and send a subscription on PredictionTrades filtered by ProtocolName polymarket. Each new trade is pushed to your client.

How do I get live Polymarket odds over WebSocket?

Subscribe to PredictionTrades for one outcome token with OutcomeToken.AssetId, or for one market with Question.MarketId, and read Trade.OutcomeTrade.Price. The price is between 0 and 1 and is the implied probability of that outcome.

Can I stream only one Polymarket market or one wallet?

Yes. Filter by Question.MarketId for a market, by Question.Title for a series of markets, and by Buyer or Seller for a wallet. Filters run on the server, so your client receives only matching events.

How do I track Polymarket whale trades in real time?

Use the large trades stream and set CollateralAmountInUSD to the minimum trade size you want, for example greater than 10000.

Do I need an API key for the Polymarket WebSocket?

Yes. Generate an access token in your Bitquery account and add it to the WebSocket URL as the token parameter. Streams also run in the Bitquery IDE without any client code.

Should I use WebSocket or Kafka for Polymarket live data?

Use Kafka for production pipelines that consume all Polymarket activity at high volume. Use WebSocket subscriptions for filtered streams, dashboards, alerts and prototypes.

Can I use the Polymarket WebSocket API to place orders?

No. It is a read-only data API. It delivers trades, prices, markets and settlements, and does not place or cancel orders.

Build with Bitquery

Ready to run this in production?

Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.