---
title: Account PnL Chart
description: Query historical Profit and Loss data for charting
url: https://docs.intuition.systems/docs/v1/graphql-api/queries/pnl/account-pnl-chart
markdown_url: https://docs.intuition.systems/docs/v1/graphql-api/queries/pnl/account-pnl-chart.md
version: V1
llms_index: https://docs.intuition.systems/docs/v1/llms.txt
---

Get historical Profit and Loss (PnL) time-series data for an account, suitable for charting portfolio performance over configurable intervals.

## Account PnL Chart - Query Structure

```graphql
query GetAccountPnlChart($input: GetAccountPnlChartInput!) {
  getAccountPnlChart(input: $input) {
    account_id
    count
    data {
      timestamp
      equity_value
      net_invested
      total_pnl
      pnl_pct
    }
    interval
  }
}
```

## Variables

The query takes a single `input` object:

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `account_id` | `String` | Yes | Account address to query |
| `interval` | `String` | Yes | Time interval for data points (e.g. `"1h"`, `"1d"`, `"1w"`, `"1M"`) |
| `start_time` | `String` | Yes | Start of the time range (ISO 8601 timestamp) |
| `end_time` | `String` | Yes | End of the time range (ISO 8601 timestamp) |

```json
{
  "input": {
    "account_id": "0x88D0aF73508452c1a453356b3Fac26525aEc23A2",
    "interval": "1d",
    "start_time": "2024-01-01T00:00:00Z",
    "end_time": "2024-01-31T23:59:59Z"
  }
}
```

## Response Fields

| Field | Type | Description |
|-------|------|-------------|
| `account_id` | `String` | The queried account address |
| `count` | `Int` | Number of data points returned |
| `data` | `JSON` | Array of PnL data points for the time range |
| `interval` | `String` | The interval used for aggregation |

## Expected Response

```json
{
  "data": {
    "getAccountPnlChart": {
      "account_id": "0x88D0aF73508452c1a453356b3Fac26525aEc23A2",
      "count": 31,
      "data": [
        {
          "timestamp": "2024-01-01T00:00:00Z",
          "equity_value": "10.000000000000000000",
          "net_invested": "10.000000000000000000",
          "total_pnl": "0.000000000000000000",
          "pnl_pct": 0.0
        },
        {
          "timestamp": "2024-01-02T00:00:00Z",
          "equity_value": "10.500000000000000000",
          "net_invested": "10.000000000000000000",
          "total_pnl": "0.500000000000000000",
          "pnl_pct": 5.0
        }
      ],
      "interval": "1d"
    }
  }
}
```

## Interactive Example

    id: 'daily-pnl',
    title: 'Daily PnL Chart',
    query: `query GetAccountPnlChart($input: GetAccountPnlChartInput!) {
  getAccountPnlChart(input: $input) {
    account_id
    count
    data {
      timestamp
      equity_value
      net_invested
      total_pnl
      pnl_pct

    interval

}`,
    variables: {
      input: {
        account_id: '0x88D0aF73508452c1a453356b3Fac26525aEc23A2',
        interval: '1d',
        start_time: '2024-01-01T00:00:00Z',
        end_time: '2024-01-31T23:59:59Z'

];

## Use Cases

### Portfolio Performance Chart

Build a line chart showing portfolio value over time:

```typescript
import { GraphQLClient } from 'graphql-request'
import { API_URL_PROD } from '@0xintuition/graphql'

const client = new GraphQLClient(API_URL_PROD)

async function getPnlChartData(accountId: string, days: number = 30) {
  const endTime = new Date()
  const startTime = new Date()
  startTime.setDate(startTime.getDate() - days)

  const query = `
    query GetAccountPnlChart($input: GetAccountPnlChartInput!) {
      getAccountPnlChart(input: $input) {
        account_id
        count
        data
        interval
      }
    }
  `

  const data = await client.request(query, {
    input: {
      account_id: accountId,
      interval: '1d',
      start_time: startTime.toISOString(),
      end_time: endTime.toISOString()
    }
  })

  return data.getAccountPnlChart
}
```

## Best Practices

1. **Choose appropriate intervals** - Use `"1h"` for recent data, `"1d"` for weekly/monthly views, `"1w"` or `"1M"` for longer periods
2. **Limit date ranges** - Request only the data needed; smaller ranges return faster
3. **Handle empty data** - Display an appropriate message when `count` is 0

## Related

- [Account PnL Current](https://docs.intuition.systems/docs/v1/graphql-api/queries/pnl/account-pnl-current) - Current PnL snapshot
- [Position PnL Chart](https://docs.intuition.systems/docs/v1/graphql-api/queries/pnl/position-pnl-chart) - Position-level charts
- [Account PnL Realized](https://docs.intuition.systems/docs/v1/graphql-api/queries/pnl/account-pnl-realized) - Realized PnL data
