Account PnL Rank
Look up a single account's leaderboard rank and percentile using get_account_pnl_rank. Returns account_pnl_rank rows.
Query Structureβ
query GetAccountPnlRank {
get_account_pnl_rank(
args: {
p_account_id: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
p_sort_by: "total_pnl"
}
) {
account_id
account_label
account_image
rank
percentile
total_pnl
pnl_pct
total_volume
total_position_count
win_rate
total_accounts
}
}
Function Argumentsβ
| Argument | Type | Description |
|---|---|---|
p_account_id | String | Account address to look up |
p_sort_by | String | Ranking metric (e.g. "total_pnl", "pnl_pct", "win_rate") |
p_term_id | String | Optional term filter |
p_time_filter | String | Optional time filter preset |
Response Fields (account_pnl_rank)β
| Field | Type | Description |
|---|---|---|
account_id | String | Account address |
account_label | String | Display name |
account_image | String | Profile image URL |
rank | bigint | Leaderboard rank position |
percentile | numeric | Percentile ranking (0-100) |
total_pnl | numeric | Total profit/loss |
pnl_pct | numeric | PnL percentage |
total_volume | numeric | Total trading volume |
total_position_count | bigint | Total number of positions |
win_rate | numeric | Win rate across positions |
total_accounts | bigint | Total accounts on the leaderboard |
Interactive Exampleβ
Query
query GetAccountPnlRank {
get_account_pnl_rank(
args: {
p_account_id: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
p_sort_by: "total_pnl"
}
) {
account_id
account_label
rank
percentile
total_pnl
pnl_pct
win_rate
total_accounts
}
}Variables
Click "Run Query" to execute the GraphQL query and see results
Use Casesβ
Profile Rank Badgeβ
Display a user's rank on their profile:
import { GraphQLClient } from 'graphql-request'
import { API_URL_PROD } from '@0xintuition/graphql'
const client = new GraphQLClient(API_URL_PROD)
async function getAccountRank(accountId: string) {
const query = `
query GetAccountPnlRank {
get_account_pnl_rank(
args: {
p_account_id: "${accountId}"
p_sort_by: "total_pnl"
}
) {
rank
percentile
total_pnl
pnl_pct
total_accounts
}
}
`
const data = await client.request(query)
return data.get_account_pnl_rank[0]
}
Relatedβ
- PnL Leaderboard - Full leaderboard rankings
- Leaderboard Stats - Aggregate protocol statistics
- Account PnL Current - Detailed PnL snapshot