elexonpy

A Python package that provides a convenient interface to the ELEXON API suite, which provides data published by the UK energy data provider as received.
https://github.com/openclimatefix/elexonpy

Category: Energy Systems
Sub Category: Energy Data Accessibility and Integration

Keywords from Contributors

eumetsat nowcasting

Last synced: about 8 hours ago
JSON representation

Repository metadata

Python package wrapper around Elexon api

README.md

elexonpy

All Contributors

tags badge
pypi badge
ease of contribution: easy

elexonpy is a Python package that provides a convenient interface to the ELEXON API.

This package is generated using Swagger Codegen, ensuring compatibility and ease of use with the ELEXON API services.

Installation

You can install the elexonpy package via pip from PyPI.

pip install elexonpy

Examples usage

There are some examples in the examples directory that demonstrate how to use the package to retrieve data from the Elexon API.

Example 1: Demand

This example demonstrates how to use methods from the DemandApi to retrieve various types of
demand data from the Elexon API and format it into a DataFrame.

# This script demonstrates the use of methods from the DemandApi
# to retrieve various types of demand data from the Elexon API.

from datetime import datetime
import pandas as pd
from elexonpy.api_client import ApiClient
from elexonpy.api.demand_api import DemandApi

# Initialize API client
api_client = ApiClient()
demand_api = DemandApi(api_client)

# Define date range for Actual Total Load Data
from_date = datetime(2024, 7, 1)
to_date = datetime(2024, 7, 2)

# Fetch Actual Total Load Data from API
df = demand_api.demand_actual_total_get(
    _from=from_date,
    to=to_date,
    settlement_period_from=1,
    settlement_period_to=48,
    format='dataframe'
)

# Print Actual Total Load Data DataFrame
print("\n--- Actual Total Load Data ---")
print(df.head())

Example 2: SIP price

This example demonstrates how to use methods from the IndicativeImbalanceSettlementApi
to retrieve settlement system prices data from the Elexon API and format it into a DataFrame.

# This script demonstrates the use of methods from the IndicativeImbalanceSettlementApi
# to retrieve settlement system prices data from the Elexon API.


from datetime import datetime
import pandas as pd
from elexonpy.api_client import ApiClient
from elexonpy.api.indicative_imbalance_settlement_api import IndicativeImbalanceSettlementApi

## Initialize API client
api_client = ApiClient()
imbalance_settlement_api = IndicativeImbalanceSettlementApi(api_client)

# Define settlement date
settlement_date = '2024-07-02'

# Fetch system prices data from API
df = imbalance_settlement_api.balancing_settlement_system_prices_settlement_date_get(
    settlement_date=settlement_date,
    format='dataframe'
)

# Print DataFrame
print("\n--- Settlement System Prices Data ---")
print(df.head())

Example 3 : DA Solar and Wind Forecast

This example demonstrates how to use methods from the GenerationForecastApi to retrieve
day-ahead forecast data for wind and solar generation from the Elexon API and format it into a DataFrame.

# This script demonstrates the use of methods from the GenerationForecastApi
# to retrieve day-ahead forecast data for wind and solar generation from the Elexon API.

from datetime import datetime
import pandas as pd
from elexonpy.api_client import ApiClient
from elexonpy.api.generation_forecast_api import GenerationForecastApi

# Initialize API client
api_client = ApiClient()
forecast_api = GenerationForecastApi(api_client)

# Define date range for fetching day-ahead wind and solar forecast data
from_date = datetime(2024, 7, 1)
to_date = datetime(2024, 7, 7)  # Note: Maximum data output range is 7 days

# Fetch day-ahead forecast data for wind and solar from API
df = forecast_api.forecast_generation_wind_and_solar_day_ahead_get(
    _from=from_date,
    to=to_date,
    process_type='day ahead',
    format='dataframe'
)

# Print DataFrame
print("\n--- Day-Ahead Wind and Solar Forecast Data ---")
print(df.head())

Documentation

API Endpoints

Documentation for the API Endpoints can be found here

Models

Documentation for the Models can be found here

Authorization

All endpoints do not require authorization.

FAQ

How do I get an API key?

You dont need one. The Elexon API does not require an API key for access.

How do I get a year worth of data?

You currently have to write a loop yourself. We hope to incorporate this into the package in the future.

Development

To install the package directly from the GitHub repository, use the following command:

 pip install git+https://github.com/openclimatefix/Elexonpy.git

Tests

To run the tests, make sure you have pytest installed

pip install pytest

and then you can run

pytest

Contributing and community

issues badge

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Part of the Open Climate Fix community.

OCF Logo


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: about 2 months ago

Total Commits: 152
Total Committers: 9
Avg Commits per committer: 16.889
Development Distribution Score (DDS): 0.592

Commits in past year: 6
Committers in past year: 3
Avg Commits per committer in past year: 2.0
Development Distribution Score (DDS) in past year: 0.5

Name Email Commits
14Richa o****9@g****m 62
peterdudfield p****d@h****m 29
BumpVersion Action b****n@g****s 29
allcontributors[bot] 4****] 14
Jacqueline James 1****J 11
yousefsawy 9****y 4
Vijaya Bhaskar v****i@g****m 1
Utkarsh Verma 1****a 1
Anas Khan a****8@g****m 1

Issue and Pull Request metadata

Last synced: 3 months ago

Total issues: 22
Total pull requests: 65
Average time to close issues: 24 days
Average time to close pull requests: 4 days
Total issue authors: 5
Total pull request authors: 11
Average comments per issue: 1.86
Average comments per pull request: 0.8
Merged pull request: 51
Bot issues: 0
Bot pull requests: 14

Past year issues: 4
Past year pull requests: 14
Past year average time to close issues: N/A
Past year average time to close pull requests: 3 days
Past year issue authors: 2
Past year pull request authors: 7
Past year average comments per issue: 2.75
Past year average comments per pull request: 1.5
Past year merged pull request: 7
Past year bot issues: 0
Past year bot pull requests: 2

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/openclimatefix/elexonpy

Top Issue Authors

  • peterdudfield (17)
  • 14Richa (2)
  • ma1jmk (1)
  • braddf (1)
  • mduffin95 (1)

Top Pull Request Authors

  • 14Richa (21)
  • allcontributors[bot] (14)
  • peterdudfield (14)
  • yousefsawy (4)
  • vijayabhaskar78 (4)
  • mduffin95 (2)
  • anxkhn (2)
  • Jacqueline-J (1)
  • lambaaryan011 (1)
  • Sigma-Verma (1)
  • ma1jmk (1)

Top Issue Labels

  • good first issue (7)
  • enhancement (3)
  • discussion (1)
  • bug (1)

Top Pull Request Labels


Package metadata

pypi.org: elexonpy

Elexon Python Client

  • Homepage: https://github.com/openclimatefix/Elexonpy
  • Documentation: https://elexonpy.readthedocs.io/
  • Licenses: MIT License
  • Latest release: 1.0.16 (published 11 months ago)
  • Last Synced: 2025-10-30T08:37:18.965Z (about 2 months ago)
  • Versions: 27
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 941 Last month
  • Rankings:
    • Dependent packages count: 10.656%
    • Average: 35.334%
    • Dependent repos count: 60.011%
  • Maintainers (1)

Dependencies

.github/workflows/pytest.yaml actions
pyproject.toml pypi
  • pandas *
  • requests <2.32.0
  • requests-mock *
.github/workflows/release.yaml actions

Score: 12.541737413379064