Seer documentation
  • Overview
    • 📘 What is Seer?
    • 📚 Glossary
  • Getting Started
    • 💡 Wallet and network
    • 💰 Deposit tokens
      • On Ethereum
        • Deposit DAI
        • Deposit sDAI
      • On Gnosis
        • Deposit xDAI
        • Deposit wxDAI or sDAI
    • 🧭 Navigate Our Site
      • Create a market
      • Verify market
      • Mint, merge, redeem outcome tokens
      • Buy, sell outcome tokens
      • Report answer
      • Raise a dispute
      • Resolve market
      • Provide Liquidity
      • Conditional Markets
      • Futarchy Markets
  • Developers
    • 📝 Intro
    • 🔄 Diagrams
      • Seer overall interaction
      • Create Market
      • Split, Merge, Redeem
      • Question and Resolve
    • 🔗 Interact with Seer
      • Create a market
      • Resolve a market
      • Split, Merge and Redeem
      • Market example
      • Conditional market
      • Futarchy market
    • 📜 Contracts
      • Core
        • MarketFactory
        • Market
        • MarketView
        • Router
        • GnosisRouter
        • MainnetRouter
        • RealityProxy
        • Interfaces
      • Futarchy (test)
        • FutarchyFactory
        • FutarchyProposal
        • FutarchyRouter
        • FutarchyRealityProxy
      • Token
        • Seer
      • Interaction
        • 1155-to-20
          • Wrapped1155Factory
        • conditional-tokens
          • ERC1155
            • ERC1155
            • ERC1155TokenReceiver
            • IERC1155
            • IERC1155TokenReceiver
          • ConditionalTokens
          • CTHelpers
        • cross-chain-realitio-proxy
          • dependencies
            • IAMB
            • RealitioInterface
          • ArbitrationProxyInterfaces
          • RealitioForeignArbitrationProxyWithAppeals
          • RealitioHomeArbitrationProxy
        • reality
          • RealityETH-3.0
        • sDAI-on-Gnosis
          • interfaces
            • IBridgeInterestReceiver
            • IWXDAI
          • periphery
            • SavingsXDaiAdapter
          • SavingsXDai
      • Deployed contracts
    • 🌐 Subgraph
      • Query Examples
      • GraphQl Query
        • Market
        • Swapr
        • Curate
      • GraphQL Schema
      • Subgraph ID
  • OTHER
    • 🔍 Audit Reports
Powered by GitBook
On this page
  • Market Data
  • Query markets
  • Query a market
  • Liquidity and price data
  • Query pools and liquidity
  • Query price changes over a certain period
  • Curate Data
  1. Developers
  2. 🌐 Subgraph

Query Examples

Previous🌐 SubgraphNextGraphQl Query

Last updated 8 months ago

Here are some example queries to interact with Seer and third-party subgraphs. You can fetch data points like:

  • prediction markets you created

  • current liquidity of a pool

  • current prices for tokens in your portfolio

and much more. To run a query, copy and paste it into the graph explorer. You can access the graph explorer url by replacing {subgraph-id} with the .

Graph Explorer Url:

https://thegraph.com/explorer/subgraphs/{subgraph-id}

Market Data

To query market data you need to use .

You can choose to query multiple markets or a specific market by providing a market id.

Query markets

To query the first 5 markets:

{
  markets(first: 5) {
    id
    factory
    creator
    marketName
  }
}

Query a market

To query a single market:

{
  market(id: "0x034a47d592c2456a0fa94df3fa1f21af421ec07d") {
    id
    factory
    creator
    marketName
  }
}

Liquidity and price data

Query pools and liquidity

To query multiple pools with liquidity information:

{
  pools(first:10, skip:5){
    id
    liquidity
    sqrtPrice
    token0 {
      id
      symbol
    }
    token1 {
      id
      symbol
    }
  }
}

You may notice that we use skip here to get 10 pools after the first 5.

Query price changes over a certain period

Every time the prices of a pool change, a record of PoolHourData is registered. You can query for these records and filter a specific time range using periodStartUnix_lt and periodStartUnix_gt.

The following query retrieves the first 5 PoolHourData records from September 1, 2024, between 00:00 and 10:00 UTC:

{
  poolHourDatas(first: 5, where: {periodStartUnix_gt: 1725148800, periodStartUnix_lt: 1725184800}) {
    token0Price
    token1Price
    pool {
      id
      token0 {
        id
        name
      }
      token1 {
        id
        name
      }
    }
  }
}

Curate Data

To query for LItems:

{
  litems(first:5){
    itemID
    status
    registryAddress
    key0
    data
    latestRequester
  }
}

To query liquidity and price data you need to use .

Currently, Seer is using Swapr to create and provide liquidity for trading pools. Behind the scenes, Swapr uses Algebra and Algebra Subgraph, for which you can find the documentation . Inside the docs you can find more information about Algebra Subgraph schemas, queries, and other related topics.

To query curate data you need to use .

Prediction markets on Seer can go through a where you can submit images to help verify the legitimacy of a market. Each time a market enters the verification process, an LItem is created in the curate subgraph. Here, you can find information about the requester and links to market images.

actual subgraph id
Seer Subgraph
Algebra Subgraph
here
Curate Subgraph
curation process