Skip to main content

Package for accessing the Elexon data portal API

Project description


About the ElexonDataPortal Python API Wrapper

The ElexonDataPortal python wrapper is a project being developed within the UCL Energy & AI research group. It aims to provide an easy to use wrapper which enables data retrieval from a wide range of resources relating to UK electricity demand, generation and markets.

The ElexonDataPortal provides the ability to download data directly from the Elexon API and have it parsed into a user-friendly Pandas dataframe. All queries require both a stream name and query arguments, all query argument information can be found here. Previous users of Elexon data will have had to switch between many different naming conventions for query arguments, the ElexonDataPortal harmonises these so that instead of using one of say FromDate, EventStart or SettlementDate we would use start_date for all of them.

Using the ElexonDataPortal Python API Wrapper

Making Standalone Queries

Elexon allows you to query data in a very limited fashion, often constrained to returning individual settlment periods. These queries are exposed through the default query function from the API wrapper.

stream = 'B1630'

query_args = {
    'query_date' : '2019-09-25',
    'SP' : 48,

df_RES_gen = edp_wrapper.query(stream, query_args)

timeSeriesID businessType powerSystemResourceType settlementDate settlementPeriod quantity documentType processType curveType resolution activeFlag documentID documentRevNum
0 NGET-EMFIP-AGWS-TS-00291950 Solar generation "Solar" 2019-09-25 48 0 Wind and solar generation Realised Sequential fixed size block PT30M Y NGET-EMFIP-AGWS-00145968 1
1 NGET-EMFIP-AGWS-TS-00291951 Wind generation "Wind Offshore" 2019-09-25 48 79.657 Wind and solar generation Realised Sequential fixed size block PT30M Y NGET-EMFIP-AGWS-00145968 1
2 NGET-EMFIP-AGWS-TS-00291952 Wind generation "Wind Onshore" 2019-09-25 48 1342.004 Wind and solar generation Realised Sequential fixed size block PT30M Y NGET-EMFIP-AGWS-00145968 1

Orchestrating Multiple Queries

Where the standard query call will carry out individual requests for data from Elexon, the query orchestrator accepts a date range and repeatedly requests data over it. Alongside the start and end dates for the period in question any additional parameters which you would make in a standalone call can also be included.

stream = 'FUELHH'

query_args = {
    'start_date' : '2019-09-25',
    'end_date' : '2019-09-25 23:30',

df_generation = edp_wrapper.query_orchestrator(stream, query_args)

recordType startTimeOfHalfHrPeriod settlementPeriod ccgt oil coal nuclear wind ps npshyd ocgt other intfr intirl intned intew biomass intnem activeFlag local_datetime
0 FUELHH 2019-09-25 1 7965 0 0 6598 4245 0 293 1 80 1502 0 760 0 1753 0 Y 2019-09-25 00:00:00+01:00
1 FUELHH 2019-09-25 2 7405 0 0 6596 4376 0 292 1 79 1504 0 758 0 1756 0 Y 2019-09-25 00:30:00+01:00
2 FUELHH 2019-09-25 3 7423 0 0 6595 4243 0 290 2 80 1502 0 758 0 1758 0 Y 2019-09-25 01:00:00+01:00
3 FUELHH 2019-09-25 4 7574 0 0 6600 4020 0 301 2 78 1504 0 758 0 1755 0 Y 2019-09-25 01:30:00+01:00
4 FUELHH 2019-09-25 5 7811 0 0 6596 3920 0 280 1 77 1502 0 758 0 1754 0 Y 2019-09-25 02:00:00+01:00

We Need Your Help!

Currently a number of commonly used streams are included as part of the module. Unfortunately as there are over 100 streams in total, and as Elexon is planning a new data Foundation Platform, it was not deemed viable to initially include each and every stream. Instead the module has been made to be extendable so that new streams can be added for those who require them. If you add new streams please make a Git request to add them to the main module!

Information for each stream is laid out in the format below. The request type refers to whether the existing Elexon API queries data on a settlement period by settlement period basis or by accepting a date range. The required params is a dictionary which maps this modules harmonised names (e.g. query_date and SP) to the Elexon data stream param names (e.g. SettlementDate, SettlementPeriod) which vary from stream to stream.

    'name' : 'Detailed System Prices',
    'request_type' : 'SP_by_SP',
    'data_parse_type' : 'dataframe',
    'API_version' : '1',
    'optional_params' : None,
    'required_params' : {
        'query_date' : 'SettlementDate',
        'SP' : 'SettlementPeriod',

We are also looking for any contributions for data cleaners and plotters which can be used for specific streams. Currently these are limited to just Balancing Market streams.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ElexonDataPortal, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size ElexonDataPortal-1.0.0-py3-none-any.whl (10.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size ElexonDataPortal-1.0.0.tar.gz (8.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page