# Get Portfolio History in Graphql

This query returns historical NAV values for portfolios.

[![Screenshot 2025-12-16 at 18.27.45.png](https://docs.finmars.com/uploads/images/gallery/2025-12/scaled-1680-/screenshot-2025-12-16-at-18-27-45.png)](https://docs.finmars.com/uploads/images/gallery/2025-12/screenshot-2025-12-16-at-18-27-45.png)

---

### GraphQL Query

```graphql
query GetPortfolioHistoryList {
  portfolio_history(
    pagination: {
      limit: 20
      offset: 0
    }
    filters: {
    }
  ) {
    id
    date
    nav
    portfolio {
      id
      name
      user_code
    }
    currency {
      id
      user_code
      name
    }
    status
  }
}
```

---

### Python Example

```python
import requests

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

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

payload = {
    "query": """
    query GetPortfolioHistoryList {
      portfolio_history(
        pagination: {
          limit: 20
          offset: 0
        }
        filters: {
        }
      ) {
        id
        date
        nav
        portfolio {
          id
          name
          user_code
        }
        currency {
          id
          user_code
          name
        }
        status
      }
    }
    """
}

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

---

## Notes

- <span style="white-space: pre-wrap;">Empty </span>`<span class="editor-theme-code">filters</span>`<span style="white-space: pre-wrap;"> block is valid</span>
- Add filters to limit results

Example filter:

```graphql
portfolio: {
  user_code: { exact: "Commodity Portfolio" }
}
```

- Pagination is required
- Dates use ISO format
- `<span class="editor-theme-code">status</span>`<span style="white-space: pre-wrap;"> shows calculation state</span>