Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.chainstream.io/llms.txt

Use this file to discover all available pages before exploring further.

Overview

ChainStream GraphQL provides three Cubes for prediction market data, primarily available on Polygon. These Cubes cover the full lifecycle of prediction markets — from creation and trading to settlement.
Prediction Market Cubes are available in the EVM Chain Group. They are primarily used with network: polygon.

PredictionTrades

Recent Prediction Market Trades

query {
  EVM(network: polygon) {
    PredictionTrades(
      limit: {count: 20}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Transaction { Hash }
      Trade {
        Buyer
        Seller
        Amount
        Price
        Fee
      }
      Prediction {
        Condition { Id Outcomes }
        Question { Id }
        Outcome
        Marketplace { ProtocolName }
      }
    }
  }
}

Trades for a Specific Condition

query {
  EVM(network: polygon) {
    PredictionTrades(
      conditionId: {is: "CONDITION_ID"}
      limit: {count: 50}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Trade { Buyer Seller Amount Price }
      Prediction { Outcome OutcomeToken { SmartContract } }
    }
  }
}

Trade Volume by Marketplace

query {
  EVM(network: polygon) {
    PredictionTrades(
      marketplace: {is: "Polymarket"}
      limit: {count: 100}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Trade { Amount Price }
      Prediction {
        Question { Id }
        Marketplace { ProtocolName }
      }
      count
      sum(of: Trade_Amount)
    }
  }
}

PredictionManagements

Market Creation and Resolution Events

query {
  EVM(network: polygon) {
    PredictionManagements(
      limit: {count: 20}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Transaction { Hash }
      Management {
        EventType
        Description
        Group
        Prediction {
          Condition { Id }
          Question { Id }
          Marketplace { ProtocolName }
        }
      }
    }
  }
}

Filter by Event Type

query {
  EVM(network: polygon) {
    PredictionManagements(
      eventType: {is: "ConditionResolution"}
      limit: {count: 20}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Management {
        EventType
        Description
        Prediction { Condition { Id Outcomes } }
      }
    }
  }
}

PredictionSettlements

Recent Settlements

query {
  EVM(network: polygon) {
    PredictionSettlements(
      limit: {count: 20}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Transaction { Hash }
      Settlement {
        EventType
        Holder
        OutcomeTokenIds
        Amounts
        Prediction {
          Condition { Id }
          CollateralToken { SmartContract Symbol }
          Marketplace { ProtocolName }
        }
      }
    }
  }
}

Settlements for a Specific Holder

query {
  EVM(network: polygon) {
    PredictionSettlements(
      holder: {is: "0xHOLDER_ADDRESS"}
      limit: {count: 50}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Settlement {
        EventType
        Amounts
        Prediction { Condition { Id } }
      }
    }
  }
}

Data Cubes

Detailed field structures for Prediction Market Cubes.

Chain Groups

Prediction Cubes are EVM-only, primarily on Polygon.