URL: /api-reference/metrics

---
title: 'Metrics & Aggregation'
description: 'Metric definitions, units, and how each metric aggregates across time intervals'
icon: 'function'
---

The Open Electricity API exposes time-series data for the NEM and WEM networks at multiple intervals: 5-minute (`interval`), hourly (`hour`), daily (`day`), weekly (`week`), monthly (`month`), quarterly (`quarter`), seasonal (`season`), and yearly (`year`). The **5-minute interval is the source resolution** — every longer interval is aggregated from those 5-minute records.

How a metric aggregates depends on whether it is a **rate** (e.g. power in MW — an instantaneous measurement) or a **quantity** (e.g. energy in MWh — accumulated over an interval).

- **Rates aggregate with averaging.** Twelve 5-minute power readings, averaged, give the average power over the hour.
- **Quantities aggregate with summing.** Twelve 5-minute energy values, summed, give the total energy in the hour.

This page lists every metric returned by the API along with its unit, type, and per-interval aggregation rule.

## Generation data — `/v4/data/network/{network_code}` and `/v4/data/facilities/{network_code}`

| Metric | Unit | Type | 5-min source | Aggregation (hour+) |
|--------|------|------|--------------|---------------------|
| `power` | MW | Rate | `unit_intervals.generated` | **Average** of source values over the interval |
| `energy` | MWh | Quantity | `unit_intervals.energy` | **Sum** of source values |
| `emissions` | tCO₂ | Quantity | `unit_intervals.emissions` | **Sum** of source values |
| `market_value` | AUD | Quantity | `unit_intervals.market_value` | **Sum** of source values |
| `storage_battery` | MWh | Rate (state of charge) | `unit_intervals.energy_storage` | **Average** of source values |

### Aggregation details

- **Hourly (`hour`)** queries read from the 5-minute base table (`unit_intervals`) and apply `avg()` or `sum()` directly across the twelve 5-minute records in each hour.
- **Daily and longer (`day`, `week`, `month`, `quarter`, `season`, `year`)** queries read from the daily materialised view (`unit_intervals_daily_mv`). The daily MV stores `generated` as the daily **sum** of 5-minute power values plus an `interval_count` column. For `power`, the API computes an interval-weighted average across the queried daily rows:

  ```
  sum(generated) / sum(interval_count)
  ```

  This is equivalent to the average of the original 5-minute readings over the queried window, including partial first/last days where `interval_count < 288`.
- **`energy`, `emissions`, `market_value`** sum across the queried daily rows directly.
- **`storage_battery`** uses an interval-weighted average over the daily MV's `energy_storage_sum / energy_storage_count` columns.

### How 5-minute energy values are produced

Each 5-minute `energy` value is computed by Open Electricity from the corresponding `generated` (MW) readings using the trapezoidal rule (area under the power curve):

```
energy_i (MWh) = (generated_i + generated_{i-1}) / 2 × Δt
```

where `Δt` is the interval length in hours (e.g. `5/60` for NEM 5-minute data). At crawl time a placeholder value of `generated × Δt` is written immediately so freshly-ingested intervals have a value, then the energy worker (`opennem/workers/energy.py`) replaces it with the trapezoidal calculation and stamps `energy_quality_flag = 2`. The API returns the post-worker value; it does not re-derive energy from power at query time.

See the [Energy guide](/guides/energy) for the full derivation and worked example.

## Market data — `/v4/market/network/{network_code}`

| Metric | Unit | Type | Aggregation (hour+) |
|--------|------|------|---------------------|
| `price` | AUD/MWh | Rate | **Interval-weighted average** |
| `demand` | MW | Rate | <Tooltip tip="Known issue — currently sums; see Known issues below">**Sum** *</Tooltip> |
| `demand_energy` | MWh | Quantity | **Sum** |
| `demand_gross` | MW | Rate | <Tooltip tip="Known issue — currently sums; see Known issues below">**Sum** *</Tooltip> |
| `demand_gross_energy` | MWh | Quantity | **Sum** |
| `generation_renewable` | MW | Rate | <Tooltip tip="Known issue — currently sums; see Known issues below">**Sum** *</Tooltip> |
| `generation_renewable_energy` | MWh | Quantity | **Sum** |
| `generation_renewable_with_storage` | MW | Rate | <Tooltip tip="Known issue — currently sums; see Known issues below">**Sum** *</Tooltip> |
| `generation_renewable_with_storage_energy` | MWh | Quantity | **Sum** |
| `curtailment` | MW | Rate | <Tooltip tip="Known issue — currently sums; see Known issues below">**Sum** *</Tooltip> |
| `curtailment_solar_utility` | MW | Rate | <Tooltip tip="Known issue — currently sums; see Known issues below">**Sum** *</Tooltip> |
| `curtailment_wind` | MW | Rate | <Tooltip tip="Known issue — currently sums; see Known issues below">**Sum** *</Tooltip> |
| `curtailment_energy` | MWh | Quantity | **Sum** |
| `curtailment_solar_utility_energy` | MWh | Quantity | **Sum** |
| `curtailment_wind_energy` | MWh | Quantity | **Sum** |
| `flow_imports` | MW | Rate | <Tooltip tip="Known issue — currently sums; see Known issues below">**Sum** *</Tooltip> |
| `flow_exports` | MW | Rate | <Tooltip tip="Known issue — currently sums; see Known issues below">**Sum** *</Tooltip> |
| `flow_imports_energy` | MWh | Quantity | **Sum** |
| `flow_exports_energy` | MWh | Quantity | **Sum** |
| `renewable_proportion` | % | Ratio | `sum(generation_renewable) / sum(demand_gross) × 100` over the queried window |
| `renewable_with_storage_proportion` | % | Ratio | `sum(generation_renewable_with_storage) / sum(demand_gross) × 100` over the queried window |

### `price` aggregation

`price` is averaged because it is a per-MWh rate. For hourly aggregation, the API takes the simple average of the 5-minute prices in the hour. For daily and longer, it uses an interval-weighted average from the market_summary daily materialised view: `sum(price_sum) / sum(price_count)`.

### Proportion metrics

`renewable_proportion` and `renewable_with_storage_proportion` are ratios computed over the *whole* queried window per row, not averaged from the underlying 5-minute proportions. The sums of the numerator and denominator are taken first, then divided.

## Known issues

<Warning>
**MARKET MW metrics are currently summed across intervals**, when they should be averaged. Affects: `demand`, `demand_gross`, `generation_renewable`, `generation_renewable_with_storage`, `curtailment`, `curtailment_solar_utility`, `curtailment_wind`, `flow_imports`, `flow_exports` on `/v4/market/network/{network_code}` at any interval above 5-minute.

For example, requesting `demand` at `interval=hour` will return a value 12× larger than the true hourly average demand. The corresponding `*_energy` metric (e.g. `demand_energy`) is unaffected — it returns the correct total energy.

**Workaround:** divide the returned value by the number of 5-minute intervals in the requested period (12 per hour, 288 per day, etc.).

Tracked in [opennem#525](https://github.com/opennem/opennem/issues/525) (follow-up to the DATA/FACILITY fix in [opennem#523](https://github.com/opennem/opennem/issues/523)). A fix is in progress — it requires restructuring the query builder to use a subquery for derived ratio metrics like `renewable_proportion`.
</Warning>

<Warning>
**The HOUR interval on `/v4/market/network/{network_code}` will server-error if you request both `renewable_proportion` (or `renewable_with_storage_proportion`) and `generation_renewable` (or `generation_renewable_with_storage`, `demand_gross`) in the same call.** This is a ClickHouse analyzer limitation that the query builder will work around once [opennem#525](https://github.com/opennem/opennem/issues/525) lands. As a workaround, request the proportion separately from the generation metrics, or use a daily/longer interval which is unaffected.
</Warning>

## Generation aggregation — fully fixed

`/v4/data/network/{network_code}` and `/v4/data/facilities/{network_code}` return correct averages and sums per the table above, including for batteries (`storage_battery`). The behaviour was corrected in [opennem#523](https://github.com/opennem/opennem/issues/523) — prior to that fix, `power` was summed across 5-minute intervals which produced values 12× the true hourly average.

## See also

- [Data Limits](/api-reference/data-limits) — maximum date ranges per interval
- [Energy guide](/guides/energy) — what energy is and how it differs from power
- [Power guide](/guides/power) — instantaneous generation rate
- [Demand guide](/guides/demand) — how demand is measured and reported
