detquantlib 5.2.0__tar.gz → 5.3.1__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 (33) hide show
  1. {detquantlib-5.2.0 → detquantlib-5.3.1}/PKG-INFO +2 -1
  2. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/dates/dates.py +37 -2
  3. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/utils/utils.py +4 -3
  4. {detquantlib-5.2.0 → detquantlib-5.3.1}/pyproject.toml +1 -1
  5. {detquantlib-5.2.0 → detquantlib-5.3.1}/LICENSE.txt +0 -0
  6. {detquantlib-5.2.0 → detquantlib-5.3.1}/README.md +0 -0
  7. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/__init__.py +0 -0
  8. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/assets/__init__.py +0 -0
  9. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/assets/battery.py +0 -0
  10. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/assets/wind_turbine.py +0 -0
  11. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/converters/__init__.py +0 -0
  12. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/converters/definitions.py +0 -0
  13. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/converters/energy.py +0 -0
  14. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/converters/helpers.py +0 -0
  15. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/converters/price.py +0 -0
  16. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/data/__init__.py +0 -0
  17. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/data/databases/detdatabase.py +0 -0
  18. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/data/databases/helpers.py +0 -0
  19. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/data/entsoe/entsoe.py +0 -0
  20. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/data/sftp/sftp.py +0 -0
  21. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/dates/__init__.py +0 -0
  22. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/figures/__init__.py +0 -0
  23. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/figures/plotly_figures.py +0 -0
  24. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/forecasting/__init__.py +0 -0
  25. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/forecasting/forecasting.py +0 -0
  26. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/outputs/__init__.py +0 -0
  27. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/outputs/outputs_interface.py +0 -0
  28. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/stats/__init__.py +0 -0
  29. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/stats/data_analysis.py +0 -0
  30. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/tradable_products/__init__.py +0 -0
  31. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/tradable_products/tradable_products.py +0 -0
  32. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/utils/__init__.py +0 -0
  33. {detquantlib-5.2.0 → detquantlib-5.3.1}/detquantlib/utils/logging.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: detquantlib
3
- Version: 5.2.0
3
+ Version: 5.3.1
4
4
  Summary: An internal library containing functions and classes that can be used across Quant models.
5
5
  License-File: LICENSE.txt
6
6
  Author: Dynamic Energy Trading
@@ -11,6 +11,7 @@ Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
13
  Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Programming Language :: Python :: 3.15
14
15
  Requires-Dist: colorlog (>=6.10.1,<7.0.0)
15
16
  Requires-Dist: numpy (>=2.2.6,<3.0.0)
16
17
  Requires-Dist: pandas (>=2.3.3,<3.0.0)
@@ -3,10 +3,45 @@ from datetime import datetime, timezone
3
3
  from typing import Literal
4
4
 
5
5
  # Third-party packages
6
- from dateutil.relativedelta import *
6
+ import pandas as pd
7
+ from dateutil.relativedelta import relativedelta
7
8
 
8
9
  # Specify functions to expose
9
- __all__ = ["count_nr_hours", "calc_months_diff", "datetime_to_month_code"]
10
+ __all__ = ["ts_ceil", "ts_floor", "count_nr_hours", "calc_months_diff", "datetime_to_month_code"]
11
+
12
+
13
+ def ts_ceil(ts: pd.Timestamp, freq: str) -> pd.Timestamp:
14
+ """
15
+ Short wrapper function around the pd.Timestamp object.ceil() method that also supports
16
+ October DST timestamps (i.e. between 02:00:00+0200 and 03:00:00+0100), because the built-in
17
+ method raises an error in those cases.
18
+
19
+ Args:
20
+ ts: Timestamp
21
+ freq: Frequency
22
+
23
+ Returns:
24
+ Ceiled timestamp
25
+ """
26
+ local_tz = ts.tz
27
+ return ts.tz_convert("UTC").ceil(freq).tz_convert(local_tz)
28
+
29
+
30
+ def ts_floor(ts: pd.Timestamp, freq: str) -> pd.Timestamp:
31
+ """
32
+ Short wrapper function around the pd.Timestamp object.floor() method that also supports
33
+ October DST timestamps (i.e. between 02:00:00+0200 and 03:00:00+0100), because the built-in
34
+ method raises an error in those cases.
35
+
36
+ Args:
37
+ ts: Timestamp
38
+ freq: Frequency
39
+
40
+ Returns:
41
+ Floored timestamp
42
+ """
43
+ local_tz = ts.tz
44
+ return ts.tz_convert("UTC").floor(freq).tz_convert(local_tz)
10
45
 
11
46
 
12
47
  def count_nr_hours(start_date: datetime, end_date: datetime) -> float:
@@ -40,7 +40,8 @@ def divide_with_nan(
40
40
  Returns:
41
41
  Quotient array
42
42
  """
43
- quotient = np.nan_to_num(
44
- x=np.divide(numerator, denominator), nan=nan, posinf=posinf, neginf=neginf
45
- )
43
+ with np.errstate(divide="ignore", invalid="ignore"):
44
+ quotient = np.nan_to_num(
45
+ x=np.divide(numerator, denominator), nan=nan, posinf=posinf, neginf=neginf
46
+ )
46
47
  return quotient
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "detquantlib"
3
- version = "5.2.0"
3
+ version = "5.3.1"
4
4
  description = "An internal library containing functions and classes that can be used across Quant models."
5
5
  authors = ["Dynamic Energy Trading"]
6
6
  readme = "README.md"
File without changes
File without changes