Skip to main content

Prediction Market Parlays API

A parlay combines several prediction markets (its legs) into one position. Each parlay is its own Yes/No market on whether every leg resolves to the outcome the trader picked. Polymarket runs parlays on Polygon through its parlay exchange contract 0xe3333700ca9d93003f00f0f71f8515005f6c00aa.

Bitquery serves parlays through two cubes on EVM(network: matic):

CubeOne row perUse it for
PredictionParlayTradesfill of a parlay orderparlay trades, volume, buyers and sellers
PredictionParlayLegsleg of a parlay, written when the parlay is createdwhat each parlay is made of, the markets picked most

A new parlay also appears in PredictionManagements as a Created event, with the parlay exchange as Marketplace.SmartContract. Part of the Prediction Market API.


Key fields​

PredictionParlayTrades​

FieldDescription
Parlay.ConditionIdCondition ID of the parlay market. Joins to PredictionParlayLegs on Parlay.ConditionId.
Outcome.IndexParlay outcome traded: 0 = Yes (every leg wins), 1 = No.
Buyer, SellerThe two sides of the fill. When one of them is the parlay exchange contract, the row is the taker's side of the match (see Parlay volume).
IsOutcomeBuySame meaning as in PredictionTrades: true when the Seller gives collateral and the Buyer gives outcome tokens, false the other way round.
AmountParlay outcome tokens filled.
CollateralAmount, CollateralAmountInUSDCollateral paid (pUSD) and its USD value.
CollateralToken.SmartContract, CollateralToken.DecimalsCollateral token contract (pUSD) and its decimals.
OutcomeToken.DecimalsDecimals of the parlay outcome token.
OrderIdOrder hash of the filled order.
Block (Time, Date, Number), Transaction.Hash, Call (Index, Reverted), Log.Index, TransactionStatus.SuccessWhere the fill happened on chain.

PredictionParlayLegs​

FieldDescription
Parlay.ConditionIdCondition ID of the parlay this leg belongs to.
Leg.IndexPosition of the leg in the parlay, starting at 1.
Leg.TitleQuestion of the leg market (for example Spurs vs. Suns).
Leg.OutcomeIndex, Leg.OutcomeLabelOutcome the parlay needs from this leg.
Leg.LegacyConditionIdConditional Tokens condition ID of the leg market. It matches Trade.Prediction.ConditionId in PredictionTrades, so you can pull the single-market trades of a leg.
Leg.ConditionIdCondition ID of the leg market in the parlay exchange's format.
Leg.PositionIdPosition (token) ID of the picked outcome of the leg.
Block (Time, Date, Number), Transaction.HashBlock and transaction that created the parlay.

Latest parlay trades​

The 20 most recent parlay fills with buyer, seller, side, size and USD value.

Run this query in the IDE

query LatestParlayTrades {
EVM(network: matic, dataset: realtime) {
PredictionParlayTrades(
limit: { count: 20 }
orderBy: { descending: Block_Time }
) {
Block {
Time
Number
}
Transaction {
Hash
}
Parlay {
ConditionId
}
Outcome {
Index
}
OrderId
Buyer
Seller
IsOutcomeBuy
Amount
CollateralAmount
CollateralAmountInUSD
}
}
}

Latest parlay legs​

The legs of the most recently created parlays. Rows of one parlay share Parlay.ConditionId and the creating transaction; Leg.Index gives their order. To get the legs of one parlay, filter Parlay: { ConditionId: { is: "..." } } instead.

Run this query in the IDE

query LatestParlayLegs {
EVM(network: matic, dataset: realtime) {
PredictionParlayLegs(
limit: { count: 20 }
orderBy: [{ descending: Block_Time }, { ascending: Leg_Index }]
) {
Block {
Time
}
Transaction {
Hash
}
Parlay {
ConditionId
}
Leg {
Index
Title
OutcomeIndex
OutcomeLabel
LegacyConditionId
ConditionId
PositionId
}
}
}
}

New parlays​

Parlays created most recently, from PredictionManagements. The Marketplace.SmartContract filter keeps only markets created by the parlay exchange. Question.Title lists every leg as market = picked outcome, separated by ·, and Description holds the same legs as JSON.

Run this query in the IDE

query NewParlays {
EVM(network: matic, dataset: realtime) {
PredictionManagements(
limit: { count: 10 }
orderBy: { descending: Block_Time }
where: {
Management: {
EventType: { is: "Created" }
Prediction: {
Marketplace: {
SmartContract: { is: "0xe3333700ca9d93003f00f0f71f8515005f6c00aa" }
}
}
}
}
) {
Block {
Time
}
Transaction {
Hash
}
Management {
EventType
Description
Prediction {
Condition {
Id
Outcomes {
Index
Label
}
}
Question {
Title
}
CollateralToken {
Symbol
SmartContract
}
}
}
}
}
}

Parlay volume (last 24 hours)​

Fills, distinct parlays traded and USD volume over the last 24 hours. A match writes one row per maker fill and one row for the taker's whole fill, with the parlay exchange as the taker's counterparty. The two not filters drop the taker rows, so each dollar is counted once. TransactionStatus: { Success: true } keeps only successful transactions.

Run this query in the IDE

query ParlayVolume {
EVM(network: matic, dataset: realtime) {
PredictionParlayTrades(
where: {
Block: { Time: { since_relative: { hours_ago: 24 } } }
TransactionStatus: { Success: true }
Buyer: { not: "0xe3333700ca9d93003f00f0f71f8515005f6c00aa" }
Seller: { not: "0xe3333700ca9d93003f00f0f71f8515005f6c00aa" }
}
) {
fills: count
parlays: uniq(of: Parlay_ConditionId)
volume_usd: sum(of: CollateralAmountInUSD)
}
}
}

Markets picked most often in parlays (last 24 hours)​

Ranks leg markets and outcomes by how many new parlays included them in the last 24 hours. Use LegacyConditionId to look up the same market in PredictionTrades.

Run this query in the IDE

query MostPickedParlayLegs {
EVM(network: matic, dataset: realtime) {
PredictionParlayLegs(
limit: { count: 10 }
orderBy: { descendingByField: "parlays" }
where: { Block: { Time: { since_relative: { hours_ago: 24 } } } }
) {
Leg {
Title
OutcomeLabel
LegacyConditionId
}
parlays: uniq(of: Parlay_ConditionId)
}
}
}

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.