Querying the Enso Subgraph
This doc will teach you how to query Enso analytics by writing GraphQL queries on the subgraph. You can fetch data points like :
- Strategies info, TVL and prices
- Historical data for strategies and managers
- Strategies state changes: rebalance and restructure
and much more. Below are some example queries. To run a query copy and paste it into the enso explorer to get fresh data.
You can play around with the Enso Subgraph using The Graph's online sandbox.
To programmatically query the Enso Subgraph you can send queries to:
https://api.thegraph.com/subgraphs/name/enso/enso-v1
#
Strategies Informations queriesStrategy created on enso. Each strategy is Tokenizes as an ERC20.
#
Strategy Info{ strategy(id: "") { id manager name symbol state { threshold social fee slippage timelock } nav tvl items { token { id name } percentage balance } totalSupply }}
#
Strategies by Manager{ strategy(where: { manager: "" }) { id manager name symbol state { threshold social fee slippage timelock } nav tvl items { token { id name } percentage balance } totalSupply }}
#
Manager{ manager(id: "") { strategiesCount strategies { id name } tvl totalNav commonItems { id token strategy percentage } managerDaysData { id manager timestamp tvlLastTracked totalNavLastTracked strategiesAverageNav holdersCount } }}
#
Historical Data{ strategyDaysData(where: { strategy: "" }) { id strategy timestamp tvlLastTracked navLastTracked holdersCount }}
#
Strategy structure changes#
Rebelances by strategy{ rebalance(id: "") { id txHash strategy timestamp before after }}
#
Restructure by strategy{ restructure(id: "") { id txHash strategy timestamp before after }}