ElexonDataPortal
Wrapper for the Balancing Mechanism Reporting Service API to balance power flowing on to and off from the electricity Transmission System in Great Britain.
https://github.com/OSUKED/ElexonDataPortal
Category: Energy Systems
Sub Category: Energy Data Accessibility and Integration
Last synced: about 21 hours ago
JSON representation
Repository metadata
Python wrapper for the Elexon/BMRS API
- Host: GitHub
- URL: https://github.com/OSUKED/ElexonDataPortal
- Owner: OSUKED
- License: mit
- Created: 2019-06-02T12:14:48.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-26T17:58:03.000Z (over 1 year ago)
- Last Synced: 2025-04-14T06:04:59.053Z (14 days ago)
- Language: Jupyter Notebook
- Homepage: https://osuked.github.io/ElexonDataPortal
- Size: 6.74 GB
- Stars: 56
- Watchers: 6
- Forks: 15
- Open Issues: 11
- Releases: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
Elexon Data Portal
The ElexonDataPortal
library is a Python Client for retrieving data from the Elexon/BMRS API. The library significantly reduces the complexity of interfacing with the Elexon/BMRS API through the standardisation of parameter names and orchestration of multiple queries when making requests over a date range. To use the ElexonDataPortal
you will have to register for an Elexon API key which can be done here.
Installation
The library can be easily installed from PyPi, this can be done using:
pip install ElexonDataPortal
Getting Started
We'll begin by initialising the API Client
. The key parameter to pass here is the api_key
, alternatively this can be set by specifying the environment variable BMRS_API_KEY
which will then be loaded automatically.
from ElexonDataPortal import api
client = api.Client('your_api_key_here')
Now that the client has been initialised we can make a request!
One of the key abstractions within the ElexonDataPortal
library is the handling of multiple requests over a date range specified through the start_date
and end_date
parameters. Each response will be automatically cleaned and parsed, then concatenated into a single Pandas DataFrame. If a settlement period and date column can be identified in the returned data then a new column will be added with the local datetime for each data-point. N.b. that if passed as a string the start and end datetimes will be assumed to be in the local timezone for the UK
start_date = '2020-01-01'
end_date = '2020-01-01 1:30'
df_B1610 = client.get_B1610(start_date, end_date)
df_B1610.head(3)
documentType | businessType | processType | timeSeriesID | curveType | settlementDate | powerSystemResourceType | registeredResourceEICCode | marketGenerationUnitEICCode | marketGenerationBMUId | marketGenerationNGCBMUId | bMUnitID | nGCBMUnitID | activeFlag | documentID | documentRevNum | resolution | start | end | settlementPeriod | quantity | local_datetime | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | Actual generation | Production | Realised | ELX-EMFIP-AGOG-TS-212 | Sequential fixed size block | 2020-01-01 | Generation | 48W000CAS-BEU01F | 48W000CAS-BEU01F | M_CAS-BEU01 | CAS-BEU01 | M_CAS-BEU01 | CAS-BEU01 | Y | ELX-EMFIP-AGOG-22495386 | 1 | PT30M | 2020-01-01 | 2020-01-01 | 1 | 18.508 | 2020-01-01 00:00:00+00:00 |
1 | Actual generation | Production | Realised | ELX-EMFIP-AGOG-TS-355 | Sequential fixed size block | 2020-01-01 | Generation | 48W00000STLGW-3A | 48W00000STLGW-3A | T_STLGW-3 | STLGW-3 | T_STLGW-3 | STLGW-3 | Y | ELX-EMFIP-AGOG-22495386 | 1 | PT30M | 2020-01-01 | 2020-01-01 | 1 | 28.218 | 2020-01-01 00:00:00+00:00 |
2 | Actual generation | Production | Realised | ELX-EMFIP-AGOG-TS-278 | Sequential fixed size block | 2020-01-01 | Generation | 48W00000GNFSW-1H | 48W00000GNFSW-1H | T_GNFSW-1 | GNFSW-1 | T_GNFSW-1 | GNFSW-1 | Y | ELX-EMFIP-AGOG-22495386 | 1 | PT30M | 2020-01-01 | 2020-01-01 | 1 | 29.44 | 2020-01-01 00:00:00+00:00 |
If you've previously written your own code for extracting data from the Elexon/BMRS API then you may be wondering where some of the normal parameters you pass have gone. The reduction in the parameters passed are due to 4 core drivers:
- Standardisation of date range parameter names
- Removal of the need to specify
ServiceType
- Automatic passing of
APIKey
after client initialisation - Shipped with sensible defaults for all remaining parameters
The full list of data streams that are able to be requested can be found here. If you wish to make requests using the raw methods these are available through the ElexonDataportal.dev.raw
module.
Further information can be found in the Quick Start guide.
What's Changed in v2
The latest release of the library includes a full rewrite of the code-base. We have endeavoured to make the new API as intuitive as possible but that has required breaking changes from v1, if you wish to continue using the historic library use pip install ElexonDataPortal==1.0.4
. N.b v1 will not be maintained going forward, you are advised to change over to v2.0.0+.
The key feature changes are:
- Coverage of more BMRS streams
- Automated default values
- Cleaner client API
- A larger range of request types are compatible with the date range orchestrator
Programmatic Library Generation
One of the core features within the ElexonDataPortal
library is that it is self-generating, by which we mean it can rebuild itself (including any new API request methods) from scratch using only the endpoints.csv
spreadsheet. As well as generating the Python Client library a BMRS_API.yaml
file is created, this provides an OpenAPI specification representation of the Elexon/BMRS API. In turn this allows us to automatically generate documentation, as well as run tests on the API itself to ensure that everything is working as expected - during this process we identified and corrected several small errors in the API documentation provided by Elexon.
To rebuild the library simply run the following in the root directory:
python -m ElexonDataPortal.rebuild
N.b. If you wish to develop the library further or use any of the programmatic library generation functionality then please install the development version of the library using:
pip install ElexonDataPortal[dev]
If you are not installing into a fresh environment it is recommended you install pyyaml
and geopandas
using conda to avoid any dependency conflicts. In future we are looking to release ElexonDataPortal
as a conda package to avoid these issues.
Data Stream Descriptions
The following table describes the data streams that are currently retreivable through the API. The client method to retrieve data from a given stream follows the naming convention get_{stream-name}
.
Stream | Description |
---|---|
B0610 | Actual Total Load per Bidding Zone |
B0620 | Day-Ahead Total Load Forecast per Bidding Zone |
B0630 | Week-Ahead Total Load Forecast per Bidding Zone |
B0640 | Month-Ahead Total Load Forecast Per Bidding Zone |
B0650 | Year Ahead Total Load Forecast per Bidding Zone |
B0710 | Planned Unavailability of Consumption Units |
B0720 | Changes In Actual Availability Of Consumption Units |
B0810 | Year Ahead Forecast Margin |
B0910 | Expansion and Dismantling Projects |
B1010 | Planned Unavailability In The Transmission Grid |
B1020 | Changes In Actual Availability In The Transmission Grid |
B1030 | Changes In Actual Availability of Offshore Grid Infrastructure |
B1320 | Congestion Management Measures Countertrading |
B1330 | Congestion Management Measures Costs of Congestion Management |
B1410 | Installed Generation Capacity Aggregated |
B1420 | Installed Generation Capacity per Unit |
B1430 | Day-Ahead Aggregated Generation |
B1440 | Generation forecasts for Wind and Solar |
B1510 | Planned Unavailability of Generation Units |
B1520 | Changes In Actual Availability of Generation Units |
B1530 | Planned Unavailability of Production Units |
B1540 | Changes In Actual Availability of Production Units |
B1610 | Actual Generation Output per Generation Unit |
B1620 | Actual Aggregated Generation per Type |
B1630 | Actual Or Estimated Wind and Solar Power Generation |
B1720 | Amount Of Balancing Reserves Under Contract Service |
B1730 | Prices Of Procured Balancing Reserves Service |
B1740 | Accepted Aggregated Offers |
B1750 | Activated Balancing Energy |
B1760 | Prices Of Activated Balancing Energy |
B1770 | Imbalance Prices |
B1780 | Aggregated Imbalance Volumes |
B1790 | Financial Expenses and Income For Balancing |
B1810 | Cross-Border Balancing Volumes of Exchanged Bids and Offers |
B1820 | Cross-Border Balancing Prices |
B1830 | Cross-border Balancing Energy Activated |
BOD | Bid Offer Level Data |
CDN | Credit Default Notice Data |
DERSYSDATA | Derived System Data |
DETSYSPRICES | Detailed System Prices |
DEVINDOD | Daily Energy Volume Data |
DISBSAD | Balancing Services Adjustment Action Data |
FORDAYDEM | Forecast Day and Day Ahead Demand Data |
FREQ | Rolling System Frequency |
FUELHH | Half Hourly Outturn Generation by Fuel Type |
MELIMBALNGC | Forecast Day and Day Ahead Margin and Imbalance Data |
MID | Market Index Data |
MessageDetailRetrieval | REMIT Flow - Message List Retrieval |
MessageListRetrieval | REMIT Flow - Message List Retrieval |
NETBSAD | Balancing Service Adjustment Data |
NONBM | Non BM STOR Instructed Volume Data |
PHYBMDATA | Physical Data |
SYSDEM | System Demand |
SYSWARN | System Warnings |
TEMP | Temperature Data |
WINDFORFUELHH | Wind Generation Forecast and Out-turn Data |
Owner metadata
- Name: Open Source UK Energy Data
- Login: OSUKED
- Email:
- Kind: organization
- Description: OSUKED is a combination of API wrappers, git-scrapers and Python tools for the UK energy sector
- Website: https://osuked.com/
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/75696139?v=4
- Repositories: 8
- Last ynced at: 2023-03-04T14:43:56.649Z
- Profile URL: https://github.com/OSUKED
GitHub Events
Total
- Watch event: 6
- Fork event: 1
Last Year
- Watch event: 6
- Fork event: 1
Committers metadata
Last synced: 7 days ago
Total Commits: 23,304
Total Committers: 3
Avg Commits per committer: 7,768.0
Development Distribution Score (DDS): 0.001
Commits in past year: 645
Committers in past year: 1
Avg Commits per committer in past year: 645.0
Development Distribution Score (DDS) in past year: 0.0
Name | Commits | |
---|---|---|
AyrtonB | A****B | 23292 |
peterdudfield | p****d@h****m | 11 |
Rachel Hassall | 3****5 | 1 |
Committer domains:
Issue and Pull Request metadata
Last synced: 2 days ago
Total issues: 21
Total pull requests: 8
Average time to close issues: 4 months
Average time to close pull requests: 3 months
Total issue authors: 16
Total pull request authors: 7
Average comments per issue: 3.29
Average comments per pull request: 1.0
Merged pull request: 4
Bot issues: 0
Bot pull requests: 0
Past year issues: 2
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 1
Past year pull request authors: 0
Past year average comments per issue: 2.5
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- peterdudfield (3)
- matteodefelice (3)
- AyrtonB (2)
- ClemAtt (1)
- zetinaricky (1)
- adfi (1)
- KrishnaMohinani (1)
- LuisTellezSirocco (1)
- Carterbouley (1)
- robhawkes (1)
- jack-regen (1)
- BenPortner (1)
- swaldman3 (1)
- ayokariks (1)
- DavidLloydNGP (1)
Top Pull Request Authors
- peterdudfield (2)
- GlennViroux (1)
- ClemAtt (1)
- mnbbrown (1)
- tomharvey (1)
- r4ch45 (1)
- AyrtonB (1)
Top Issue Labels
- enhancement (3)
- bug (1)
Top Pull Request Labels
Package metadata
- Total packages: 1
-
Total downloads:
- pypi: 2,531 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 21
- Total maintainers: 1
pypi.org: elexondataportal
- Homepage: https://github.com/OSUKED/ElexonDataPortal
- Documentation: https://elexondataportal.readthedocs.io/
- Licenses: mit
- Latest release: 2.0.16 (published over 2 years ago)
- Last Synced: 2025-04-26T12:02:49.228Z (2 days ago)
- Versions: 21
- Dependent Packages: 0
- Dependent Repositories: 1
- Downloads: 2,531 Last month
-
Rankings:
- Downloads: 4.21%
- Dependent packages count: 7.31%
- Forks count: 9.37%
- Stargazers count: 9.574%
- Average: 10.51%
- Dependent repos count: 22.088%
- Maintainers (1)
Dependencies
- actions/checkout v2 composite
- actions/setup-python v1 composite
- actions/checkout v2 composite
- actions/setup-python v1 composite
- stefanzweifel/git-auto-commit-action v4 composite
- configparser *
- junix *
- mkdocs-material-extensions *
- mkdocstrings *
- oastodcat *
- python-dotenv *
- sphinx *
Score: 13.140464558060751