Subgraph & Data 
Twin.fun’s subgraph indexes trades, holders, and protocol stats for analytics and integrations.
Entities 
- DigitalTwin— id, owner, URL, currentSupply, prices, caps, volumes, trades.
- Trade—- isBuy,- shareAmount,- ethAmount,- pricePerShare,- totalCost,- supplyAfter,- timestamp,- trader.
- Trader— aggregate buys, sells, fees, first/last activity.
- Holder— balance per twin, totals, first/last actions.
- Candle— minute/5m/hour/day OHLC with volumes and trade counts.
- ProtocolStats— protocol-wide totals.
Example Queries 
Get a Twin 
graphql
query GetDigitalTwin($id: ID!) {
  digitalTwin(id: $id) {
    id owner url currentSupply lastPrice marketPrice marketCap
    totalVolumeETH totalTrades totalBuys totalSells createdAt lastTradeAt
    holders(first: 5, orderBy: balance, orderDirection: desc) {
      trader { id }
      balance
    }
  }
}Recent Trades 
graphql
query TwinTrades($id: ID!) {
  trades(first: 25, orderBy: timestamp, orderDirection: desc,
         where: { digitalTwin: $id }) {
    isBuy shareAmount ethAmount pricePerShare totalCost supplyAfter timestamp
    trader { id }
  }
}Top Holders 
graphql
query TopHolders {
  holders(first: 20, orderBy: balance, orderDirection: desc) {
    id balance
    digitalTwin { id owner }
    trader { id }
  }
}Endpoints 
- Base Sepolia: <your-subgraph-url>
- Mainnet: <your-subgraph-url>
