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=<DstTzInfo 'Europe/London' GMT0:00:00 STD>)

>>> efaciency.sp.to_ts(settlement_period=13, settlement_date=date(2025, 5, 23))
datetime.datetime(2025, 5, 23, 6, 0, tzinfo=<DstTzInfo 'Europe/London' BST+1:00:00 DST>)

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=<DstTzInfo 'Europe/London' GMT0:00:00 STD>)

>>> efaciency.block.to_start_ts(efa_block=1, efa_date=date(2025, 5, 23))
datetime.datetime(2025, 5, 22, 23, 0, tzinfo=<DstTzInfo 'Europe/London' BST+1:00:00 DST>)

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.0.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.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: efaciency-0.3.0.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.0.tar.gz
Algorithm Hash digest
SHA256 4e2fe0f42dce69015c4f8d3db7be90a542f42a4488d019abf866a87ad66a104b
MD5 d8eb47d2773966765b721a88c57ab9c4
BLAKE2b-256 4cb01f6d8f029742bd7206f8b37cbc629184181e84c7b13c7a37162d1b8c2a69

See more details on using hashes here.

File details

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

File metadata

  • Download URL: efaciency-0.3.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 912b226f320a663c1ef8d993e8fc4f8ca91ec1f684f5aacf3895694432fa40ee
MD5 119b3b931254ef2f8636c3b95a844019
BLAKE2b-256 28843e38063320dcf6c842085eaf53c3520879eacaaf1d2ca4f3fabf009aa98f

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