Creating Subgraph Queries

Queries for the Carbon DeFi Subgraph can be generated using The Graph's interactive explorer. The following explains how to interact

To Generate Queries

  1. Navigate to the interactive explorer: Carbon DeFi Subgraph

  2. Click the folder icon on the right to open the explorer:

  3. Select or deselect variable names to adjust the query. For example to see the latest trades and some of their relevant details, select trades and one or more variables below it.

  4. Click the play button to see an example of the results of your current query. Once satisfied, continue.

  5. Copy the query into your code. For example, in Python:

    query = """
    
    {
      trades {
        sourceToken {
          symbol
        }
        targetToken {
          symbol
        }
        sourceAmount
        targetAmount
        transactionHash
      }
    }
    """

Last updated