Skip to main content

PnL Leaderboard

Rank accounts by PnL performance using get_pnl_leaderboard and get_pnl_leaderboard_period. Both return pnl_leaderboard_entry rows.

Query Structure​

query GetPnlLeaderboard {
get_pnl_leaderboard(
args: {
p_limit: 10
p_offset: 0
p_sort_by: "total_pnl"
p_sort_order: "desc"
}
) {
account_id
account_label
account_image
rank
pnl_pct
win_rate
total_pnl_formatted
total_pnl_raw
unrealized_pnl_formatted
realized_pnl_formatted
current_equity_value_formatted
total_volume_formatted
active_position_count
total_position_count
winning_positions
losing_positions
best_trade_pnl_formatted
worst_trade_pnl_formatted
first_position_at
last_activity_at
}
}

Function Arguments​

ArgumentTypeDescription
p_limitIntNumber of results to return
p_offsetIntOffset for pagination
p_sort_byStringField to sort by (e.g. "total_pnl", "pnl_pct", "win_rate")
p_sort_orderStringSort direction: "asc" or "desc"
p_term_idStringFilter to a specific term
p_time_filterStringTime filter preset
p_start_timetimestamptzStart of time range
p_end_timetimestamptzEnd of time range
p_min_positionsIntMinimum position count filter
p_min_volumenumericMinimum volume filter
p_exclude_protocol_accountsBooleanExclude protocol-owned accounts

Response Fields (pnl_leaderboard_entry)​

Identity​

FieldTypeDescription
account_idStringAccount address
account_labelStringDisplay name
account_imageStringProfile image URL
rankbigintLeaderboard rank

PnL Metrics​

FieldTypeDescription
pnl_pctnumericPnL percentage
win_ratenumericWin rate across positions
total_pnl_formattednumericTotal PnL (formatted)
total_pnl_rawnumericTotal PnL (raw wei)
unrealized_pnl_formattednumericUnrealized PnL (formatted)
unrealized_pnl_rawnumericUnrealized PnL (raw)
realized_pnl_formattednumericRealized PnL (formatted)
realized_pnl_rawnumericRealized PnL (raw)
pnl_change_formattednumericPnL change (formatted)
pnl_change_rawnumericPnL change (raw)

Portfolio​

FieldTypeDescription
current_equity_value_formattednumericCurrent equity value (formatted)
current_equity_value_rawnumericCurrent equity value (raw)
total_deposits_formattednumericTotal deposits (formatted)
total_deposits_rawnumericTotal deposits (raw)
total_redemptions_formattednumericTotal redemptions (formatted)
total_redemptions_rawnumericTotal redemptions (raw)
total_volume_formattednumericTotal volume (formatted)
total_volume_rawnumericTotal volume (raw)
redeemable_assets_formattednumericRedeemable assets (formatted)
redeemable_assets_rawnumericRedeemable assets (raw)

Trades​

FieldTypeDescription
best_trade_pnl_formattednumericBest trade PnL (formatted)
best_trade_pnl_rawnumericBest trade PnL (raw)
worst_trade_pnl_formattednumericWorst trade PnL (formatted)
worst_trade_pnl_rawnumericWorst trade PnL (raw)
active_position_countbigintCurrently active positions
total_position_countbigintTotal positions (all time)
winning_positionsbigintPositions with positive PnL
losing_positionsbigintPositions with negative PnL
first_position_attimestamptzFirst position timestamp
last_activity_attimestamptzMost recent activity

Period-Scoped​

Use get_pnl_leaderboard_period to scope results to a specific date range:

query GetPnlLeaderboardPeriod {
get_pnl_leaderboard_period(
args: {
p_limit: 10
p_offset: 0
p_sort_by: "total_pnl"
p_sort_order: "desc"
p_start_date: "2024-01-01T00:00:00Z"
p_end_date: "2024-01-31T23:59:59Z"
}
) {
account_id
account_label
rank
total_pnl_formatted
pnl_pct
win_rate
}
}

Period Arguments​

ArgumentTypeDescription
p_limitIntNumber of results
p_offsetIntPagination offset
p_sort_byStringSort field
p_sort_orderStringSort direction
p_start_datetimestamptzPeriod start date
p_end_datetimestamptzPeriod end date
p_term_idStringFilter to specific term
p_min_positionsIntMinimum position count
p_min_volumenumericMinimum volume
p_exclude_protocol_accountsBooleanExclude protocol accounts

Interactive Example​

Query

query GetPnlLeaderboard {
  get_pnl_leaderboard(
    args: {
      p_limit: 10
      p_sort_by: "total_pnl"
      p_sort_order: "desc"
    }
  ) {
    account_id
    account_label
    rank
    total_pnl_formatted
    pnl_pct
    win_rate
    active_position_count
  }
}

Variables

Click "Run Query" to execute the GraphQL query and see results