get_aggregates
Type: query
Gets aggregate spending totals with optional filters. Returns summary statistics including total income and expenses for the specified filters.
Signature
async def get_aggregates(
start_date: str | None = None,
end_date: str | None = None,
category_ids: List[str] | None = None,
account_ids: List[str] | None = None
) -> Dict[str, Any]
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
start_date | `str | None` | No |
end_date | `str | None` | No |
category_ids | `List[str] | None` | No |
account_ids | `List[str] | None` | No |
Returns
Dict with aggregates containing summary (sumExpense, sumIncome)
Example
from monarchmoney import MonarchMoney
mm = MonarchMoney()
await mm.login(email, password)
result = await mm.get_aggregates()
print(result)
GraphQL Operation
Operation Name: GetAggregates
GraphQL Query
query GetAggregates($filters: TransactionFilterInput!) {
aggregates(filters: $filters) {
summary {
sumExpense
sumIncome
}
}
}
Try It Out
To test this API method locally:
- Install the package:
pip install monarchmoney - Create a Python script with the example code above
- Replace
emailandpasswordwith your Monarch Money credentials - Run the script
See the Authentication Guide for details on logging in.