Query Examples

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 actual subgraph id.

Graph Explorer Url:

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

Market Data

To query market data you need to use Seer Subgrapharrow-up-right.

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:

Liquidity and price data

To query liquidity and price data you need to use Algebra Subgrapharrow-up-right.

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 herearrow-up-right. Inside the docs you can find more information about Algebra Subgraph schemas, queries, and other related topics.

Query pools and liquidity

To query multiple pools with liquidity information:

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:

Curate Data

To query curate data you need to use Curate Subgrapharrow-up-right.

Prediction markets on Seer can go through a curation processarrow-up-right 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.

To query for LItems:

Last updated