Spain OMIE Hourly Price API

Spain OMIE Hourly Price API

You need to programmatically fetch and use Spain’s OMIE day-ahead hourly power prices in finance workflows, dashboards, and backtests. By the end of this guide you will retrieve the latest quoted value for Spain OMIE Hourly (symbol OMIE_ES_DA), request a specific trading day’s hourly series, parse responses, and integrate the data safely with caching and scheduling.

What you are integrating: Spain OMIE Hourly (OMIE_ES_DA)

This guide focuses on a single Energy API symbol:

Illustration: Spain OMIE Hourly Price API
  • Symbol name: Spain OMIE Hourly
  • Symbol code: OMIE_ES_DA
  • Unit: EUR/MWh
  • Authentication: api_key query parameter (use YOUR_API_KEY)

Two request patterns matter in finance and trading automation:

  • Latest quote for OMIE_ES_DA: GET https://energy-api.com/api/v1/latest?symbols=OMIE_ES_DA&api_key=YOUR_API_KEY
  • Specific date hourly series (official sample): GET https://energy-api.com/api/v1/electricity/hourly with symbol, date, api_key

Starter plan is $19.99/mo with a 7‑day free trial that includes 50 calls. There is no MCP host. If you also need TTF_GAS or EUA_CO2 alongside OMIE_ES_DA, do not send base=USD for those symbols because their base is MIXED; for OMIE_ES_DA the base is EUR.

Quickstart: get the latest OMIE_ES_DA price

Many finance tasks only need the most recent consolidated value for a symbol. For Spain OMIE Hourly, use the latest endpoint and parse the EUR-based price from rates.OMIE_ES_DA.

Latest endpoint request

HTTP GET

  • URL: https://energy-api.com/api/v1/latest
  • Query parameters:
    • symbols=OMIE_ES_DA
    • api_key=YOUR_API_KEY

Example (explanation below uses the exact values you must expect from the official sample response):

{
"success": true,
"date": "2026-10-10",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 130.8242
},
"dates": {
"OMIE_ES_DA": "2026-10-10"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null
}

Field notes you will actually use:

  • rates.OMIE_ES_DA: numeric latest price in EUR/MWh.
  • base: quote currency is EUR (matches the symbol’s unit).
  • date and dates.OMIE_ES_DA: valuation date for the returned latest price.

Official hourly series: fetch a specific OMIE day

When you need the hourly day-ahead profile for a given local market day, call the electricity/hourly endpoint. Read points[].value as the canonical numeric field for each hour. Do not fabricate or infer hourly values—always consume what the API returns.

Use the official sample exactly as provided:

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"

Guidance:

  • symbol must be OMIE_ES_DA for Spain OMIE Hourly.
  • date specifies the OMIE market day you need (local trading day). The API returns an hourly series; read points[].value. Do not invent or assume missing hours.
  • Units are EUR/MWh consistent with the symbol.

If you only need a single consolidated figure for the day (for example, a closing or settlement-like proxy for dashboards), prefer the latest endpoint described above. If your model values shape risk, load-following hedges, or intraday cashflows, use the hourly endpoint and aggregate to your desired buckets.

Copyable examples: latest payloads you will parse

Below are complete JSON examples you can paste into tests or mocks while wiring your parser. They use the exact official values; do not alter the symbol, date, or series fields when validating your integration.

Example A: latest price (EUR base)

{
"success": true,
"date": "2026-10-10",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 130.8242
},
"dates": {
"OMIE_ES_DA": "2026-10-10"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null
}

Example B: identical fixture for contract tests

{
"success": true,
"date": "2026-10-10",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 130.8242
},
"dates": {
"OMIE_ES_DA": "2026-10-10"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null
}

Example C: identical fixture for monitoring parsers

{
"success": true,
"date": "2026-10-10",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 130.8242
},
"dates": {
"OMIE_ES_DA": "2026-10-10"
},
"currencies": {
"OMIE_ES_DA": "EUR"}
,
"base_filter_note": null
}

cURL: hourly series (official) and latest quote

Official hourly series cURL (copy exactly)

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"

This returns the hourly day-ahead series for 2026-06-18. Read points[].value for each hour, in EUR/MWh.

Latest quote cURL for OMIE_ES_DA

curl -G "https://energy-api.com/api/v1/latest" --data-urlencode "symbols=OMIE_ES_DA" --data-urlencode "api_key=YOUR_API_KEY"

This returns the consolidated latest price for Spain OMIE Hourly in EUR. Parse rates.OMIE_ES_DA.

Code: parse and validate the fields you need

Python: latest quote (rates and dates)

import os
import requests
from decimal import Decimal

API_KEY = os.getenv("ENERGY_API_KEY", "YOUR_API_KEY")

def get_latest_omie_es_da():
url = "https://energy-api.com/api/v1/latest"
params = {
"symbols": "OMIE_ES_DA",
"api_key": API_KEY,
}
r = requests.get(url, params=params, timeout=20)
r.raise_for_status()
data = r.json()

if not data.get("success"):
raise RuntimeError(f"API returned success=false: {data}")

base = data.get("base")
if base != "EUR":
# OMIE_ES_DA is quoted in EUR/MWh; alert if base changes
raise ValueError(f"Unexpected base currency: {base}")

price = Decimal(str(data["rates"]["OMIE_ES_DA"]))
date = data["dates"]["OMIE_ES_DA"]
return {"date": date, "base": base, "price_eur_mwh": price}

if __name__ == "__main__":
latest = get_latest_omie_es_da()
print(latest)

Python: hourly series (read points[].value)

import os
import requests
from decimal import Decimal

API_KEY = os.getenv("ENERGY_API_KEY", "YOUR_API_KEY")

def get_hourly_omie_es_da(date_str: str):
url = "https://energy-api.com/api/v1/electricity/hourly"
params = {
"symbol": "OMIE_ES_DA",
"date": date_str,
"api_key": API_KEY,
}
r = requests.get(url, params=params, timeout=30)
r.raise_for_status()
data = r.json()

# The hourly endpoint returns an array in points; read points[].value.
# Do not fabricate missing values; consume what the API returns.
points = data.get("points", [])
hours = []
for p in points:
# Expect something like {"timestamp": "...", "value": 123.45, ...}
if "value" in p:
hours.append({
"ts": p.get("timestamp"),
"value_eur_mwh": Decimal(str(p["value"]))
})
return hours

if __name__ == "__main__":
series = get_hourly_omie_es_da("2026-06-18")
print(f"Loaded {len(series)} hourly points")

Data handling notes that prevent subtle finance bugs

  • Units: OMIE_ES_DA values are EUR/MWh. Keep all arithmetic unit-consistent (e.g., convert to EUR/kWh only when presenting to retail users, not in ledger calculations unless required).
  • Base currency: Latest responses show base = EUR for OMIE_ES_DA. Do not pass base=USD when you also need TTF_GAS or EUA_CO2; their base is MIXED. For Spain OMIE Hourly, keep EUR.
  • Trading/market days: OMIE is a day-ahead auction. If you schedule daily pulls, align with the market calendar and treat weekends/holidays explicitly. When in doubt, check the hourly endpoint for the requested date rather than assuming continuity.
  • Timestamps/timezone for hourly series: The hourly endpoint reflects the OMIE market day. Do not shift hours unless your downstream system explicitly requires a target timezone. Read points[].timestamp and store it as-is, then transform at presentation time.
  • Caching: Cache latest responses for short intervals (e.g., minutes) to control call volume. For hourly series, cache per (symbol, date) for the life of the model run; the series for a past OMIE day is not expected to mutate.
  • Idempotency: Replays of the same (symbol, date) should return the same series. Build idempotent loaders keyed by (symbol=OMIE_ES_DA, date=YYYY-MM-DD).
  • Precision: Use decimal math in PnL, VaR, or settlement pipelines. Avoid binary float for ledger postings; store price as string or Decimal and only round on output.

How to validate your parser with fixture JSON

Use the official latest payload to verify field extraction. Your validation should assert the presence and types of these fields:

  • success is true
  • base equals EUR
  • rates.OMIE_ES_DA is a number
  • dates.OMIE_ES_DA is a YYYY-MM-DD string

For convenience, here is the official sample again for tests that snapshot exact fields:

{
"success": true,
"date": "2026-10-10",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 130.8242
},
"dates": {
"OMIE_ES_DA": "2026-10-10"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null
}

Error handling and operational tips

  • HTTP errors: Treat non-2xx as retriable transient failures unless documented otherwise. Use exponential backoff with a cap and jitter.
  • API success flag: Even with 200 OK, check success == true. If false, log the full response and stop rather than ingesting partial data.
  • Missing fields: If rates.OMIE_ES_DA is missing, skip that update and alert. Do not backfill with stale values without an explicit policy.
  • Scheduling: For “latest,” align fetch intervals with your portfolio’s mark schedule (e.g., once per day after OMIE publish window). For intraday monitoring, the hourly endpoint should be polled when a new day’s auction has published.
  • Plan limits: Starter is $19.99/mo with a 7‑day trial (50 calls). Consolidate symbols per request where applicable (for latest, multiple comma-separated symbols are supported by the endpoint signature), but keep OMIE_ES_DA scope here focused.

End-to-end checklist

  • Acquire an API key: Register.
  • Smoke test latest: GET /api/v1/latest?symbols=OMIE_ES_DA&api_key=YOUR_API_KEY and parse rates.OMIE_ES_DA.
  • Smoke test hourly: GET /api/v1/electricity/hourly with symbol=OMIE_ES_DA, date=YYYY-MM-DD, api_key=YOUR_API_KEY and read points[].value.
  • Implement decimal-safe parsing and storage in EUR/MWh.
  • Schedule pulls, add caching, and pin idempotent loaders by (symbol, date).
  • Add monitors that validate base=EUR and presence of rates.OMIE_ES_DA.

FAQ

Q: Which field is the latest price I can plug into marks or dashboards?
A: Use rates.OMIE_ES_DA from the latest endpoint response. Treat base as EUR and the unit as EUR/MWh.

Q: How do I get the full OMIE day-ahead hourly curve for Spain?
A: Call the electricity/hourly endpoint with symbol=OMIE_ES_DA and a date. Parse points[].value for the 24-hour (or market-day) series. Do not fabricate missing hours.

Q: Should I pass base=USD when mixing symbols?
A: Do not pass base=USD when you also need TTF_GAS or EUA_CO2 because their base is MIXED. For OMIE_ES_DA, the base is EUR; keep it as-is.

Q: What authentication mechanism is used?
A: Supply your key via the api_key query parameter. Use YOUR_API_KEY in local tests; replace with your real key in production.

Q: How can I stay within the trial quota?
A: Cache latest responses for short periods, and cache hourly series per (symbol, date). The trial provides 7 days and 50 calls, which is sufficient for a proof of concept if you avoid redundant polling.

Ready to wire Spain’s OMIE day-ahead prices into your finance pipeline? Create an account and start with the latest quote or the hourly curve now: Register and read the endpoint details in the Documentation.

Ready to get started?

Get your API key and start querying energy commodity prices in minutes.

Get API Key

Related posts