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β
| Operation | Description |
|---|---|
getAccountPnlCurrent | Current account PnL snapshot with equity value, net invested, and unrealized gains |
getAccountPnlChart | Account PnL time-series data with configurable intervals |
getAccountPnlRealized | Realized PnL data for an account over a time range |
getPositionPnlChart | Position-level PnL time-series for a specific vault |
PnL Methodologyβ
All PnL calculations use the following formulas:
| Metric | Formula |
|---|---|
equity_value | shares_total * share_price / 1e18 |
net_invested | total_assets_in - total_assets_out |
total_pnl | equity_value + total_assets_out - total_assets_in |
pnl_pct | (total_pnl / net_invested) * 100 when net_invested > 0, otherwise 0 |
unrealized_pnl | equity_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_idandcurve_id)
Performance Reportingβ
Generate performance reports with:
- Time-series PnL data at hourly, daily, weekly, or monthly intervals
- Realized PnL over configurable time ranges
Related Documentationβ
- Account PnL Current - Current PnL snapshot
- Account PnL Chart - Historical PnL data
- Account PnL Realized - Realized PnL data
- Position PnL Chart - Position-level tracking