Skip to main content

Subgraphs on Amoy

Forkast publishes a collection of read-only subgraphs on Polygon Amoy so builders can analyze activity without running archival nodes. Each endpoint is hosted on The Graph Studio and is updated every few blocks, mirroring the same data our internal analytics team uses.
You can query any subgraph with GraphQL over HTTPS. Set the content-type: application/json header and post a JSON payload containing a query field plus optional variables.

Available endpoints

Env varURLPurpose
PNL_SUBGRAPH_URLhttps://api.studio.thegraph.com/query/113376/forkast-pnl/version/latestUnrealized/realized PnL per wallet and per condition.
ORDERBOOK_SUBGRAPH_URLhttps://api.studio.thegraph.com/query/113376/forkast-orderbook/version/latestLevel-2 quotes, resting orders, and fill aggregates.
ACTIVITY_SUBGRAPH_URLhttps://api.studio.thegraph.com/query/113376/forkast-activity/version/latestSplits, merges, redeems, transfers, and rewards history.
OPEN_INTEREST_SUBGRAPH_URLhttps://api.studio.thegraph.com/query/116566/forkast-oi/version/latestOutstanding collateral per market and event.
WALLET_SUBGRAPH_URLhttps://api.studio.thegraph.com/query/116566/forkast-wallet/version/latestWallet-scoped balances, events, and net exposure snapshots.
FPMM_SUBGRAPH_URLhttps://api.studio.thegraph.com/query/116566/forkast-fpmm/version/latestFixed-product market maker (FPMM) pools that backstop liquidity.
Store these URLs in your build system or .env file so scripts can swap between staging and production more easily. Although Amoy is our default development network, the structure mirrors mainnet, making it simple to promote the same queries later on.

Example query

curl -X POST "$PNL_SUBGRAPH_URL" \
  -H 'content-type: application/json' \
  -d '{
    "query": "{ wallet (id: \"0xabc...\") { id realizedPnL unrealizedPnL } }"
  }'
The response follows the GraphQL specification, so you can rely on strongly typed schemas, pagination via first/skip, and reusable fragments.

Monitoring and pagination tips

  • Most Forkast subgraphs expose meta { block { number } }. Poll this to ensure your backend is ingesting a sufficiently fresh block height.
  • When syncing historical data, paginate by deterministic fields such as timestamp or blockNumber. This avoids skipping data if the indexer reorders IDs.
  • Use field-level filters (e.g., where: { condition_in: [...] }) to stay within the default 100-item limit and reduce response latency.

When to use the Data API instead

If you need curated aggregates, such as leaderboard snapshots or normalized mark prices, our RESTful Data API includes caching. Subgraphs remain the better choice when you need raw, verifiable on-chain events or want to power your own analytics warehouse.