Skip to main content

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.

Example 2
# 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.

Example 3
# 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):

Richa
Richa

💻
Peter Dudfield
Peter Dudfield

👀
Matthew Duffin
Matthew Duffin

🤔
Jacqueline James
Jacqueline James

💻
Yousef Elsawy
Yousef Elsawy

📖
Utkarsh Verma
Utkarsh Verma

🚧
Anas Khan
Anas Khan

🚧

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

Part of the Open Climate Fix community.

OCF Logo

Metadata

Release files for elexonpy 1.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for elexonpy 1.0.16
File Size Uploaded
elexonpy-1.0.16.tar.gz 230.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for elexonpy 1.0.16
File Interpreter ABI Platform
elexonpy-1.0.16-py3-none-any.whl Python 3 none any Details

Total release size: 844.6 kB

Release files / elexonpy-1.0.16.tar.gz

Download URL elexonpy-1.0.16.tar.gz
Size 230.2 kB
Tags Source
SHA-256 checksum
How to use checksums
70c198315c0e3ba5521e78eaf236c02806eced301308bf4a8be2f8540e44bfb4
BLAKE2b-256 checksum
How to use checksums
d8703eb60a7a0ad8e2a3ad0dd2416768436d0e7ad77c83125e0653173377c565
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release files / elexonpy-1.0.16-py3-none-any.whl

Download URL elexonpy-1.0.16-py3-none-any.whl
Size 614.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
212dc8adad99d7aa1849639c85f0114881d293d9f7a79c5affceb47e4a456e78
BLAKE2b-256 checksum
How to use checksums
6f3234b134964974b7fef1f15029735df4d142bde8e20f7216d2da34e660a070
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release history Release notifications | RSS feed

This release

1.0.16 This release

2 release files

1.0.14

2 release files

1.0.13

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page