bw-essentials-core 0.0.6__tar.gz → 0.0.8__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.

Files changed (30) hide show
  1. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/PKG-INFO +1 -1
  2. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/services/master_data.py +46 -2
  3. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials_core.egg-info/PKG-INFO +1 -1
  4. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/setup.py +1 -1
  5. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/README.md +0 -0
  6. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/__init__.py +0 -0
  7. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/constants/__init__.py +0 -0
  8. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/constants/services.py +0 -0
  9. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/data_loch/__init__.py +0 -0
  10. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/data_loch/data_loch.py +0 -0
  11. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/email_client/__init__.py +0 -0
  12. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/email_client/email_client.py +0 -0
  13. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/notifications/__init__.py +0 -0
  14. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/notifications/teams_notification_schemas.py +0 -0
  15. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/notifications/teams_notifications.py +0 -0
  16. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/s3_utils/__init__.py +0 -0
  17. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/s3_utils/s3_utils.py +0 -0
  18. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/services/__init__.py +0 -0
  19. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/services/api_client.py +1 -1
  20. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/services/broker.py +0 -0
  21. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/services/market_pricer.py +0 -0
  22. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/services/model_portfolio_reporting.py +0 -0
  23. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/services/trade_placement.py +0 -0
  24. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/services/user_portfolio.py +0 -0
  25. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials/services/user_portfolio_reporting.py +0 -0
  26. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials_core.egg-info/SOURCES.txt +0 -0
  27. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials_core.egg-info/dependency_links.txt +0 -0
  28. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials_core.egg-info/requires.txt +0 -0
  29. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/bw_essentials_core.egg-info/top_level.txt +0 -0
  30. {bw_essentials_core-0.0.6 → bw_essentials_core-0.0.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-essentials-core
3
- Version: 0.0.6
3
+ Version: 0.0.8
4
4
  Summary: Reusable utilities for S3, email, Data Loch, Microsoft Teams Notifications and more.
5
5
  Author: InvestorAI
6
6
  Author-email: support+tech@investorai.in
@@ -44,7 +44,9 @@ class MasterData(ApiClient):
44
44
  "constant": "constants",
45
45
  "broker_config": "broker/config/keys",
46
46
  "broker_details": "securities/{}/details",
47
- "isin_details": "company/details/isin"
47
+ "isin_details": "company/details/isin",
48
+ "shorten_url": "shorten-url",
49
+ "broker_partner_mapping_details": "partner/{}/broker/{}/"
48
50
  }
49
51
 
50
52
  def get_security_details(self, securities: List[str]) -> Optional[Dict[str, Any]]:
@@ -107,7 +109,8 @@ class MasterData(ApiClient):
107
109
  Returns:
108
110
  Optional[Dict[str, Any]]: Configuration key data or None.
109
111
  """
110
- logger.info(f"Fetching broker config keys for broker={broker}, product_type={product_type}, category={category}")
112
+ logger.info(
113
+ f"Fetching broker config keys for broker={broker}, product_type={product_type}, category={category}")
111
114
  params = {k: v for k, v in {'broker': broker, 'product': product_type, 'category': category}.items() if v}
112
115
  response = self._get(url=self.base_url,
113
116
  endpoint=self.urls["broker_config"],
@@ -255,3 +258,44 @@ class MasterData(ApiClient):
255
258
 
256
259
  logger.info("Market is closed based on hours and/or holiday check.")
257
260
  return False
261
+
262
+ def shorten_url(self, long_url: str) -> Dict[str, Any]:
263
+ """Shorten a long URL using the configured URL-shortening service.
264
+
265
+ Args:
266
+ long_url (str): The long URL to shorten.
267
+
268
+ Returns:
269
+ dict: A dictionary containing the shortened URL or any error data.
270
+
271
+ Logs:
272
+ Information about the long_url being shortened.
273
+
274
+ """
275
+ logger.info(f"Shortening URL: {long_url}")
276
+ response = self._post(url=self.base_url,
277
+ endpoint=self.urls["shorten_url"],
278
+ data={"long_url": long_url})
279
+ logger.info(f"Shortening URL {response =}")
280
+ return response.get("data", {})
281
+
282
+ def get_or_create_broker_partner_mapping(self, broker_partner: str, broker: str) -> Dict[str, Any]:
283
+ """
284
+ Fetches or creates a broker-partner mapping from master data constants table.
285
+
286
+ This method sends a GET request to retrieve the mapping details for a given
287
+ broker and broker partner. If the mapping does not exist, the API
288
+ is expected to create it automatically (based on implementation).
289
+
290
+ Parameters:
291
+ - broker_partner (str): The identifier of the broker partner.
292
+ - broker (str): The identifier of the broker.
293
+
294
+ Returns:
295
+ - Dict[str, Any]: The mapping data returned from the service, or an empty
296
+ dictionary if no data is available.
297
+ """
298
+ logger.info(f"In - get_or_create_broker_partner_mapping | broker_partner={broker_partner} broker={broker}")
299
+ response = self._get(url=self.base_url, endpoint=self.urls["broker_partner_mapping_details"].format(broker_partner, broker))
300
+ logger.info(f"Broker partner mapping {response =}")
301
+ return response.get('data', {})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-essentials-core
3
- Version: 0.0.6
3
+ Version: 0.0.8
4
4
  Summary: Reusable utilities for S3, email, Data Loch, Microsoft Teams Notifications and more.
5
5
  Author: InvestorAI
6
6
  Author-email: support+tech@investorai.in
@@ -10,7 +10,7 @@ from setuptools import setup, find_packages
10
10
 
11
11
  setup(
12
12
  name="bw-essentials-core",
13
- version="0.0.6",
13
+ version="0.0.8",
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.",
@@ -158,9 +158,9 @@ class ApiClient:
158
158
  try:
159
159
  response = requests.request(method, formatted_url, headers=self.headers, **kwargs)
160
160
  elapsed_time_ms = (time.time() - start) * 1000
161
- response.raise_for_status()
162
161
  json_data = response.json()
163
162
  self._log_response(method, formatted_url, response.status_code, elapsed_time_ms, json_data)
163
+ response.raise_for_status()
164
164
  return json_data
165
165
  except Exception as exc:
166
166
  elapsed_time_ms = (time.time() - start) * 1000