---
title: "Historical portfolio market value backtest (Day-Ahead)"
method: POST
path: "/api/energy-market/portfolio-backtest"
tags: ["Energy Market Data"]
---

# Historical portfolio market value backtest (Day-Ahead)

`POST /api/energy-market/portfolio-backtest`

## Request

- Base URL: `https://api.cernion.de`
- URL: `https://api.cernion.de/api/energy-market/portfolio-backtest`
- Auth: none declared

Computes the historical spot market value for a portfolio of energy installations.

Combines generation timeseries (inline upload, MaStR-based historical reconstruction, or technology assumption) with Day-Ahead prices over a selectable period (default: last 365 complete days).

**Data quality priority per asset:**
1. `uploaded_timeseries` — inline `timeseries` array in request
2. `mastr_historical_reconstruction` — solar/wind with `mastrNumber`, weather-based historical model
3. `assumption` — biomass (7 500 h/a), hydro (4 200 h/a), combustion (3 500 h/a): flat profile
4. `missing_profile` — storage and unknown types: generation = 0, warning emitted

**Negative price handling:** `marketValueEur` reflects physical generation including negative intervals; `curtailedMarketValueEur` shows the value under ideal curtailment; `negativePriceAvoidableLossEur` is the difference.

**Limits:** max 50 assets per request, max 365 days, region `Deutschland` only in v1.

## Query parameters

- `token` string

## Request body

- object
  - `assets` object[], required: Portfolio of energy installations
    - `mastrNumber` string: MaStR unit ID (SEE…=solar, SWE…=wind)
    - `type` 'solar' | 'wind' | 'biomass' | 'hydro' | 'combustion' | 'storage' | 'other': Technology type
    - `capacityKw` number: Installed capacity in kW
    - `postleitzahl` string: Postal code (used as fallback location)
    - `commissioningDate` string, date: Grid connection date — intervals before this are zeroed
    - `timeseries` object[]: Optional inline generation timeseries (highest priority)
      - `timestamp` string
      - `generationMwh` number
  - `dateFrom` string, date: Start date (YYYY-MM-DD). Default: today − 365 days
  - `dateTo` string, date: End date inclusive (YYYY-MM-DD). Default: yesterday
  - `resolution` 'hourly' | 'daily': Response resolution
  - `market` string: Market type
  - `region` string: Market region (only "Deutschland" supported in v1)
  - `includeTimeseries` boolean: Include full hourly timeseries in response
  - `token` string: Optional Cernion MCP token for this request. Overrides CERNION_TOKEN when provided.

## Response `200`

Backtest result (from `/api/jobs/{jobId}/result` once status is `completed`)

## Other responses

- `202`: Job accepted — poll `/api/jobs/{jobId}/status`, fetch result from `/api/jobs/{jobId}/result`

---

[API](https://skmtc.dev/cernion/apis/cernion-energy-tools-api.md) · [All operations](https://skmtc.dev/cernion/apis/cernion-energy-tools-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cernion/apis/cernion-energy-tools-api/revisions/cdb94473b538?raw)
