Queries

This page provides example queries for the Predy subgraph, you can try any of these queries or write your own on the Predy subgraph playground. Refer to The Graph - GraphQL API documentation to learn how subgraph queries are structured.

Asset

Returns a list of all contracts that generated entities for the subgraph.

{
  assets {
    id
  }
}

VaultEntity

Gets the 5 most recently created vaults and returns their owner address (account) and a history of their trading/margin actions.

{
  vaultEntities(
    first: 5
    orderBy: vaultId
    orderDirection: desc
  ) {
    vaultId
    account
    history {
      txid
      subVaultIndex
      timestamp
      productId
      action
      tradeAmount
      tradePrice
      marginAmount
    }
  }
}

SubVaultEntity

Gets the subvaults for vault number XX and returns the subvault ID and metadata.

TradeHistoryEntity

Gets all trade/margin events between timestamps 1655272800 (June 15 2022 00:00:00) and 1655359200 (June 16 2022 00:00:00).

PoolDepositedEntity

Gets pool deposits over $10,000, ordered largest to smallest, return the USDC deposited and the amount of LP tokens minted.

PoolWithdrawnEntity

Get the 10 most recent pool withdrawals and return the amount of LP token burned and the USDC withdrawn.

HedgedEntity

Get the hedging actions performed, ordered oldest to most recent, and returns the amount of USDC and ETH traded and the direction of the trade.

FundingPaymentEntity

Get the highest 10 funding rates since timestamp 1655272800 (June 15 2022 00:00:00), returning the timestamp and rate.

VarianceUpdatedEntity

Gets the 10 most recent variance updates and returns the timestamp, ETH price, and variance for those updates.

MetricsEntity

Gets the metrics entities for the current PerpetualMarket contract (0xadbaee9665c101413ebff07e20520bdb67c71ab6).

AggregatedVolume

Gets all WEEKLY aggregated volume statistics for product ID 1 (ETH²)

AggregatedFundingPayment

Gets the aggregated DAILY funding statistics since timestamp 1655078400 (June 13 2022 00:00:00) for product ID 0 (ETH).

LPTokenPriceEntity

Gets the first 100 LP token price updates since timestamp 1655078400 (June 13 2022 00:00:00).

AggregatedLpTokenPriceEntity

Gets the aggregated WEEKLY LP token price details (open, close, high, low) ordered by most recent to oldest.

OpenInterestEntity

Gets the latest 50 open interest updates for product ID 1 (ETH²).

AggregatedOpenInterestEntity

Gets the aggregated HOURLY open interest details (open, close, high, low) for the past 24 hours, ordered by most recent to oldest.

Last updated