Skip to main content

An easy way to nagivate EFA blocks and settlement periods in GB electricity trading.

Project description

efaciency

Tests PyPi Coverage

A package to simplify working with EFA blocks and settlement periods in the GB electricity trading system.

Installation

This package can be installed via pip:

$ pip install efaciency

Examples

Settlement periods

Get the starting timestamp for a settlement period.

>>> from datetime import date, datetime
>>> import efaciency

>>> efaciency.sp.to_ts(settlement_period=4)  # defaults to today as settlement date
datetime.datetime(2025, 2, 18, 1, 30, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))

>>> efaciency.sp.to_ts(settlement_period=13, settlement_date=date(2025, 5, 23))
datetime.datetime(2025, 5, 23, 6, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))

You can also get the settlement for a given timestamp:

>>> efaciency.sp.from_ts(ts=datetime(2025, 1, 12, 17, 30))
36

EFA blocks

Get the starting and ending timestamp for an EFA block.

>>> from datetime import date, datetime
>>> import efaciency

>>> efaciency.block.to_start_ts(efa_block=3)  # defaults to today as EFA date
datetime.datetime(2025, 2, 18, 7, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))

>>> efaciency.block.to_start_ts(efa_block=1, efa_date=date(2025, 5, 23))
datetime.datetime(2025, 5, 22, 23, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))

You can also get the EFA block for a given timestamp:

>>> efaciency.block.from_ts(ts=datetime(2025, 1, 12, 17, 30))
5

What about clock change?

If no timezone is provided, efaciency always assumes Europe/London timezone.

On clock change days, a tz-aware datetime must be passed or the fold parameter must be used.

>>> efaciency.sp.from_ts(datetime(2025, 10, 26, 1))
3

>>> efaciency.sp.from_ts(datetime(2025, 10, 26, 1).replace(fold=1))
5

Contribution

Please make a pull request or log an issue on GitHub.

License

Code is released as free software under the MIT License (see LICENSE file).

Project details


Download files

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

Source Distribution

efaciency-0.3.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

efaciency-0.3.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file efaciency-0.3.1.tar.gz.

File metadata

  • Download URL: efaciency-0.3.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.1

File hashes

Hashes for efaciency-0.3.1.tar.gz
Algorithm Hash digest
SHA256 cbf15b3624fca81d4eab1e4b8f2ccaa07f8099994ee6b128ca446f45cb0ecdf1
MD5 615ab05663c1582585b4bad4b2e7f197
BLAKE2b-256 5d083625d24895072939dd6e5f3412ac7780bb12067546b6d3490fd67fae4b55

See more details on using hashes here.

File details

Details for the file efaciency-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: efaciency-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.1

File hashes

Hashes for efaciency-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4fcff81c48b56994f3db1686c8591f363b98d2bb1a2ced7ab5a98c7d8c485a54
MD5 859fa0c14702f616dc41785e7b48540c
BLAKE2b-256 f6381992238e6b871736a3f8e721cbd92dd416324acf0f25cbaccfee2b827065

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page