This is a minimal tool to query data from the Elexon BMRS API.
The Balancing Mechanism Reporting Service (BMRS) is the primary channel for providing operational data relating to the GB Electricity Balancing and Settlement arrangements. It’s used extensively by market participants to help make trading decisions and understanding market dynamics, and acts as a prompt reporting platform as well as a means of accessing historic data. The BMRS has a wider user base both within and outside of the energy industry and includes traders, regulators, industry forecasting teams and academics
Much content derived from ElexonAPIWrapper:
- extrapolating DataFrames from the
.xml
response is way less hacky than doing so from the.csv
response - grouping signals (
ServiceCode
s) by required arguments makes it much easier to validate queries
Contents:
requests
xmltodict
pandas
Can be installed through pip:
- locally:
cd
into this directory and dopip install ./
- from GitHub:
pip install git+https://github.com/GiorgioBalestrieri/elexon_api_tool.git
- register on the Elexon website to get your API key
- store it in a
api_key.txt
file in this folder - choose the signal you are interested in (see attached csv file)
- use
query_API
- to download data from multiple days, use
query_multiple_days
>>> from elexon_api import Client, query # checkout the query_async to speed things up
>>> from elexon_api import get_required_parameters
>>> from elexon_api import extract_df
>>> client = Client.from_key_file() # specify path to file
>>> service_code = 'B1760'
['APIKey', 'SettlementDate', 'Period']
>>> params = {'SettlementDate': pd.datetime(2019,6,15),
'Period': '*'}
>>> r_dict = query(client, service_code, **params)
>>> df = extract_df(r_dict)
>>> df.head()