detquantlib 3.0.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: detquantlib
3
- Version: 3.0.0
3
+ Version: 3.0.2
4
4
  Summary: An internal library containing functions and classes that can be used across Quant models.
5
5
  Author: DET
6
6
  Requires-Python: >=3.10,<4.0
@@ -25,7 +25,9 @@ Description-Content-Type: text/markdown
25
25
 
26
26
  - [DET Quant Library](#det-quant-library)
27
27
  - [Table of contents](#table-of-contents)
28
- - [General overview](#general-overview)
28
+ - [Overview](#overview)
29
+ - [Exposed symbols](#exposed-symbols)
30
+ - [List of exposed symbols](#list-of-exposed-symbols)
29
31
  - [Configuration](#configuration)
30
32
  - [Dependencies](#dependencies)
31
33
  - [Dependency manager](#dependency-manager)
@@ -43,11 +45,45 @@ Description-Content-Type: text/markdown
43
45
 
44
46
  <!--TOC-->
45
47
 
46
- ## General overview
48
+ ## Overview
47
49
 
48
50
  The DET Quant Library is an internal library containing functions and classes that can be used
49
51
  across Quant models.
50
52
 
53
+ ## Exposed symbols
54
+
55
+ Some of the package's symbols (i.e. functions, classes, modules, etc.) are exposed via
56
+ `__init__.py` files. They can therefore be imported with a more concise notation that does not
57
+ require specifying their full path.
58
+
59
+ This section references all exposed symbols, and for each one of them, provides an exhaustive
60
+ list of the ways they can be imported.
61
+
62
+ Note: The list below is auto-generated and can be udpated with the following command in the
63
+ terminal:
64
+
65
+ ```cmd
66
+ poetry run python docs.py
67
+ ```
68
+
69
+ ### List of exposed symbols
70
+
71
+ <!-- START EXPOSED SYMBOLS AUTO-GENERATED -->
72
+
73
+ Classes:
74
+
75
+ - `DetDatabase`:
76
+ - `from detquantlib.data import DetDatabase`
77
+ - `from detquantlib.data.databases.detdatabase import DetDatabase`
78
+ - `Entsoe`:
79
+ - `from detquantlib.data import Entsoe`
80
+ - `from detquantlib.data.entsoe.entsoe import Entsoe`
81
+ - `Sftp`:
82
+ - `from detquantlib.data import Sftp`
83
+ - `from detquantlib.data.sftp.sftp import Sftp`
84
+
85
+ <!-- END EXPOSED SYMBOLS AUTO-GENERATED -->
86
+
51
87
  ## Configuration
52
88
 
53
89
  ### Dependencies
@@ -6,7 +6,9 @@
6
6
 
7
7
  - [DET Quant Library](#det-quant-library)
8
8
  - [Table of contents](#table-of-contents)
9
- - [General overview](#general-overview)
9
+ - [Overview](#overview)
10
+ - [Exposed symbols](#exposed-symbols)
11
+ - [List of exposed symbols](#list-of-exposed-symbols)
10
12
  - [Configuration](#configuration)
11
13
  - [Dependencies](#dependencies)
12
14
  - [Dependency manager](#dependency-manager)
@@ -24,11 +26,45 @@
24
26
 
25
27
  <!--TOC-->
26
28
 
27
- ## General overview
29
+ ## Overview
28
30
 
29
31
  The DET Quant Library is an internal library containing functions and classes that can be used
30
32
  across Quant models.
31
33
 
34
+ ## Exposed symbols
35
+
36
+ Some of the package's symbols (i.e. functions, classes, modules, etc.) are exposed via
37
+ `__init__.py` files. They can therefore be imported with a more concise notation that does not
38
+ require specifying their full path.
39
+
40
+ This section references all exposed symbols, and for each one of them, provides an exhaustive
41
+ list of the ways they can be imported.
42
+
43
+ Note: The list below is auto-generated and can be udpated with the following command in the
44
+ terminal:
45
+
46
+ ```cmd
47
+ poetry run python docs.py
48
+ ```
49
+
50
+ ### List of exposed symbols
51
+
52
+ <!-- START EXPOSED SYMBOLS AUTO-GENERATED -->
53
+
54
+ Classes:
55
+
56
+ - `DetDatabase`:
57
+ - `from detquantlib.data import DetDatabase`
58
+ - `from detquantlib.data.databases.detdatabase import DetDatabase`
59
+ - `Entsoe`:
60
+ - `from detquantlib.data import Entsoe`
61
+ - `from detquantlib.data.entsoe.entsoe import Entsoe`
62
+ - `Sftp`:
63
+ - `from detquantlib.data import Sftp`
64
+ - `from detquantlib.data.sftp.sftp import Sftp`
65
+
66
+ <!-- END EXPOSED SYMBOLS AUTO-GENERATED -->
67
+
32
68
  ## Configuration
33
69
 
34
70
  ### Dependencies
@@ -0,0 +1,5 @@
1
+ from .databases.detdatabase import DetDatabase
2
+ from .entsoe.entsoe import Entsoe
3
+ from .sftp.sftp import Sftp
4
+
5
+ __all__ = ["DetDatabase", "Entsoe", "Sftp"]
@@ -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 of the
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
- quarter = pd.Timestamp(trading_date).quarter
53
- year_start_date = datetime(trading_date.year, 1, 1)
54
- trading_quarter_start_date = year_start_date + relativedelta(months=((quarter - 1) * 3))
45
+ trading_quarter_start_date = convert_maturity_to_delivery_start_date(
46
+ trading_date=trading_date, maturity=0, product="quarter"
47
+ )
55
48
 
56
- quarter = pd.Timestamp(delivery_start_date).quarter
57
- year_start_date = datetime(delivery_start_date.year, 1, 1)
58
- delivery_quarter_start_date = year_start_date + relativedelta(months=((quarter - 1) * 3))
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,
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "detquantlib"
3
- version = "3.0.0"
3
+ version = "3.0.2"
4
4
  description = "An internal library containing functions and classes that can be used across Quant models."
5
5
  authors = ["DET"]
6
6
  readme = "README.md"
File without changes