From 9b24d86d417180368d6c93f5190d6471d973a96d Mon Sep 17 00:00:00 2001 From: capcir Date: Tue, 11 Jul 2023 08:32:22 +0100 Subject: [PATCH] update README.md --- README.md | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cd7164b..dd35cc2 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # efaciency -A package to simplify working with EFA blocks and settlement periods in the GB electricity trading system. +![Tests](https://github.com/github/docs/actions/workflows/test.yml/badge.svg) +![PyPi](https://img.shields.io/pypi/v/efaciency) + + +A package to simplify working with [EFA](https://en.wikipedia.org/wiki/Electricity_Forward_Agreement) blocks and settlement periods in the GB electricity trading system. ## Installation @@ -9,7 +13,9 @@ This package can be installed via pip: $ pip install efaciency ``` -## Quick start +## Examples + +### Settlement periods Define a settlement period and get the corresponding half-hour datetime. ```python @@ -20,7 +26,22 @@ Define a settlement period and get the corresponding half-hour datetime. datetime.datetime(2023, 7, 1, 11, 30, tzinfo=) ``` -Create ranges of half-hour granularity for all SPs in between two dates. +Get the corresponding EFA information and settlement information for a given timestamp. +```python +>>> 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=), + 'efa_date': datetime.date(2023, 7, 1), + 'efa_block': 4, +} +``` + +Create half-hourly range for all SPs in between two dates. ```python >>> from datetime import date >>> from efaciency import settlement_period_range @@ -38,6 +59,8 @@ Create ranges of half-hour granularity for all SPs in between two dates. } ``` +### EFA blocks + Define EFA blocks and get the corresponding start and end datetimes. ```python >>> from datetime import date @@ -49,6 +72,20 @@ Define EFA blocks and get the corresponding start and end datetimes. '2023-07-01 11:00' ``` +Create a range of all EFA blocks between two dates. +```python +>>> 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=), + 'end_ts': datetime.datetime(2023, 7, 1, 3, 0, tzinfo=), +} +``` + ## Contribution Please make a pull request or log an issue on GitHub.