Skip to content

Commit ec9ecae

Browse files
authored
Add Balancing Reserve
Add Balancing Reserve
2 parents 9785a54 + 733710e commit ec9ecae

8 files changed

+114
-23
lines changed

.pre-commit-config.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ fail_fast: true
44

55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v3.4.0
7+
rev: v4.5.0
88
hooks:
99
- id: trailing-whitespace
1010
- id: end-of-file-fixer
1111
- id: check-toml
1212
- id: check-merge-conflict
1313

1414
- repo: https://github.com/psf/black
15-
rev: 22.3.0
15+
rev: 24.3.0
1616
hooks:
1717
- id: black
1818

19-
- repo: https://github.com/timothycrosley/isort
20-
rev: 5.6.4
19+
- repo: https://github.com/PyCQA/isort
20+
rev: 5.13.2
2121
hooks:
2222
- id: isort
2323

24-
- repo: https://gitlab.com/pycqa/flake8
25-
rev: 3.8.4
24+
- repo: https://github.com/PyCQA/flake8
25+
rev: 7.0.0
2626
hooks:
2727
- id: flake8
2828
additional_dependencies: [flake8-isort]

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"python.testing.pytestArgs": ["tests"],
3+
"python.testing.unittestEnabled": false,
4+
"python.testing.pytestEnabled": true
5+
}

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ r: bytes = client.query(date_col=date_col, start_date=start_date, end_date=end_d
4343
* `dx-eac-eso-results-summary`
4444
* `dx-eac-eso-sell-orders`
4545
* `dx-eac-eso-buy-orders`
46+
* `br-eac-eso-results-summary`
47+
* `br-eac-eso-sell-orders`
48+
* `br-eac-eso-buy-orders`
49+
* `br-eac-eso-results-by-units`
4650

4751

4852
### Download of files

pyngeso/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .pyngeso import NgEso
22

3-
__version__ = "0.3.6"
3+
__version__ = "0.3.7"

pyngeso/pyngeso.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def construct_filter_sql(filters: List[str], date_filtering: bool) -> str:
148148
def validate_date_range(
149149
start_date: Union[date, datetime], end_date: Union[date, datetime]
150150
) -> None:
151-
assert type(start_date) == type(
151+
assert type(start_date) == type( # noqa: E721
152152
end_date
153153
), "start_date and end_date should either be both a date or a datetime object"
154154

pyngeso/resources.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,23 @@
184184
"dx-eac-eso-buy-orders": {
185185
"id": "1cf68f59-8eb8-4f1d-bccf-11b5a47b24e5",
186186
"url": "https://api.nationalgrideso.com/api/3/action/datastore_search",
187-
}
187+
},
188+
"br-eac-eso-results-summary": {
189+
"id": "1b3f2ee1-74a0-4939-a5a3-f01f19e663e4",
190+
"url": "https://api.nationalgrideso.com/api/3/action/datastore_search",
191+
},
192+
"br-eac-eso-sell-orders": {
193+
"id": "3f53c38b-d287-41af-b4c8-769abb6e707a",
194+
"url": "https://api.nationalgrideso.com/api/3/action/datastore_search",
195+
},
196+
"br-eac-eso-buy-orders": {
197+
"id": "8a549d29-52cd-4016-a04e-c01a3e31bd3a",
198+
"url": "https://api.nationalgrideso.com/api/3/action/datastore_search",
199+
},
200+
"br-eac-eso-results-by-units": {
201+
"id": "5d8e47be-e262-4398-89b0-6f93f636faf6",
202+
"url": "https://api.nationalgrideso.com/api/3/action/datastore_search",
203+
},
188204
}
189205

190206
file_resource_ids: Dict[str, Dict[str, str]] = {

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pyngeso"
3-
version = "0.3.6"
3+
version = "0.3.7"
44
description = "Simple python wrapper for the National Grid ESO Portal"
55
authors = [
66
"atsangarides <[email protected]>",

tests/test_pyngeso.py

+79-13
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def test_historic_generation_mix():
121121
first_row = next(c)
122122

123123
assert "DATETIME" in headers_row
124-
assert "2009-01-01 00:00:00" in first_row
124+
assert "2009-01-01 00:00:00+00:00" in first_row
125125
assert len(headers_row) == len(first_row)
126126

127127

@@ -232,8 +232,12 @@ def test_dc_volume_forecast():
232232
end_date = date(2022, 5, 21)
233233
filter_condition = "\"Service_Type\" = 'DC-L'"
234234
client = NgEso("dc-volume-forecast")
235-
r = client.query(date_col=date_col, start_date=start_date, end_date=end_date,
236-
filters=[filter_condition])
235+
r = client.query(
236+
date_col=date_col,
237+
start_date=start_date,
238+
end_date=end_date,
239+
filters=[filter_condition],
240+
)
237241

238242
assert isinstance(r, bytes)
239243
r_dict = json.loads(r)
@@ -251,8 +255,9 @@ def test_dcmr_block_orders():
251255
start_date = date(2022, 5, 16)
252256
end_date = date(2022, 5, 17)
253257
client = NgEso("dc-dr-dm-block-orders")
254-
r = client.query(date_col=date_col, start_date=start_date, end_date=end_date,
255-
filters=[])
258+
r = client.query(
259+
date_col=date_col, start_date=start_date, end_date=end_date, filters=[]
260+
)
256261

257262
assert isinstance(r, bytes)
258263
r_dict = json.loads(r)
@@ -269,8 +274,9 @@ def test_dcmr_linear_orders():
269274
start_date = date(2022, 5, 16)
270275
end_date = date(2022, 5, 17)
271276
client = NgEso("dc-dr-dm-linear-orders")
272-
r = client.query(date_col=date_col, start_date=start_date, end_date=end_date,
273-
filters=[])
277+
r = client.query(
278+
date_col=date_col, start_date=start_date, end_date=end_date, filters=[]
279+
)
274280

275281
assert isinstance(r, bytes)
276282
r_dict = json.loads(r)
@@ -356,9 +362,12 @@ def test_dx_eac_eso_results_summary():
356362
assert isinstance(r, bytes)
357363
r_dict = json.loads(r)
358364
records = r_dict.get("result").get("records")
365+
366+
for r in records:
367+
print(r)
359368
assert isinstance(records, list)
360369
assert len(records) > 0
361-
assert len(records) == 36
370+
assert len(records) == 42
362371

363372

364373
@pytest.mark.vcr
@@ -381,11 +390,69 @@ def test_dx_eac_eso_sell_orders():
381390

382391

383392
@pytest.mark.vcr
384-
def test_dx_eac_eso_buy_orders():
393+
def test_br_eac_eso_results_summary():
385394
date_col = "deliveryStart"
386-
start_date = datetime(2023, 11, 2, 23)
387-
end_date = datetime(2023, 11, 3, 23)
388-
client = NgEso("dx-eac-eso-buy-orders")
395+
start_date = datetime(2024, 3, 14, 23)
396+
end_date = datetime(2024, 3, 15, 23)
397+
client = NgEso("br-eac-eso-results-summary")
398+
r = client.query(
399+
date_col=date_col,
400+
start_date=start_date,
401+
end_date=end_date,
402+
)
403+
404+
assert isinstance(r, bytes)
405+
r_dict = json.loads(r)
406+
records = r_dict.get("result").get("records")
407+
assert isinstance(records, list)
408+
assert len(records) > 0
409+
assert len(records) == 98
410+
411+
412+
@pytest.mark.vcr
413+
def test_br_eac_eso_sell_orders():
414+
date_col = "deliveryStart"
415+
start_date = datetime(2024, 3, 14, 23)
416+
end_date = datetime(2024, 3, 15, 23)
417+
client = NgEso("br-eac-eso-sell-orders")
418+
r = client.query(
419+
date_col=date_col,
420+
start_date=start_date,
421+
end_date=end_date,
422+
)
423+
424+
assert isinstance(r, bytes)
425+
r_dict = json.loads(r)
426+
records = r_dict.get("result").get("records")
427+
assert isinstance(records, list)
428+
assert len(records) > 0
429+
430+
431+
@pytest.mark.vcr
432+
def test_br_eac_eso_buy_orders():
433+
date_col = "deliveryStart"
434+
start_date = datetime(2024, 3, 14, 23)
435+
end_date = datetime(2024, 3, 15, 23)
436+
client = NgEso("br-eac-eso-buy-orders")
437+
r = client.query(
438+
date_col=date_col,
439+
start_date=start_date,
440+
end_date=end_date,
441+
)
442+
443+
assert isinstance(r, bytes)
444+
r_dict = json.loads(r)
445+
records = r_dict.get("result").get("records")
446+
assert isinstance(records, list)
447+
assert len(records) > 0
448+
449+
450+
@pytest.mark.vcr
451+
def test_br_eac_eso_results_by_units():
452+
date_col = "deliveryStart"
453+
start_date = datetime(2024, 3, 14, 23)
454+
end_date = datetime(2024, 3, 15, 23)
455+
client = NgEso("br-eac-eso-results-by-units")
389456
r = client.query(
390457
date_col=date_col,
391458
start_date=start_date,
@@ -397,4 +464,3 @@ def test_dx_eac_eso_buy_orders():
397464
records = r_dict.get("result").get("records")
398465
assert isinstance(records, list)
399466
assert len(records) > 0
400-

0 commit comments

Comments
 (0)