User Positions
Query all positions held by a specific account.
Query Structureβ
query GetUserPositions($accountId: String!, $limit: Int!) {
positions(
where: { account_id: { _eq: $accountId } }
order_by: { shares: desc }
limit: $limit
) {
id
shares
vault {
term_id
current_share_price
term {
atom { label image }
triple {
subject { label }
predicate { label }
object { label }
}
}
}
}
}
Interactive Exampleβ
Query
query GetUserPositions($accountId: String!, $limit: Int!) {
positions(
where: { account_id: { _eq: $accountId } }
order_by: { shares: desc }
limit: $limit
) {
id
shares
vault {
term_id
current_share_price
market_cap
}
}
}Variables
Click "Run Query" to execute the GraphQL query and see results
Best Practicesβ
- Order by shares to show largest positions first
- Include vault data for context
- Use aggregates for totals
- Filter by shares > 0 for active positions