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):
| Cube | One row per | Use it for |
|---|---|---|
PredictionParlayTrades | fill of a parlay order | parlay trades, volume, buyers and sellers |
PredictionParlayLegs | leg of a parlay, written when the parlay is created | what 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
| Field | Description |
|---|---|
Parlay.ConditionId | Condition ID of the parlay market. Joins to PredictionParlayLegs on Parlay.ConditionId. |
Outcome.Index | Parlay outcome traded: 0 = Yes (every leg wins), 1 = No. |
Buyer, Seller | The 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). |
IsOutcomeBuy | Same meaning as in PredictionTrades: true when the Seller gives collateral and the Buyer gives outcome tokens, false the other way round. |
Amount | Parlay outcome tokens filled. |
CollateralAmount, CollateralAmountInUSD | Collateral paid (pUSD) and its USD value. |
CollateralToken.SmartContract, CollateralToken.Decimals | Collateral token contract (pUSD) and its decimals. |
OutcomeToken.Decimals | Decimals of the parlay outcome token. |
OrderId | Order hash of the filled order. |
Block (Time, Date, Number), Transaction.Hash, Call (Index, Reverted), Log.Index, TransactionStatus.Success | Where the fill happened on chain. |
PredictionParlayLegs
| Field | Description |
|---|---|
Parlay.ConditionId | Condition ID of the parlay this leg belongs to. |
Leg.Index | Position of the leg in the parlay, starting at 1. |
Leg.Title | Question of the leg market (for example Spurs vs. Suns). |
Leg.OutcomeIndex, Leg.OutcomeLabel | Outcome the parlay needs from this leg. |
Leg.LegacyConditionId | Conditional 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.ConditionId | Condition ID of the leg market in the parlay exchange's format. |
Leg.PositionId | Position (token) ID of the picked outcome of the leg. |
Block (Time, Date, Number), Transaction.Hash | Block and transaction that created the parlay. |
Latest parlay trades
The 20 most recent parlay fills with buyer, seller, side, size and USD value.
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.
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.
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.
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.
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)
}
}
}
Related
- Prediction Market API: lifecycle overview
- Prediction Market Trades API: single-market trades
- Prediction Market Settlements API: splits, merges and redemptions
- Polymarket API: Polymarket guides and contract addresses
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.