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 a datetime with 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

CLI

You can also use the efaciency CLI:

efaciency --help

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.4.0.tar.gz (4.9 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.4.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: efaciency-0.4.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for efaciency-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7981737d2aa3883e76442b322a00d64108663f7d396a56f50d11378aa0153907
MD5 cab366f5409e5568dd04c1ef237d0570
BLAKE2b-256 95e52cbe6b9f62b2a610608bfd99148f38d832d83a9d7bc67fc97a428d576881

See more details on using hashes here.

File details

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

File metadata

  • Download URL: efaciency-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for efaciency-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3736b275a16ed01b17c04b22c0937bc7e41bc7fc949d2f84eb42a2dcd62049de
MD5 0cf88ff5e4332e2332e9d2ddd2d4083d
BLAKE2b-256 17cc770909599fe13c6689c83ea09be92945c201f15ffb25b19a19de9191dbb0

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