eptr2 1.1.4__tar.gz → 1.2.0.dev0__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.
Files changed (51) hide show
  1. eptr2-1.2.0.dev0/.gitignore +167 -0
  2. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/PKG-INFO +16 -19
  3. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/util/time.py +40 -2
  4. eptr2-1.2.0.dev0/pyproject.toml +40 -0
  5. eptr2-1.2.0.dev0/tests/__init__.py +5 -0
  6. eptr2-1.2.0.dev0/tests/composite/__init__.py +0 -0
  7. eptr2-1.2.0.dev0/tests/composite/test_consumption.py +32 -0
  8. eptr2-1.2.0.dev0/tests/composite/test_mms.py +37 -0
  9. eptr2-1.2.0.dev0/tests/composite/test_price_and_cost.py +57 -0
  10. eptr2-1.2.0.dev0/tests/composite/test_production.py +34 -0
  11. eptr2-1.2.0.dev0/uv.lock +1291 -0
  12. eptr2-1.1.4/pyproject.toml +0 -33
  13. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/LICENSE +0 -0
  14. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/README.md +0 -0
  15. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/__init__.py +0 -0
  16. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/composite/__init__.py +0 -0
  17. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/composite/bpm.py +0 -0
  18. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/composite/consumption.py +0 -0
  19. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/composite/dabi_idm.py +0 -0
  20. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/composite/idm_log.py +0 -0
  21. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/composite/mms.py +0 -0
  22. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/composite/price_and_cost.py +0 -0
  23. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/composite/production.py +0 -0
  24. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/main.py +0 -0
  25. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/mapping/__init__.py +0 -0
  26. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/mapping/checks.py +0 -0
  27. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/mapping/help.py +0 -0
  28. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/mapping/parameters.py +0 -0
  29. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/mapping/path.py +0 -0
  30. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/mapping/processing.py +0 -0
  31. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/processing/__init__.py +0 -0
  32. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/processing/postprocess/__init__.py +0 -0
  33. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/processing/postprocess/items.py +0 -0
  34. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/processing/preprocess/__init__.py +0 -0
  35. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/processing/preprocess/calls.py +0 -0
  36. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/processing/preprocess/params.py +0 -0
  37. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/tutorials/__init__.py +0 -0
  38. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/tutorials/calc.py +0 -0
  39. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/tutorials/composite/__init__.py +0 -0
  40. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/tutorials/composite/common.py +0 -0
  41. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/tutorials/composite/pages/1_/360/237/221/251/342/200/215/360/237/222/273_Demo.py" +0 -0
  42. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/tutorials/composite/pages/2_/360/237/224/256_Pozisyonlar.py" +0 -0
  43. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/tutorials/composite/pages/3_/342/232/241/357/270/217_/303/234retim_Planlama.py" +0 -0
  44. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/tutorials/composite/pages/4_/360/237/222/260_Fiyat_ve_Maliyetler.py" +0 -0
  45. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/tutorials/composite//342/255/220/357/270/217_Ana_Sayfa.py" +0 -0
  46. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/tutorials/demo.py +0 -0
  47. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/tutorials/main.py +0 -0
  48. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/util/__init__.py +0 -0
  49. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/util/certificate.py +0 -0
  50. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/util/costs.py +0 -0
  51. {eptr2-1.1.4 → eptr2-1.2.0.dev0}/eptr2/util/evaluation.py +0 -0
@@ -0,0 +1,167 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
161
+
162
+ **/.DS_Store
163
+ data/
164
+ runs/
165
+ .vscode/
166
+ helpdocs/
167
+ creds/
@@ -1,25 +1,23 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: eptr2
3
- Version: 1.1.4
3
+ Version: 1.2.0.dev0
4
4
  Summary: EPIAS Transparency Platform v2.0 Python client by Robokami Data
5
- License: Apache-2.0
6
- Author: Tideseed
7
- Author-email: info@tideseed.com
8
- Requires-Python: >=3.9, !=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*, !=3.8.*
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Classifier: Programming Language :: Python :: 3.13
5
+ Author-email: Tideseed <info@tideseed.com>
6
+ License: Apache License 2.0
7
+ License-File: LICENSE
8
+ Requires-Python: !=3.9.7,>=3.9.6
9
+ Requires-Dist: pytz>=2024.1
10
+ Requires-Dist: urllib3==2.5.0
15
11
  Provides-Extra: allextras
12
+ Requires-Dist: pandas>=2.1.3; extra == 'allextras'
13
+ Requires-Dist: requests>=2.32.4; extra == 'allextras'
14
+ Requires-Dist: streamlit>=1.48.0; extra == 'allextras'
15
+ Requires-Dist: tornado>=6.5.0; extra == 'allextras'
16
16
  Provides-Extra: dataframe
17
- Requires-Dist: pandas (>=2.1.3) ; extra == "dataframe" or extra == "allextras"
18
- Requires-Dist: pytz (>=2024.1)
19
- Requires-Dist: requests (>=2.32.4) ; extra == "allextras"
20
- Requires-Dist: streamlit (>=1.48.0) ; extra == "allextras"
21
- Requires-Dist: tornado (>=6.5.0) ; extra == "allextras"
22
- Requires-Dist: urllib3 (==2.5.0)
17
+ Requires-Dist: pandas>=2.1.3; extra == 'dataframe'
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest>=7.4.0; extra == 'dev'
20
+ Requires-Dist: python-dotenv>=0.19.1; extra == 'dev'
23
21
  Description-Content-Type: text/markdown
24
22
 
25
23
  ![PyPI - Version](https://img.shields.io/pypi/v/eptr2) ![PyPI - Downloads](https://img.shields.io/pypi/dm/eptr2)
@@ -278,4 +276,3 @@ df2 = get_bpm_period(
278
276
  )
279
277
  ```
280
278
 
281
-
@@ -365,13 +365,20 @@ def get_time_min_max_price_map():
365
365
  return map_l
366
366
 
367
367
 
368
- def contract_to_floor_ceil_prices(c):
368
+ def contract_to_floor_ceil_prices(c: str | None = None):
369
369
  """
370
370
  Given a contract return the min and max prices
371
371
  """
372
372
 
373
- the_date = contract_to_datetime(c).date()
373
+ ### Min max price map is always sorted by date descending
374
374
  mm_map = get_time_min_max_price_map()
375
+
376
+ ### If contract is not given return the latest
377
+ if c is None:
378
+ return mm_map[0]
379
+
380
+ the_date = contract_to_datetime(c).date()
381
+
375
382
  for x in mm_map:
376
383
  if the_date >= datetime.strptime(x["date"], "%Y-%m-%d").date():
377
384
  return x
@@ -476,3 +483,34 @@ def get_start_end_dates_period(period: str):
476
483
  end_date = end_date.strftime("%Y-%m-%d")
477
484
 
478
485
  return start_date, end_date
486
+
487
+
488
+ ## https://stackoverflow.com/a/68321739/3608936
489
+ def contract_remaining_time_formatted(
490
+ contract: str,
491
+ day_label="D",
492
+ hour_label="H",
493
+ minute_label="m",
494
+ second_label="s",
495
+ no_time_label="-",
496
+ ) -> str:
497
+ seconds = time_to_contract_close(contract)
498
+ if seconds is not None:
499
+ seconds = int(seconds)
500
+ d = seconds // (3600 * 24)
501
+ h = seconds // 3600 % 24
502
+ m = seconds % 3600 // 60
503
+ s = seconds % 3600 % 60
504
+ if d > 0:
505
+ return "{:02d}{} {:02d}{} {:02d}{} {:02d}{}".format(
506
+ d, day_label, h, hour_label, m, minute_label, s, second_label
507
+ )
508
+ elif h > 0:
509
+ return "{:02d}{} {:02d}{} {:02d}{}".format(
510
+ h, hour_label, m, minute_label, s, second_label
511
+ )
512
+ elif m > 0:
513
+ return "{:02d}{} {:02d}{}".format(m, minute_label, s, second_label)
514
+ elif s > 0:
515
+ return "{:02d}{}".format(s, second_label)
516
+ return no_time_label
@@ -0,0 +1,40 @@
1
+ [project]
2
+ name = "eptr2"
3
+ version = "1.2.0.dev0"
4
+ description = "EPIAS Transparency Platform v2.0 Python client by Robokami Data"
5
+ authors = [
6
+ {name = "Tideseed", email = "info@tideseed.com"}
7
+ ]
8
+ license = {text = "Apache License 2.0"}
9
+ readme = "README.md"
10
+ requires-python = ">=3.9.6,!=3.9.7"
11
+ dependencies = [
12
+ "urllib3==2.5.0",
13
+ "pytz>=2024.1",
14
+ ]
15
+
16
+ [project.optional-dependencies]
17
+ dataframe = ["pandas>=2.1.3"]
18
+ allextras = [
19
+ "pandas>=2.1.3",
20
+ "streamlit>=1.48.0",
21
+ "tornado>=6.5.0",
22
+ "requests>=2.32.4"
23
+ ]
24
+ dev = [
25
+ "pytest>=7.4.0",
26
+ "python-dotenv>=0.19.1",
27
+ ]
28
+
29
+ [project.scripts]
30
+ eptr2demo = "eptr2.tutorials:run_composite_app"
31
+
32
+ [build-system]
33
+ requires = ["hatchling"]
34
+ build-backend = "hatchling.build"
35
+
36
+ [tool.uv]
37
+ dev-dependencies = [
38
+ "pytest>=7.4.0",
39
+ "python-dotenv>=0.19.1",
40
+ ]
@@ -0,0 +1,5 @@
1
+ import pytest
2
+
3
+
4
+ def common_params():
5
+ return {"start_date": "2025-02-05", "end_date": "2025-02-05"}
File without changes
@@ -0,0 +1,32 @@
1
+ ## Add test for eptr2/composite/mms.py
2
+ from eptr2.composite.consumption import get_hourly_consumption_and_forecast_data
3
+ from dotenv import load_dotenv, find_dotenv
4
+ from eptr2 import EPTR2
5
+ import pytest
6
+ from tests import common_params
7
+ import pandas as pd
8
+
9
+
10
+ @pytest.fixture
11
+ def cons_params():
12
+ d = common_params()
13
+ d = {k: v for k, v in d.items() if k in ["start_date", "end_date"]}
14
+ return d
15
+
16
+
17
+ def test_eptr2_consumption(cons_params):
18
+ is_env_ok = load_dotenv(".env")
19
+ assert is_env_ok
20
+
21
+ eptr = EPTR2()
22
+ df = get_hourly_consumption_and_forecast_data(
23
+ eptr=eptr,
24
+ start_date=cons_params["start_date"],
25
+ end_date=cons_params["end_date"],
26
+ include_contract_symbol=True,
27
+ )
28
+
29
+ assert df is not None
30
+ assert len(df) > 0
31
+ assert isinstance(df, pd.DataFrame)
32
+ assert "contract" in df
@@ -0,0 +1,37 @@
1
+ ## Add test for eptr2/composite/mms.py
2
+ from eptr2.composite.mms import get_mms_detail
3
+ from dotenv import load_dotenv, find_dotenv
4
+ from eptr2 import EPTR2
5
+ import pytest
6
+ from tests import common_params
7
+
8
+
9
+ @pytest.fixture
10
+ def mms_params():
11
+ d = common_params()
12
+ d = {k: v for k, v in d.items() if k in ["start_date", "end_date"]}
13
+ return d
14
+
15
+
16
+ def test_eptr2_composite_mms(mms_params):
17
+ is_env_ok = load_dotenv(".env")
18
+ assert is_env_ok
19
+
20
+ eptr = EPTR2()
21
+ d = get_mms_detail(
22
+ eptr=eptr,
23
+ start_date=mms_params["start_date"],
24
+ end_date=mms_params["end_date"],
25
+ verbose=True,
26
+ include_contract_symbol=True,
27
+ include_summary=True,
28
+ )
29
+ assert d is not None
30
+ assert "detail" in d
31
+ assert "summary" in d
32
+ assert d["detail"] is not None
33
+ assert d["summary"] is not None
34
+ assert len(d["detail"]) > 0
35
+ assert len(d["summary"]) > 0
36
+ assert "contract" in d["detail"]
37
+ assert "contract" in d["summary"]
@@ -0,0 +1,57 @@
1
+ ## Add test for eptr2/composite/mms.py
2
+ from eptr2.composite.price_and_cost import (
3
+ get_hourly_price_and_cost_data,
4
+ get_hourly_imbalance_data,
5
+ )
6
+ from dotenv import load_dotenv, find_dotenv
7
+ from eptr2 import EPTR2
8
+ import pytest
9
+ from tests import common_params
10
+ import pandas as pd
11
+
12
+
13
+ @pytest.fixture
14
+ def pc_params():
15
+ d = common_params()
16
+ d = {k: v for k, v in d.items() if k in ["start_date", "end_date"]}
17
+ return d
18
+
19
+
20
+ def test_eptr2_price_and_cost(pc_params):
21
+ is_env_ok = load_dotenv(".env")
22
+ assert is_env_ok
23
+
24
+ eptr = EPTR2()
25
+ df = get_hourly_price_and_cost_data(
26
+ eptr=eptr,
27
+ start_date=pc_params["start_date"],
28
+ end_date=pc_params["end_date"],
29
+ verbose=True,
30
+ include_contract_symbol=True,
31
+ include_wap=True,
32
+ add_kupst_cost=True,
33
+ )
34
+
35
+ assert df is not None
36
+ assert len(df) > 0
37
+ assert isinstance(df, pd.DataFrame)
38
+ assert "contract" in df
39
+
40
+
41
+ def test_eptr2_imbalance(pc_params):
42
+ is_env_ok = load_dotenv(".env")
43
+ assert is_env_ok
44
+
45
+ eptr = EPTR2()
46
+ df = get_hourly_imbalance_data(
47
+ eptr=eptr,
48
+ start_date=pc_params["start_date"],
49
+ end_date=pc_params["end_date"],
50
+ verbose=True,
51
+ include_contract_symbol=True,
52
+ )
53
+
54
+ assert df is not None
55
+ assert len(df) > 0
56
+ assert isinstance(df, pd.DataFrame)
57
+ assert "contract" in df
@@ -0,0 +1,34 @@
1
+ ## Add test for eptr2/composite/mms.py
2
+ from eptr2.composite.production import wrapper_hourly_production_plan_and_realized
3
+ from dotenv import load_dotenv, find_dotenv
4
+ from eptr2 import EPTR2
5
+ import pytest
6
+ from tests import common_params
7
+ import pandas as pd
8
+
9
+
10
+ @pytest.fixture
11
+ def prod_params():
12
+ d = common_params()
13
+ d = {k: v for k, v in d.items() if k in ["start_date", "end_date"]}
14
+ return d
15
+
16
+
17
+ def test_eptr2_production(prod_params):
18
+ is_env_ok = load_dotenv(".env")
19
+ assert is_env_ok
20
+
21
+ eptr = EPTR2()
22
+
23
+ df = wrapper_hourly_production_plan_and_realized(
24
+ eptr=eptr,
25
+ start_date=prod_params["start_date"],
26
+ end_date=prod_params["end_date"],
27
+ verbose=True,
28
+ include_contract_symbol=True,
29
+ )
30
+
31
+ assert df is not None
32
+ assert len(df) > 0
33
+ assert isinstance(df, pd.DataFrame)
34
+ assert "contract" in df