You can follow the official GraphQL guide here to learn more about GraphQL, how it works, and how to use it:
Network | GraphQL Endpoint |
---|---|
Centrifuge | |
Dev |
Queries can be tested in a dedicated SubQL Sandbox. The SubQL documentation provides some insights on how to perform queries in their SubQuery explorer.
Here some important hints and common pitfalls that can save you some time when working woth our data:
Currencies and Token amounts are expressed in fixed decimal precision
As pools have different reference currencies, the amount this precision can vary. For this matter we reference the Currency entity in Pools, so that the correct amount of decimals can be queried together with each pool.
Queries return a maximum of 100 entries per page by default
This can be increased to a maximum of 1000 entries per page in production environments. Sanbox environments are limited to 100 results.
Entities ids are not necessarily the same as on chain ids Therefore, when querying an entity, always refer to the GraphQL data model to verify how the id is composed.
1{2 pools {3 nodes {4 id5 currency {6 id7 decimals8 }9 portfolioValuation10 sumNumberOfActiveLoans11 }12 }13}
1{2 account(id: "kALNreUp6oBmtfG87fe7MakWR8BnmQ4SmKjjfG27iVd3nuTue") {3 id4 outstandingOrders {5 nodes {6 investAmount7 redeemAmount8 trancheId9 }10 }11 investorTransactions(last: 2) {12 nodes {13 type14 currencyAmount15 tokenAmount16 }17 }18 currencyBalances {19 nodes {20 amount21 }22 }23 trancheBalances {24 nodes {25 trancheId26 sumInvestOrderedAmount27 sumInvestCollectedAmount28 sumInvestUncollectedAmount29 }30 }31 }32}
1{2 pool(id: "2825130900") {3 id4 currency {5 id6 decimals7 }8 loans {9 nodes {10 id11 outstandingDebt12 }13 }14 }15}
1{2 trancheSnapshots(3 orderBy: TIMESTAMP_ASC4 filter: {5 trancheId: { equalTo: "1873519631-0xb05f8e95eaf6ffc940ab4b4fbcb6324b" }6 }7 ) {8 nodes {9 id10 timestamp11 tokenPrice12 tokenSupply13 }14 }15}
The TVL for each pool can be obtained with the following query:
1{2 pools {3 nodes {4 value5 }6 }7}
The total for the entire CFG ecosystem is obtained by summing across all results.