detquantlib 3.0.1__tar.gz → 3.0.2__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.
- {detquantlib-3.0.1 → detquantlib-3.0.2}/PKG-INFO +1 -1
- {detquantlib-3.0.1 → detquantlib-3.0.2}/detquantlib/dates/dates.py +3 -3
- {detquantlib-3.0.1 → detquantlib-3.0.2}/detquantlib/tradable_products/tradable_products.py +6 -13
- {detquantlib-3.0.1 → detquantlib-3.0.2}/pyproject.toml +1 -1
- {detquantlib-3.0.1 → detquantlib-3.0.2}/LICENSE.txt +0 -0
- {detquantlib-3.0.1 → detquantlib-3.0.2}/README.md +0 -0
- {detquantlib-3.0.1 → detquantlib-3.0.2}/detquantlib/__init__.py +0 -0
- {detquantlib-3.0.1 → detquantlib-3.0.2}/detquantlib/data/__init__.py +0 -0
- {detquantlib-3.0.1 → detquantlib-3.0.2}/detquantlib/data/databases/detdatabase.py +0 -0
- {detquantlib-3.0.1 → detquantlib-3.0.2}/detquantlib/data/entsoe/entsoe.py +0 -0
- {detquantlib-3.0.1 → detquantlib-3.0.2}/detquantlib/data/sftp/sftp.py +0 -0
- {detquantlib-3.0.1 → detquantlib-3.0.2}/detquantlib/figures/plotly_figures.py +0 -0
- {detquantlib-3.0.1 → detquantlib-3.0.2}/detquantlib/stats/data_analysis.py +0 -0
- {detquantlib-3.0.1 → detquantlib-3.0.2}/detquantlib/utils/utils.py +0 -0
|
@@ -78,8 +78,8 @@ def calc_months_diff(
|
|
|
78
78
|
date and end date, irrespective of the day. For example, suppose that start date
|
|
79
79
|
is 15-Jan-2025 and end date is 3-Mar-2025. Then, the month difference between
|
|
80
80
|
Jan-2025 and Mar-2025 is 2.
|
|
81
|
-
- diff_method="time": Counts the month difference, accounting the day and time
|
|
82
|
-
start and end dates. For example:
|
|
81
|
+
- diff_method="time": Counts the month difference, accounting for the day and time
|
|
82
|
+
of the start and end dates. For example:
|
|
83
83
|
- Suppose that start date is 15-Jan-2025 and end date is 3-Mar-2025. Then:
|
|
84
84
|
- start date + 1 months = 15-Feb-2025
|
|
85
85
|
- start date + 2 months = 15-Mar-2025
|
|
@@ -103,7 +103,7 @@ def calc_months_diff(
|
|
|
103
103
|
ValueError: Raises an error when the input argument 'diff_method' is invalid
|
|
104
104
|
"""
|
|
105
105
|
# Input validation
|
|
106
|
-
if end_date < start_date:
|
|
106
|
+
if end_date < start_date and diff_method != "month":
|
|
107
107
|
raise ValueError("End date cannot be smaller than start date.")
|
|
108
108
|
|
|
109
109
|
# Calculate month difference
|
|
@@ -34,13 +34,6 @@ def convert_delivery_start_date_to_maturity(
|
|
|
34
34
|
# Make input product string lower case only
|
|
35
35
|
product = product.lower()
|
|
36
36
|
|
|
37
|
-
# Validate input dates
|
|
38
|
-
if delivery_start_date < trading_date:
|
|
39
|
-
raise ValueError(
|
|
40
|
-
"Input argument 'delivery_start_date' cannot be smaller than input argument "
|
|
41
|
-
"'trading_date'."
|
|
42
|
-
)
|
|
43
|
-
|
|
44
37
|
if product == "month":
|
|
45
38
|
maturity = calc_months_diff(
|
|
46
39
|
start_date=trading_date,
|
|
@@ -49,13 +42,13 @@ def convert_delivery_start_date_to_maturity(
|
|
|
49
42
|
)
|
|
50
43
|
|
|
51
44
|
elif product == "quarter":
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
trading_quarter_start_date = convert_maturity_to_delivery_start_date(
|
|
46
|
+
trading_date=trading_date, maturity=0, product="quarter"
|
|
47
|
+
)
|
|
55
48
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
delivery_quarter_start_date = convert_maturity_to_delivery_start_date(
|
|
50
|
+
trading_date=delivery_start_date, maturity=0, product="quarter"
|
|
51
|
+
)
|
|
59
52
|
|
|
60
53
|
months_diff = calc_months_diff(
|
|
61
54
|
start_date=trading_quarter_start_date,
|
|
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
|