Skip to main content

Profit & Loss (PnL) Queries

The Intuition GraphQL API provides Profit and Loss (PnL) queries to track portfolio performance, analyze realized gains, and visualize value changes over time. These queries are powered by the chart-api service and exposed through Hasura as GraphQL actions.

Available PnL Operations​

OperationDescription
getAccountPnlCurrentCurrent account PnL snapshot with equity value, net invested, and unrealized gains
getAccountPnlChartAccount PnL time-series data with configurable intervals
getAccountPnlRealizedRealized PnL data for an account over a time range
getPositionPnlChartPosition-level PnL time-series for a specific vault

PnL Methodology​

All PnL calculations use the following formulas:

MetricFormula
equity_valueshares_total * share_price / 1e18
net_investedtotal_assets_in - total_assets_out
total_pnlequity_value + total_assets_out - total_assets_in
pnl_pct(total_pnl / net_invested) * 100 when net_invested > 0, otherwise 0
unrealized_pnlequity_value - net_invested

Input Pattern​

All PnL queries use a single input object argument rather than separate parameters:

query GetAccountPnlCurrent($input: GetAccountPnlCurrentInput!) {
getAccountPnlCurrent(input: $input) {
equity_value
net_invested
total_pnl
pnl_pct
}
}
{
"input": {
"account_id": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
}
}

Use Cases​

Portfolio Dashboard​

Build portfolio views showing:

  • Current equity value and net invested amount
  • Total and unrealized PnL with percentage
  • Historical performance charts with configurable intervals

Position Analysis​

Track individual position performance:

  • Position-level PnL trends over time
  • Compare performance across different vaults (by term_id and curve_id)

Performance Reporting​

Generate performance reports with:

  • Time-series PnL data at hourly, daily, weekly, or monthly intervals
  • Realized PnL over configurable time ranges