Skip to content

Repository files navigation

omie-data

Python library to fetch electricity market data from OMIE (Operador del Mercado Ibérico de Energía).

Installation

pip install omie-market-data

Or install from source:

git clone https://github.com/yourusername/omie-data.git
cd omie-data
pip install -e .

Usage

from datetime import datetime
from omie_data import get_omie_data, get_omie_url

# Fetch data for a specific date
date = datetime(2025, 10, 1)
df = get_omie_data(date)

if df is not None:
    print(df.head())
    # Columns: start_period, end_period, plus one column per metric (prices, power, etc.)
else:
    print("Data not available for this date")

# Get the URL used for a date (useful for debugging)
url = get_omie_url(date)
print(url)

Data format

The returned DataFrame is period-based (one row per 15-minute interval):

Column Description
start_period Start of the 15-min interval (datetime)
end_period End of the 15-min interval (datetime)
metric columns One column per metric (e.g. marginal price Spanish/Portuguese, total power buy/sell, etc.)
  • 96 rows per day (24 hours × 4 quarters).
  • Intervals follow OMIE quarters: H1Q1 = 00:00–00:15, H1Q2 = 00:15–00:30, …, H24Q4 = 23:45–24:00.

API

  • get_omie_data(date: datetime) -> Optional[pd.DataFrame]
    Fetches data for the given date. Returns None if the file is not available (e.g. 404).

  • get_omie_url(date: datetime) -> str
    Returns the OMIE URL used for that date (for debugging or manual download).

Examples

See test_omie_data.ipynb for a full Jupyter notebook with:

  • Fetching and exploring the period-based DataFrame
  • Plotting prices and other metrics
  • Converting to hourly averages
  • Exporting to CSV/Excel

Requirements

  • Python 3.7+
  • pandas

For maintainers: publishing to PyPI

See PUBLISHING.md for step-by-step instructions to publish the package to PyPI so anyone can run pip install omie-market-data.

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages