An easy way to nagivate EFA days and settlement periods in GB electricity trading.
Project description
efaciency
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
Define a settlement period and get the corresponding half-hour datetime.
>>> from datetime import date
>>> from efaciency import SettlementPeriod
>>> sp = SettlementPeriod(settlement_date=date(2023, 7, 1), settlement_period=24)
>>> sp["ts"]
datetime.datetime(2023, 7, 1, 11, 30, tzinfo=<DstTzInfo 'Europe/London' BST+1:00:00 DST>)
Get the corresponding EFA information and settlement information for a given timestamp.
>>> from datetime import datetime
>>> from efaciency import SettlementPeriod
>>> sp = SettlementPeriod(ts=datetime(2023, 7, 1, 11, 30))
>>> sp
{
'settlement_date': datetime.date(2023, 7, 1)
'settlement_period': 24,
'ts': datetime.datetime(2023, 7, 1, 11, 30, tzinfo=<DstTzInfo 'Europe/London' BST+1:00:00 DST>),
'efa_date': datetime.date(2023, 7, 1),
'efa_block': 4,
}
Create half-hourly range for all SPs in between two dates.
>>> from datetime import date
>>> from efaciency import settlement_period_range
>>> sp_range = settlement_period_range(
... from_efa_date=date(2023, 7, 1),
... to_efa_date=date(2023, 7, 2),
... )
>>> sp_range[0]
{
'settlement_date': datetime.date(2023, 6, 30)
'settlement_period': 47,
'ts': datetime.datetime(2023, 6, 30, 23, 0, tzinfo=<DstTzInfo 'Europe/London' BST+1:00:00 DST>),
'efa_date': datetime.date(2023, 7, 1),
'efa_block': 1
}
EFA blocks
Define EFA blocks and get the corresponding start and end datetimes.
>>> from datetime import date
>>> from efaciency import EFABlock
>>> efa = EFABlock(efa_date=date(2023, 7, 1), efa_block=3)
>>> efa["start_ts"].strftime("%Y-%m-%d %H:%M")
'2023-07-01 07:00'
>>> efa["end_ts"].strftime("%Y-%m-%d %H:%M")
'2023-07-01 11:00'
Create a range of all EFA blocks between two dates.
>>> from datetime import date
>>> from efaciency import efa_block_range
>>> efa_range = efa_block_range(date(2023, 7, 1), date(2023, 7, 2))
>>> efa_range[0]
{
'efa_date': datetime.date(2023, 7, 1),
'efa_block': 1,
'start_ts': datetime.datetime(2023, 6, 30, 23, 0, tzinfo=<DstTzInfo 'Europe/London' BST+1:00:00 DST>),
'end_ts': datetime.datetime(2023, 7, 1, 3, 0, tzinfo=<DstTzInfo 'Europe/London' BST+1:00:00 DST>),
}
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file efaciency-0.2.0.tar.gz.
File metadata
- Download URL: efaciency-0.2.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ffd83b336517de73e16e8254e10d5bfde44cef6c5486b7ba61cc37df4795cd8
|
|
| MD5 |
e651d00907ea4a8db1047afad48993c0
|
|
| BLAKE2b-256 |
ffc5941043316ad30ad7b6408574c98a24facc1fb401802ce9b04d86cfdaaca3
|
File details
Details for the file efaciency-0.2.0-py2.py3-none-any.whl.
File metadata
- Download URL: efaciency-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a06a924c14ee35b66fbfc7724f623f7c3cb3a7ff38bf843a7f9d9b6330ca9fc6
|
|
| MD5 |
cc10fa068ffaf0a28ecf786f1ca9e90e
|
|
| BLAKE2b-256 |
459df92ee0f109a77d5a2a942062d10567694995f4840070d776e8b9bd154aa8
|