Historical Spain OMIE Day-Ahead Prices
You're building pricing, risk, or billing logic that depends on the Spain OMIE day-ahead power market, but you need a reproducible way to fetch historical values as a time series you can trust. By the end of this guide, you will be able to query, parse, and store the Spain OMIE Day-Ahead series from the Energy API, use it in EUR/MWh workflows, and integrate it into finance-grade models for hedging, PPA indexation, and PnL.
What you are integrating: symbol, units, and access
This guide focuses exclusively on the Energy API time series for Spain’s OMIE day-ahead market price. You will query one symbol and return dated values you can programmatically consume in finance workflows.
- Symbol name: Spain OMIE Day-Ahead
- Symbol code: OMIE_ES_DA
- Unit: EUR/MWh
- Authentication: api_key query parameter (use YOUR_API_KEY as the value in examples)
- Pricing: Starter $19.99/mo, trial 7 days / 50 calls
- Endpoint: GET /api/v1/timeseries with start, end, symbols, api_key
- Important constraint: Do not pass base=USD when you also need TTF_GAS or EUA_CO2
All examples below are platform-agnostic and focus on one endpoint you can call from any backend or data pipeline.
Endpoint and parameters you will use
The Energy API returns dated values for requested symbols through a single endpoint. For the OMIE Spain day-ahead price series, you will call:
- Method: GET
- URL: https://energy-api.com/api/v1/timeseries
- Query parameters:
- start: inclusive start date (YYYY-MM-DD)
- end: inclusive end date (YYYY-MM-DD)
- symbols: comma-separated list; here use OMIE_ES_DA
- api_key: your API key sent as a query parameter
Returned values are denominated in EUR (base: EUR) and the series unit is EUR/MWh. Align your downstream models to EUR to avoid implicit FX conversions when reconciling PnL or settlement cash flows.
Practical notes:
- Time granularity: The series represents the day-ahead market price level per day. Use the returned date fields for alignment.
- Timezone: Dates are provided as ISO dates for the corresponding market day. When combining with hour-by-hour logic or load profiles, align to Europe/Madrid and handle DST transitions in your own code.
- Non-trading days: Day-ahead markets publish values across calendar days; if the API indicates missing symbols, treat them as data gaps to be imputed per your policy. Otherwise, expect continuous daily points.
- Caching: Cache responses for repeated reads of the same historical range to reduce API calls and improve performance.
- Chunking: For long histories, split into multiple monthly or quarterly calls on the client side. The API accepts ranges; there is no special pagination parameter for this endpoint.
Official curl you can paste and run
Use the following curl to request a quarterly range of OMIE Spain day-ahead prices. Replace YOUR_API_KEY with your key.
curl -G "https://energy-api.com/api/v1/timeseries" --data-urlencode "start=2026-01-01" --data-urlencode "end=2026-03-31" --data-urlencode "symbols=OMIE_ES_DA" --data-urlencode "api_key=YOUR_API_KEY"
Keep the parameters as shown. The symbols parameter is required and should be set to OMIE_ES_DA for this guide.
Official JSON response and how to read it
Below is an official example response. Use it to wire up your parser and tests without guessing field names.
{
"success": true,
"date": "2026-11-16",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 132.552
},
"dates": {
"OMIE_ES_DA": "2026-11-16"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null,
"missing_symbols": null
}
Key fields you will actually use:
- success: Boolean indicating the request succeeded.
- base: The reporting currency for the response. For OMIE_ES_DA it is EUR.
- rates.OMIE_ES_DA: The numeric price value for the given date, unit EUR/MWh.
- dates.OMIE_ES_DA: The ISO date string for which the rate applies.
- currencies.OMIE_ES_DA: The currency code of the series (EUR), confirming unit currency.
- missing_symbols: If not null, indicates symbols that could not be returned and should be handled by your pipeline.
In multi-day responses, you will read the same fields for each returned day of the requested range. Always treat rates and dates as a paired mapping for each symbol; align them by the symbol key.
End-to-end Python example: fetch, validate, and store
The following Python snippet calls the endpoint, validates the payload, and converts the values into a list of date-value rows ready for downstream finance models or databases. It uses requests and standard JSON parsing only.
import os
import requests
from datetime import datetime
API_URL = "https://energy-api.com/api/v1/timeseries"
API_KEY = os.environ.get("ENERGY_API_KEY", "YOUR_API_KEY")
def fetch_omie_es_da(start_date: str, end_date: str):
params = {
"start": start_date,
"end": end_date,
"symbols": "OMIE_ES_DA",
"api_key": API_KEY
}
r = requests.get(API_URL, params=params, timeout=30)
r.raise_for_status()
data = r.json()
# Basic validation
if not data.get("success"):
raise RuntimeError("Energy API request was not successful")
base = data.get("base")
if base != "EUR":
# Keep logic strict; finance systems should not silently convert here
raise ValueError(f"Unexpected base currency: {base}")
# Extract the Spain OMIE Day-Ahead fields
symbol = "OMIE_ES_DA"
rate_value = data.get("rates", {}).get(symbol)
rate_date = data.get("dates", {}).get(symbol)
currency = data.get("currencies", {}).get(symbol)
# Handle missing symbol edge-cases
if data.get("missing_symbols"):
raise ValueError(f"Missing symbols reported: {data['missing_symbols']}")
# Build a records list. In a multi-day response, iterate the returned structure as provided by the API.
# For this official example structure, we read the explicit keyed fields per symbol.
records = []
if rate_value is not None and rate_date is not None:
# Validate unit currency and date
if currency != "EUR":
raise ValueError(f"Unexpected currency for {symbol}: {currency}")
# Normalize the date
d = datetime.fromisoformat(rate_date).date().isoformat()
records.append({
"symbol": symbol,
"date": d,
"value": float(rate_value), # EUR/MWh
"unit": "EUR/MWh",
"base": base
})
return records
if __name__ == "__main__":
rows = fetch_omie_es_da("2026-01-01", "2026-03-31")
# Persist or hand off to your analytics layer
for row in rows:
print(f"{row['date']},{row['symbol']},{row['value']},{row['unit']}")
Notes:
- Keep your models in EUR to match the base and series currency. If you introduce FX conversions, document the source and timing.
- Include strict checks around base and currencies. Silent mismatches can create multi-basis PnL drift.
- If you plan to retrieve a long history, call the same function in monthly or quarterly windows and merge the resulting records in your data store keyed by date and symbol.
How to think about finance workflows with OMIE_ES_DA
OMIE_ES_DA is a daily price series in EUR/MWh suitable for multiple finance tasks. Below are integration checkpoints to keep it robust and auditable.
- Indexation and settlement: For PPAs or indexed supply contracts, store the exact dates returned by dates.OMIE_ES_DA. When computing invoice periods, join on the date and aggregate per your contract calendar.
- Risk and hedging: For VaR and scenario analysis, pull a consistent historical range with fixed start and end, then freeze it in a versioned dataset. Use the same endpoint for backtesting.
- PnL: Keep a canonical copy of OMIE_ES_DA in your pricing store (symbol, date, value, unit). Rebuild daily PnL using the series in EUR/MWh, then convert PnL to reporting currency only at the final stage if needed.
- Quality gates: Reject values when base != EUR, currencies.OMIE_ES_DA != EUR, or when missing_symbols is not null. Log a data quality event for triage.
Operational guidance: date ranges, caching, and edge-cases
Fetching historical time series at scale is mostly an operational concern. A few small choices will prevent painful failures later on.
- Chunking: For multi-year ranges, iterate by month or quarter to reduce the payload of each call. The endpoint does not require pagination parameters; client-side chunking is sufficient.
- Caching and idempotency: Cache successful responses for immutable historical windows (e.g., months older than current). Store response bodies with ETag-like hashing if you maintain an audit trail.
- Timezones: Although the series is daily, aligning analytics that mix hourly load or generation requires a clear Europe/Madrid convention. Perform DST-safe resampling in your own code.
- Negative or high prices: Energy markets can produce negative or spiky values. Do not clamp; instead, alert and propagate as-is. These values often carry real economic meaning for hedges and PnL.
- Missing data: If missing_symbols is returned, do not fabricate values. Either exclude the date from settlement or apply a contractually defined fallback (e.g., next available business day) in your business layer.
- Currency handling: Keep the data in EUR. If you require USD presentation, convert at a dedicated FX layer with explicit dates and sources; do not send base=USD when you also need TTF_GAS or EUA_CO2.
JavaScript alternative: lightweight fetch from Node
If you prefer Node.js, this minimal example requests the same endpoint and extracts the fields you need for storage or further processing.
import fetch from "node-fetch";
const API_URL = "https://energy-api.com/api/v1/timeseries";
const API_KEY = process.env.ENERGY_API_KEY || "YOUR_API_KEY";
async function getOmieEsDa(start, end) {
const params = new URLSearchParams({
start,
end,
symbols: "OMIE_ES_DA",
api_key: API_KEY
});
const url = `${API_URL}?${params.toString()}`;
const res = await fetch(url, { method: "GET" });
if (!res.ok) {
throw new Error(`HTTP ${res.status}: ${await res.text()}`);
}
const data = await res.json();
if (!data.success) {
throw new Error("Energy API request was not successful");
}
if (data.base !== "EUR") {
throw new Error(`Unexpected base currency: ${data.base}`);
}
const sym = "OMIE_ES_DA";
if (data.missing_symbols) {
throw new Error(`Missing symbols reported: ${data.missing_symbols}`);
}
const value = data.rates?.[sym];
const date = data.dates?.[sym];
const currency = data.currencies?.[sym];
if (currency !== "EUR") {
throw new Error(`Unexpected currency for ${sym}: ${currency}`);
}
const rows = [];
if (value != null && date) {
rows.push({
symbol: sym,
date, // ISO date
value: Number(value), // EUR/MWh
unit: "EUR/MWh",
base: data.base
});
}
return rows;
}
(async () => {
const records = await getOmieEsDa("2026-01-01", "2026-03-31");
for (const r of records) {
console.log(`${r.date},${r.symbol},${r.value},${r.unit}`);
}
})();
This uses only URLSearchParams and node-fetch. Integrate with your own storage layer (files, a data lake, or a relational warehouse) keyed on date and symbol.
Testing and validation strategy
Before you rely on OMIE_ES_DA for financial settlement or risk, add a few tests around field presence and units. These tests are simple to implement and save hours of triage later.
- Schema checks: Assert success is true, base is EUR, currencies.OMIE_ES_DA is EUR, and dates.OMIE_ES_DA is a valid ISO date.
- Range sanity: Ensure values are numeric and finite; log negative values but allow them through.
- Deterministic retrieval: For historical windows in the past, re-fetch on a schedule and compare hashes. Alert if the payload changes unexpectedly.
- Retry policy: On transient HTTP errors, retry with exponential backoff and a hard cap. For 4xx, do not retry blindly; fix credentials or parameters.
- Audit: Store the raw JSON alongside your normalized rows for at least one billing cycle to support reconciliation and post-mortems.
Common pitfalls to avoid
- Mixing bases: Do not convert base currency at the request level when aggregating multiple energy symbols that must remain in EUR. Specifically, do not pass base=USD when you also need TTF_GAS or EUA_CO2.
- Dropping date context: Always pair rates.OMIE_ES_DA with dates.OMIE_ES_DA before writing to storage. Misaligned dates cause settlement drift.
- Silently imputing data: If missing_symbols is present, raise an exception or flag a data quality event. Finance workflows should not fabricate prices.
- Timezone ambiguity: If you compute month-to-date or billing cycles, define your cutoff in Europe/Madrid and document it in code comments and runbooks.
- Unbounded historical pulls: For large histories, request in discrete windows (e.g., monthly). This improves reliability and simplifies reprocessing.
Next steps
You now have everything you need to fetch historical Spain OMIE Day-Ahead prices, validate the payload, and integrate it into finance models with confidence. If you need to deepen the integration, review the official docs and create an account:
FAQ
What unit does OMIE_ES_DA use?
EUR/MWh. The response base is EUR and currencies.OMIE_ES_DA is EUR. Keep your downstream calculations in EUR to avoid unintended conversions.
How do I request multiple months of history?
Call the same endpoint repeatedly with different start and end windows (e.g., monthly or quarterly). Concatenate the results in your database keyed by symbol and date. There are no special pagination parameters for this endpoint.
Can I request multiple symbols in one call?
Yes, symbols is comma-separated. This guide focuses on OMIE_ES_DA only. When requesting multiple series together, keep all in the same base and do not pass base=USD if you also need TTF_GAS or EUA_CO2.
What should I do if missing_symbols is not null?
Treat it as a data gap. Do not fabricate values. Raise a data quality alert and either retry later or apply a defined business fallback in your settlement logic.
Is there a free trial?
Yes. A 7-day trial with 50 calls is available on the Starter plan ($19.99/mo after). Use it to validate your pipeline before scaling.
If you are ready to pull historical OMIE Spain day-ahead prices into your finance stack, create an account and start integrating today with the trial: Register.
Ready to get started?
Get your API key and start querying energy commodity prices in minutes.
Get API Key