# Get Profit & Loss (PNL) Report in Graphql

This query returns a pnl report for selected portfolios on a given date.

[![Screenshot 2026-01-13 at 20.47.48.png](https://docs.finmars.com/uploads/images/gallery/2026-01/scaled-1680-/screenshot-2026-01-13-at-20-47-48.png)](https://docs.finmars.com/uploads/images/gallery/2026-01/screenshot-2026-01-13-at-20-47-48.png)

---

### GraphQL Query

```graphql
query GetPLReport {
  pl_report(
    input: {
      report_date: "2024-05-01"
      pricing_policy: "com.finmars.standard-pricing:standard"
      portfolios: ["Commodity Portfolio"]
    }
  ) {
    items {
      id
      item_type
      item_type_name
      name
      market_value
      position_size
    }
  }
}
```

---

## Input Highlights

### Report Date

```graphql
report_date: "2024-05-01"
```

- Snapshot date
- ISO date format
- Required field

### PL First Date

```graphql
pl_first_date: "2024-01-01"
```

- Snapshot date
- ISO date format
- Required field
- Basically its a "date from"

---

### Report Currency

```graphql
report_currency: "USD"
```

- Output currency
- Must exist in the system

---

### Pricing Policy

```graphql
pricing_policy: "com.finmars.standard-pricing:standard"
```

- Defines valuation rules
- Uses pricing engine configuration
- Required for valuation

---

### Portfolios

```graphql
portfolios: ["Commodity Portfolio"]
```

- List of portfolio user codes
- Supports multiple portfolios

---

### Python Code

```python
import requests

url = "https://<domain_name>/<realm_code>/<space_code>/graphql/"

headers = {
    "Authorization": "Bearer <access_token>",
    "Content-Type": "application/json"
}

payload = {
    "query": """
query GetPLReport {
  pl_report(
    input: {
      report_date: "2024-05-01"
      pricing_policy: "com.finmars.standard-pricing:standard"
      portfolios: ["Commodity Portfolio"]
    }
  ) {
    items {
      id
      item_type
      item_type_name
      name
      market_value
      position_size
    }
  }
}
    """
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

---

### Notes

- <span style="white-space: pre-wrap;">This is </span>**not**<span style="white-space: pre-wrap;"> a list query.</span>
- No pagination.
- <span style="white-space: pre-wrap;">Uses </span>`<span class="editor-theme-code">input</span>`<span style="white-space: pre-wrap;"> instead of </span>`<span class="editor-theme-code">filters</span>`.
- Report queries execute calculations.