API to Get the Spain OMIE Hourly Price
You need a reliable way to fetch Spain’s OMIE day-ahead hourly electricity price and wire it into your application with minimal friction. By the end of this guide, you will be able to authenticate, call the Energy API for the Spain OMIE Hourly symbol, parse the returned values, and prepare the data for downstream Finance workflows such as pricing, hedging analytics, and P&L attribution.
What you get: Spain OMIE Hourly in EUR/MWh
The Energy API exposes the OMIE day-ahead price for Spain as a symbol named “Spain OMIE Hourly” with the code OMIE_ES_DA. Prices are denominated in EUR/MWh. You authenticate via an api_key query parameter using YOUR_API_KEY.
In most Finance workflows, you will use these values to drive:
- Intraday and day-ahead power price curves for valuation.
- Risk metrics and hedging strategies tied to Iberian electricity exposure.
- Backtesting and scenario analysis around Spanish power markets.
Key facts before you start:
- Symbol name: Spain OMIE Hourly
- Symbol code: OMIE_ES_DA
- Unit: EUR/MWh
- Authentication: api_key query parameter. Use YOUR_API_KEY as the value.
- Starter plan: $19.99/mo with a 7-day trial / 50 calls.
- Do not pass base=USD when you also need TTF_GAS or EUA_CO2.
Quickstart: Get a specific day’s hourly prices (copy-paste cURL)
The fastest way to verify connectivity is a same-day request that returns the hourly OMIE series for a given date. Replace YOUR_API_KEY with your actual key.
Code: cURL
curl -G "https://energy-api.com/api/v1/electricity/hourly" --data-urlencode "symbol=OMIE_ES_DA" --data-urlencode "date=2026-06-18" --data-urlencode "api_key=YOUR_API_KEY"
Notes for Finance integrations:
- symbol selects the instrument. Here it is the Spain OMIE Hourly code OMIE_ES_DA.
- date targets a market date (local market calendar). Use YYYY-MM-DD.
- api_key authenticates your request. Include it as a query parameter.
Programmatic example in Python
The snippet below calls the same endpoint and sketches a typical extraction path for hourly points, reading point values as EUR/MWh. Store the resulting time series in your price store alongside timestamps and units.
Code: Python (requests)
import requests
from datetime import date
API_URL = "https://energy-api.com/api/v1/electricity/hourly"
params = {
"symbol": "OMIE_ES_DA",
"date": "2026-06-18",
"api_key": "YOUR_API_KEY"
}
resp = requests.get(API_URL, params=params, timeout=30)
resp.raise_for_status()
data = resp.json()
# Expected structure: a list of hourly points.
# Read points[].value (EUR/MWh). Do not invent the series; consume what the API returns.
points = data.get("points", [])
# Example processing: collect (timestamp, value) tuples
series = []
for p in points:
# Typical fields: timestamp, value (EUR/MWh). Keep originals if present.
ts = p.get("timestamp")
val = p.get("value")
if ts is not None and val is not None:
series.append((ts, float(val)))
# Integrate with Finance pipelines:
# - Persist (ts, val) into your time-series DB
# - Validate units: EUR/MWh
# - Use series for curve construction, VaR, P&L attribution
print(f"Loaded {len(series)} hourly points for OMIE_ES_DA on 2026-06-18")
Implementation tips:
- Always validate that points is present and iterate safely.
- Keep timestamps immutable and store the raw string exactly as received alongside any parsed datetime variant you create.
- If you apply FX conversion downstream, store both original prices (EUR/MWh) and converted values to preserve auditability.
Daily summary response example you may also encounter
Depending on the endpoint used elsewhere in your stack, you may receive a compact daily payload that returns a single value per symbol/date rather than an hourly array. The following block is an official response you should treat as canonical when building against those aggregated endpoints.
JSON: Official sample response
{
"success": true,
"date": "2026-11-10",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 171.3841
},
"dates": {
"OMIE_ES_DA": "2026-11-10"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null,
"missing_symbols": null
}
How to read this:
- rates.OMIE_ES_DA holds the numeric price. Treat it as EUR/MWh given currencies.OMIE_ES_DA is EUR and base is EUR.
- dates.OMIE_ES_DA indicates the market date for that price.
- Use this form for dashboards or daily rollups; for intraday or hourly analysis, prefer the hourly endpoint so you can read points[].value.
Field mapping and units
Finance applications need consistent naming, units, and timestamps. Here is a concise mapping checklist tailored to OMIE_ES_DA:
- Instrument: OMIE_ES_DA (Spain OMIE Hourly)
- Unit: EUR/MWh (do not rescale to kWh unless you explicitly divide by 1000)
- Timezone considerations: Daylight saving transitions can shift local timestamps. Persist raw timestamps exactly as returned and normalize in your analytics layer if needed.
- Granularity: Hourly points via electricity/hourly; a single daily figure via aggregated/daily-style responses like the JSON shown above.
Validation, QA, and Finance workflow integration
Integrating into a Finance stack requires predictable ingestion and validation. Before pushing values to pricing or risk:
- Schema check: Confirm points is present for hourly calls and that each point has a parseable timestamp plus a numeric value.
- Unit lock: Assert EUR/MWh on ingest. If you ever convert to USD/MWh downstream, keep both the original and converted columns and record the FX source.
- Completeness: Expect 24 values most days; be prepared for market-specific exceptions (e.g., DST transitions can yield 23 or 25 hours).
- Immutability: Store raw payloads for audit and reprocessing, especially for P&L explain or model backfills.
Error handling and retries
Production usage should distinguish between transient and terminal conditions:
- 4xx without retry: Authentication errors, invalid symbol, or malformed date.
- 5xx with backoff: Retry with exponential backoff and jitter. Cap retries to avoid thundering herds.
- Timeouts: Set explicit client timeouts. Retry idempotently for GET requests.
Log request parameters (excluding sensitive keys) and response codes. For hourly ingestion, fail the batch if schema validation fails rather than propagating partial or corrupt data into pricing models.
Caching, scheduling, and idempotency
Because OMIE day-ahead prices are published for a known schedule, you can:
- Cache stable historical days indefinitely to reduce call volume.
- Schedule daily ingestion after publication, then reconcile on T+1 for any corrections.
- Version your curve builds: store both the initial capture and any post-publication revisions with timestamps.
Security and key management
- Store YOUR_API_KEY in a secure secret manager, not in code or CI logs.
- Use per-environment keys and rotate regularly.
- Restrict access to egress IPs when possible and monitor usage during the trial window.
Common pitfalls to avoid
- Mixing units: Always confirm EUR/MWh before any normalization or FX conversion.
- Assuming 24 points daily: Account for DST anomalies and holiday schedules.
- Conflating daily aggregates with hourly series: If you need intraday granularity, pull electricity/hourly and read points[].value.
- Adding base=USD when combining with TTF_GAS or EUA_CO2: Do not pass base=USD in that multi-symbol context.
End-to-end checklist (ship your first integration)
- Register for an API key: Register.
- Run the provided cURL to confirm access to OMIE_ES_DA for a known date.
- Implement the Python call and parse points[].value for hourly prices; persist (timestamp, value, unit).
- Add schema, unit, and completeness validation to guard downstream Finance workflows.
- Schedule daily pulls and enable backfills. Cache immutable historical days.
- Wire outputs into pricing, VaR, and P&L pipelines; preserve the raw payload for audit.
If you need deeper endpoint coverage or optional parameters that are not described here, read the official Documentation.
FAQ
What symbol should I request for Spain’s OMIE day-ahead hourly price?
Use OMIE_ES_DA (Spain OMIE Hourly). The unit is EUR/MWh.
How do I authenticate?
Pass your key as api_key=YOUR_API_KEY in the query string. Do not embed it in source code; use a secret manager.
Where are the hourly values in the response?
For the hourly endpoint, iterate over points and read each point’s value field. For aggregated/daily responses, read rates.OMIE_ES_DA.
What timezone are the timestamps?
Use the timestamps exactly as returned by the API for OMIE. Store raw strings and normalize to your house timezone in analytics if required.
Can I request multiple symbols or convert the base currency?
Keep the original EUR/MWh values for audit. If you later combine with instruments like TTF_GAS or EUA_CO2, do not pass base=USD in that context.
Ready to price Spain’s OMIE exposure and wire it into your Finance stack? Get your key and ship your first request in minutes: Register. For endpoint coverage and implementation details, keep the Documentation open while you code.
Ready to get started?
Get your API key and start querying energy commodity prices in minutes.
Get API Key