bw-essentials-core 0.1.17__tar.gz → 0.1.19__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.
Potentially problematic release.
This version of bw-essentials-core might be problematic. Click here for more details.
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/PKG-INFO +1 -1
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/model_portfolio_reporting.py +30 -1
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/notification.py +19 -15
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials_core.egg-info/PKG-INFO +1 -1
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/setup.py +1 -1
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/README.md +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/__init__.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/constants/__init__.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/constants/services.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/data_loch/__init__.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/data_loch/data_loch.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/email_client/__init__.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/email_client/email_client.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/notifications/__init__.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/notifications/teams_notification_schemas.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/notifications/teams_notifications.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/s3_utils/__init__.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/s3_utils/s3_utils.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/__init__.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/api_client.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/broker.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/job_scheduler.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/market_pricer.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/master_data.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/payment.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/portfolio_catalogue.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/portfolio_content.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/trade_placement.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/user_app.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/user_portfolio.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/user_portfolio_reporting.py +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials_core.egg-info/SOURCES.txt +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials_core.egg-info/dependency_links.txt +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials_core.egg-info/requires.txt +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials_core.egg-info/top_level.txt +0 -0
- {bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/setup.cfg +0 -0
|
@@ -33,7 +33,8 @@ class ModelPortfolioReporting(ApiClient):
|
|
|
33
33
|
self.object = None
|
|
34
34
|
self.urls = {
|
|
35
35
|
"portfolio": "portfolio",
|
|
36
|
-
"portfolio_performance": "portfolio/%s/performance"
|
|
36
|
+
"portfolio_performance": "portfolio/%s/performance",
|
|
37
|
+
"index_performance": "index/%s/performance/"
|
|
37
38
|
}
|
|
38
39
|
self.name = Services.MODEL_PORTFOLIO.value
|
|
39
40
|
self.base_url = self.get_base_url(Services.MODEL_PORTFOLIO.value)
|
|
@@ -79,3 +80,31 @@ class ModelPortfolioReporting(ApiClient):
|
|
|
79
80
|
)
|
|
80
81
|
logger.info(f"Received response from get_portfolio_performance_by_dates: {performance}")
|
|
81
82
|
return performance.get("data")
|
|
83
|
+
|
|
84
|
+
def get_index_performance_by_dates(
|
|
85
|
+
self,
|
|
86
|
+
index: str,
|
|
87
|
+
start_date: str,
|
|
88
|
+
end_date: str
|
|
89
|
+
) -> Optional[Dict[str, Any]]:
|
|
90
|
+
"""
|
|
91
|
+
Fetch Index performance for a given date range.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
index (str): The index identifier.
|
|
95
|
+
start_date (str): The start date for performance metrics (format: YYYY-MM-DD).
|
|
96
|
+
end_date (str): The end date for performance metrics (format: YYYY-MM-DD).
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
dict | None: The performance data within the date range.
|
|
100
|
+
"""
|
|
101
|
+
logger.info(f"In - get_index_performance_by_dates with index={index}, start_date={start_date}, end_date={end_date}")
|
|
102
|
+
endpoint = self.urls['index_performance'] % index
|
|
103
|
+
params = {"start_date": start_date, "end_date": end_date}
|
|
104
|
+
performance = self._get(
|
|
105
|
+
url=self.base_url,
|
|
106
|
+
endpoint=endpoint,
|
|
107
|
+
params=params
|
|
108
|
+
)
|
|
109
|
+
logger.info(f"Received response from get_index_performance_by_dates: {performance}")
|
|
110
|
+
return performance.get("data")
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/notification.py
RENAMED
|
@@ -32,7 +32,7 @@ class NotificationService(ApiClient):
|
|
|
32
32
|
"email": "email"
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
def _whatsapp(self, title, template, platform, params, to, user_id) ->
|
|
35
|
+
def _whatsapp(self, title, template, platform, params, to, user_id) -> dict:
|
|
36
36
|
"""
|
|
37
37
|
Sends a WhatsApp notification.
|
|
38
38
|
|
|
@@ -46,7 +46,7 @@ class NotificationService(ApiClient):
|
|
|
46
46
|
- params: Parameters for the notification message.
|
|
47
47
|
|
|
48
48
|
Returns:
|
|
49
|
-
|
|
49
|
+
returns the response data from the notification service.
|
|
50
50
|
"""
|
|
51
51
|
logger.info(f"In - whatsapp {user_id =}, {to =}, "
|
|
52
52
|
f"{title =}, {template =}, {platform =}, {params =}")
|
|
@@ -66,8 +66,9 @@ class NotificationService(ApiClient):
|
|
|
66
66
|
self.set_headers(headers)
|
|
67
67
|
resp_data = self._post(url=self.base_url, endpoint=self.urls.get('whatsapp'), data=payload)
|
|
68
68
|
logger.info(f"Whatsapp response {resp_data =}")
|
|
69
|
+
return resp_data
|
|
69
70
|
|
|
70
|
-
def send_whatsapp(self, template, title, params, to, user_id) ->
|
|
71
|
+
def send_whatsapp(self, template, title, params, to, user_id) -> dict:
|
|
71
72
|
"""
|
|
72
73
|
|
|
73
74
|
Args:
|
|
@@ -78,17 +79,18 @@ class NotificationService(ApiClient):
|
|
|
78
79
|
user_id (str): The ID of the user receiving the notification.
|
|
79
80
|
|
|
80
81
|
Returns:
|
|
81
|
-
|
|
82
|
+
Returns the response of calling function
|
|
82
83
|
"""
|
|
83
84
|
logger.info(f"In - send_whatsapp_notification {user_id =} {title = } {params = } {to = }")
|
|
84
|
-
self._whatsapp(title=title,
|
|
85
|
+
response = self._whatsapp(title=title,
|
|
85
86
|
template=template,
|
|
86
87
|
platform=self._get_env_var(NotificationService.PLATFORM),
|
|
87
88
|
params=params,
|
|
88
89
|
to=to,
|
|
89
90
|
user_id=user_id)
|
|
91
|
+
return response
|
|
90
92
|
|
|
91
|
-
def _email(self, title: str, content: str, platform: str, to: str, user_id: str) ->
|
|
93
|
+
def _email(self, title: str, content: str, platform: str, to: str, user_id: str) -> dict:
|
|
92
94
|
"""
|
|
93
95
|
Sends an email notification using the internal notification service.
|
|
94
96
|
|
|
@@ -100,7 +102,7 @@ class NotificationService(ApiClient):
|
|
|
100
102
|
user_id (str): The ID of the user for tracking or logging purposes.
|
|
101
103
|
|
|
102
104
|
Returns:
|
|
103
|
-
|
|
105
|
+
returns the response data from the notification service.
|
|
104
106
|
|
|
105
107
|
"""
|
|
106
108
|
logger.info(f"In - email {user_id =}, {to =}, {title =}, {platform =}, {content =}")
|
|
@@ -119,8 +121,9 @@ class NotificationService(ApiClient):
|
|
|
119
121
|
self.set_headers(headers)
|
|
120
122
|
resp_data = self._post(url=self.base_url, endpoint=self.urls.get('email'), json=payload)
|
|
121
123
|
logger.info(f"Email response {resp_data =}")
|
|
124
|
+
return resp_data
|
|
122
125
|
|
|
123
|
-
def send_email(self, title: str, content: str, to: str, user_id: str) ->
|
|
126
|
+
def send_email(self, title: str, content: str, to: str, user_id: str) -> dict:
|
|
124
127
|
"""
|
|
125
128
|
Sends an email notification to the specified recipient.
|
|
126
129
|
|
|
@@ -131,13 +134,14 @@ class NotificationService(ApiClient):
|
|
|
131
134
|
user_id (str): The ID of the user associated with the notification.
|
|
132
135
|
|
|
133
136
|
Returns:
|
|
134
|
-
|
|
137
|
+
return the response of calling function
|
|
135
138
|
"""
|
|
136
139
|
logger.info(f"In - send_email {user_id =}, {title =}, {to =}")
|
|
137
|
-
self._email(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
response = self._email(
|
|
141
|
+
title=title,
|
|
142
|
+
content=content,
|
|
143
|
+
platform=self._get_env_var(NotificationService.PLATFORM),
|
|
144
|
+
to=to,
|
|
145
|
+
user_id=user_id
|
|
143
146
|
)
|
|
147
|
+
return response
|
|
@@ -10,7 +10,7 @@ from setuptools import setup, find_packages
|
|
|
10
10
|
|
|
11
11
|
setup(
|
|
12
12
|
name="bw-essentials-core",
|
|
13
|
-
version="0.1.
|
|
13
|
+
version="0.1.19",
|
|
14
14
|
author="InvestorAI",
|
|
15
15
|
author_email="support+tech@investorai.in",
|
|
16
16
|
description="Reusable utilities for S3, email, Data Loch, Microsoft Teams Notifications and more.",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/data_loch/data_loch.py
RENAMED
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/email_client/__init__.py
RENAMED
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/email_client/email_client.py
RENAMED
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/notifications/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/api_client.py
RENAMED
|
File without changes
|
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/job_scheduler.py
RENAMED
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/market_pricer.py
RENAMED
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/master_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/portfolio_content.py
RENAMED
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/trade_placement.py
RENAMED
|
File without changes
|
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials/services/user_portfolio.py
RENAMED
|
File without changes
|
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials_core.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials_core.egg-info/requires.txt
RENAMED
|
File without changes
|
{bw_essentials_core-0.1.17 → bw_essentials_core-0.1.19}/bw_essentials_core.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|