LCPDelta 2.2.3a1__tar.gz → 2.2.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lcpdelta-2.2.3a1/lcpdelta_python_package/src/LCPDelta.egg-info → lcpdelta-2.2.6}/PKG-INFO +1 -1
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6/lcpdelta_python_package/src/LCPDelta.egg-info}/PKG-INFO +1 -1
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/api_helper.py +35 -18
- lcpdelta-2.2.6/lcpdelta_python_package/src/lcp_delta/enact/services/niv_evolution_service.py +47 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/pyproject.toml +2 -2
- lcpdelta-2.2.3a1/lcpdelta_python_package/src/lcp_delta/enact/services/niv_evolution_service.py +0 -28
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/LICENSE +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/LICENSE-Apache +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/README.md +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/LCPDelta.egg-info/SOURCES.txt +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/LCPDelta.egg-info/dependency_links.txt +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/LCPDelta.egg-info/requires.txt +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/LCPDelta.egg-info/top_level.txt +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/__init__.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/__init__.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/api_endpoints.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/api_helper_base.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/constants.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/credentials_holder.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/http/exceptions.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/http/retry_policies.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/response_objects/usage_info.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/__init__.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/base_endpoints.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/chart_helper.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/configs/__init__.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/configs/base_endpoints_default.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/configs/base_endpoints_dev.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/dps_helper.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/enums.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/helpers.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/loader.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/multi_series_dps_helper.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/ancillary_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/bm_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/carbon_calculator_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/contract_evolution_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/day_ahead_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/epex_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/hof_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/index_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/leaderboard_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/news_table_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/nordpool_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/plant_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/series_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/services/skip_rates_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/flextrack/__init__.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/flextrack/api_helper.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/flextrack/services/exporter_service.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/global_helpers.py +0 -0
- {lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/setup.cfg +0 -0
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/api_helper.py
RENAMED
|
@@ -2115,7 +2115,6 @@ class APIHelper(APIHelperBase):
|
|
|
2115
2115
|
options 'List[str]' : List of options to get evolution metrics for. Accepted values:
|
|
2116
2116
|
[
|
|
2117
2117
|
NivOutturn,
|
|
2118
|
-
SystemPrice,
|
|
2119
2118
|
MostExpensiveBidAccepted,
|
|
2120
2119
|
MostExpensiveOfferAccepted,
|
|
2121
2120
|
MostExpensiveUnflaggedBidAccepted,
|
|
@@ -2167,7 +2166,6 @@ class APIHelper(APIHelperBase):
|
|
|
2167
2166
|
options 'List[str]' : List of options to get evolution metrics for. Accepted values:
|
|
2168
2167
|
[
|
|
2169
2168
|
NivOutturn,
|
|
2170
|
-
SystemPrice,
|
|
2171
2169
|
MostExpensiveBidAccepted,
|
|
2172
2170
|
MostExpensiveOfferAccepted,
|
|
2173
2171
|
MostExpensiveUnflaggedBidAccepted,
|
|
@@ -2211,7 +2209,11 @@ class APIHelper(APIHelperBase):
|
|
|
2211
2209
|
options: list[str],
|
|
2212
2210
|
) -> pd.DataFrame:
|
|
2213
2211
|
"""
|
|
2214
|
-
Get
|
|
2212
|
+
Get NIV evolution metrics over an inclusive date range.
|
|
2213
|
+
|
|
2214
|
+
Fetches every daily page automatically (one API usage unit per page).
|
|
2215
|
+
Returns Date, Period, Metric, Timestamp and Value columns. Dates retain
|
|
2216
|
+
the API's dd-MM-yyyy format; timestamps are returned without conversion.
|
|
2215
2217
|
|
|
2216
2218
|
Args:
|
|
2217
2219
|
start_date 'datetime' : start date to request
|
|
@@ -2220,7 +2222,6 @@ class APIHelper(APIHelperBase):
|
|
|
2220
2222
|
options 'List[str]' : List of options to get evolution metrics for. Accepted values:
|
|
2221
2223
|
[
|
|
2222
2224
|
NivOutturn,
|
|
2223
|
-
SystemPrice,
|
|
2224
2225
|
MostExpensiveBidAccepted,
|
|
2225
2226
|
MostExpensiveOfferAccepted,
|
|
2226
2227
|
MostExpensiveUnflaggedBidAccepted,
|
|
@@ -2249,13 +2250,21 @@ class APIHelper(APIHelperBase):
|
|
|
2249
2250
|
while more_pages:
|
|
2250
2251
|
request_body = niv_evolution_service.generate_date_range_request(start_date, end_date, options, cursor)
|
|
2251
2252
|
response = self._get_request(self.endpoints.NIV_EVOLUTION_DATE_RANGE, request_body, long_timeout=True)
|
|
2252
|
-
page_data = response.get("data", {})
|
|
2253
2253
|
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2254
|
+
page_date = cursor or start_date.strftime("%Y-%m-%d")
|
|
2255
|
+
if response is None:
|
|
2256
|
+
raise ValueError(
|
|
2257
|
+
f"NIV evolution API pagination failed for {page_date}."
|
|
2258
|
+
)
|
|
2259
|
+
|
|
2260
|
+
try:
|
|
2261
|
+
day_data = niv_evolution_service.process_response(response["data"])
|
|
2262
|
+
except (ValueError, KeyError, TypeError) as exc:
|
|
2263
|
+
raise ValueError(
|
|
2264
|
+
f"Failed to process NIV evolution page {page_date}: {exc}"
|
|
2265
|
+
) from exc
|
|
2266
|
+
|
|
2267
|
+
all_data.append(day_data)
|
|
2259
2268
|
|
|
2260
2269
|
cursor = response.get("nextCursor")
|
|
2261
2270
|
if not cursor:
|
|
@@ -2264,7 +2273,7 @@ class APIHelper(APIHelperBase):
|
|
|
2264
2273
|
if all_data:
|
|
2265
2274
|
df_all = pd.concat(all_data, ignore_index=True)
|
|
2266
2275
|
else:
|
|
2267
|
-
df_all = pd.DataFrame(columns=
|
|
2276
|
+
df_all = pd.DataFrame(columns=niv_evolution_service.COLUMNS)
|
|
2268
2277
|
return df_all
|
|
2269
2278
|
|
|
2270
2279
|
async def get_niv_evolution_for_date_range_async(
|
|
@@ -2280,13 +2289,21 @@ class APIHelper(APIHelperBase):
|
|
|
2280
2289
|
while more_pages:
|
|
2281
2290
|
request_body = niv_evolution_service.generate_date_range_request(start_date, end_date, options, cursor)
|
|
2282
2291
|
response = await self._get_request_async(self.endpoints.NIV_EVOLUTION_DATE_RANGE, request_body, long_timeout=True)
|
|
2283
|
-
page_data = response.get("data", {})
|
|
2284
2292
|
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2293
|
+
page_date = cursor or start_date.strftime("%Y-%m-%d")
|
|
2294
|
+
if response is None:
|
|
2295
|
+
raise ValueError(
|
|
2296
|
+
f"NIV evolution API pagination failed for {page_date}."
|
|
2297
|
+
)
|
|
2298
|
+
|
|
2299
|
+
try:
|
|
2300
|
+
day_data = niv_evolution_service.process_response(response["data"])
|
|
2301
|
+
except (ValueError, KeyError, TypeError) as exc:
|
|
2302
|
+
raise ValueError(
|
|
2303
|
+
f"Failed to process NIV evolution page {page_date}: {exc}"
|
|
2304
|
+
) from exc
|
|
2305
|
+
|
|
2306
|
+
all_data.append(day_data)
|
|
2290
2307
|
|
|
2291
2308
|
cursor = response.get("nextCursor")
|
|
2292
2309
|
if not cursor:
|
|
@@ -2295,7 +2312,7 @@ class APIHelper(APIHelperBase):
|
|
|
2295
2312
|
if all_data:
|
|
2296
2313
|
df_all = pd.concat(all_data, ignore_index=True)
|
|
2297
2314
|
else:
|
|
2298
|
-
df_all = pd.DataFrame(columns=
|
|
2315
|
+
df_all = pd.DataFrame(columns=niv_evolution_service.COLUMNS)
|
|
2299
2316
|
return df_all
|
|
2300
2317
|
|
|
2301
2318
|
def get_carbon_emissions(
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
|
|
5
|
+
from lcp_delta.global_helpers import convert_date_to_iso
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
COLUMNS = ["Date", "Period", "Metric", "Timestamp", "Value"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _validate_options(options: list[str]):
|
|
12
|
+
if any(option.casefold() in {"systemprice", "1"} for option in options):
|
|
13
|
+
raise ValueError("SystemPrice is not currently supported for Niv evolution")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def generate_by_period_request(period: int, date: datetime, options: list[str]):
|
|
17
|
+
_validate_options(options)
|
|
18
|
+
return {"date": convert_date_to_iso(date), "period": period, "options": options}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def generate_by_day_request(date: datetime, options: list[str]):
|
|
22
|
+
_validate_options(options)
|
|
23
|
+
return {"date": convert_date_to_iso(date), "options": options}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def generate_date_range_request(
|
|
27
|
+
start_date: datetime, end_date: datetime, options: list[str], cursor: str | None = None
|
|
28
|
+
):
|
|
29
|
+
_validate_options(options)
|
|
30
|
+
request_body = {"end": convert_date_to_iso(end_date), "options": options}
|
|
31
|
+
if cursor:
|
|
32
|
+
request_body["cursor"] = cursor
|
|
33
|
+
else:
|
|
34
|
+
request_body["start"] = convert_date_to_iso(start_date)
|
|
35
|
+
return request_body
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def process_response(response: dict) -> pd.DataFrame:
|
|
39
|
+
"""Keep the API's column order, date strings and minute-by-minute rows."""
|
|
40
|
+
if response is None:
|
|
41
|
+
raise ValueError("NIV evolution API returned null instead of a data response.")
|
|
42
|
+
data = response["data"]
|
|
43
|
+
if data is None:
|
|
44
|
+
raise ValueError("NIV evolution API returned null data.")
|
|
45
|
+
if not data:
|
|
46
|
+
return pd.DataFrame(columns=COLUMNS)
|
|
47
|
+
return pd.DataFrame(data[1:], columns=data[0])
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "LCPDelta"
|
|
7
|
-
version = "2.2.
|
|
7
|
+
version = "2.2.6"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="LCP Delta", email="enact.helpdesk@lcp.uk.com" },
|
|
10
10
|
]
|
|
@@ -52,7 +52,7 @@ dev = [
|
|
|
52
52
|
[tool.ruff]
|
|
53
53
|
src = ["lcpdelta_python_package/src"]
|
|
54
54
|
line-length = 120
|
|
55
|
-
target-version = "2.2.
|
|
55
|
+
target-version = "2.2.6"
|
|
56
56
|
|
|
57
57
|
[tool.ruff.lint.extend-per-file-ignores]
|
|
58
58
|
"__init__.py" = ["E402", "F401"]
|
lcpdelta-2.2.3a1/lcpdelta_python_package/src/lcp_delta/enact/services/niv_evolution_service.py
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
from datetime import datetime, timedelta
|
|
2
|
-
from zoneinfo import ZoneInfo
|
|
3
|
-
from lcp_delta.global_helpers import convert_date_to_iso, get_period_from_datetime
|
|
4
|
-
import pandas as pd
|
|
5
|
-
|
|
6
|
-
def generate_by_period_request(period: int, date: datetime, options: list[str]):
|
|
7
|
-
date_str = convert_date_to_iso(date)
|
|
8
|
-
return {"date": date_str, "period": period, "options": options}
|
|
9
|
-
|
|
10
|
-
def generate_by_day_request(date: datetime, options: list[str]):
|
|
11
|
-
date_str = convert_date_to_iso(date)
|
|
12
|
-
return {"date": date_str, "options": options}
|
|
13
|
-
|
|
14
|
-
def generate_date_range_request(start_date: datetime, end_date: datetime, options: list[str], cursor:str = None):
|
|
15
|
-
start_date_str = convert_date_to_iso(start_date)
|
|
16
|
-
end_date_str = convert_date_to_iso(end_date)
|
|
17
|
-
request_body = {
|
|
18
|
-
"start": start_date_str,
|
|
19
|
-
"end": end_date_str,
|
|
20
|
-
"options": options
|
|
21
|
-
}
|
|
22
|
-
if cursor:
|
|
23
|
-
request_body["cursor"] = cursor
|
|
24
|
-
|
|
25
|
-
return request_body
|
|
26
|
-
|
|
27
|
-
def process_response(response: dict) -> pd.DataFrame:
|
|
28
|
-
return pd.DataFrame(response["data"][1:], columns=response["data"][0])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/LCPDelta.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/LCPDelta.egg-info/requires.txt
RENAMED
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/LCPDelta.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/__init__.py
RENAMED
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/api_endpoints.py
RENAMED
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/api_helper_base.py
RENAMED
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/constants.py
RENAMED
|
File without changes
|
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/common/http/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/base_endpoints.py
RENAMED
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/chart_helper.py
RENAMED
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/configs/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/enact/dps_helper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/flextrack/__init__.py
RENAMED
|
File without changes
|
{lcpdelta-2.2.3a1 → lcpdelta-2.2.6}/lcpdelta_python_package/src/lcp_delta/flextrack/api_helper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|