bw-essentials-core 0.2.2__tar.gz → 0.2.4__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 (130) hide show
  1. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/PKG-INFO +1 -1
  2. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/constants/services.py +1 -0
  3. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/api_client.py +29 -1
  4. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/payment.py +0 -13
  5. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/portfolio_product.py +68 -0
  6. bw_essentials_core-0.2.4/bw_essentials/services/reporting.py +2844 -0
  7. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials_core.egg-info/PKG-INFO +1 -1
  8. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials_core.egg-info/SOURCES.txt +2 -0
  9. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/setup.py +1 -1
  10. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_portfolio_product.py +70 -0
  11. bw_essentials_core-0.2.4/tests/test_reporting.py +1078 -0
  12. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/README.md +0 -0
  13. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/EventNotification/EventBridgePublisher.py +0 -0
  14. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/EventNotification/NotificationType.py +0 -0
  15. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/EventNotification/__init__.py +0 -0
  16. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/EventNotification/models/__init__.py +0 -0
  17. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/EventNotification/models/notification_type.py +0 -0
  18. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/__init__.py +0 -0
  19. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/constants/__init__.py +0 -0
  20. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/data_loch/__init__.py +0 -0
  21. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/data_loch/data_loch.py +0 -0
  22. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/email_client/__init__.py +0 -0
  23. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/email_client/email_client.py +0 -0
  24. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/logging/__init__.py +0 -0
  25. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/logging/_config.py +0 -0
  26. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/logging/_context.py +0 -0
  27. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/logging/_correlation.py +0 -0
  28. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/logging/_processors.py +0 -0
  29. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/logging/_redaction.py +0 -0
  30. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/middlewares/__init__.py +0 -0
  31. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/middlewares/fastapi/__init__.py +0 -0
  32. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/middlewares/fastapi/exception.py +0 -0
  33. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/middlewares/fastapi/request.py +0 -0
  34. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/notifications/__init__.py +0 -0
  35. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/notifications/fcm/__init__.py +0 -0
  36. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/notifications/fcm/client.py +0 -0
  37. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/notifications/fcm/exceptions.py +0 -0
  38. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/notifications/fcm/payload_builder.py +0 -0
  39. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/notifications/fcm/response.py +0 -0
  40. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/notifications/fcm/settings.py +0 -0
  41. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/notifications/teams_notification_schemas.py +0 -0
  42. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/notifications/teams_notifications.py +0 -0
  43. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/__init__.py +0 -0
  44. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_body.py +0 -0
  45. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/__init__.py +0 -0
  46. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/celery.py +0 -0
  47. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/client_hooks.py +0 -0
  48. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/config.py +0 -0
  49. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/deps.py +0 -0
  50. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/exceptions.py +0 -0
  51. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/lifecycle.py +0 -0
  52. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/log_processor.py +0 -0
  53. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/logging_bridge.py +0 -0
  54. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/metric_export.py +0 -0
  55. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/propagation.py +0 -0
  56. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/provider.py +0 -0
  57. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/span_export.py +0 -0
  58. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/span_policies.py +0 -0
  59. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/_core/state.py +0 -0
  60. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/boundaries.py +0 -0
  61. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/context.py +0 -0
  62. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/django/__init__.py +0 -0
  63. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/django/errors.py +0 -0
  64. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/django/middleware.py +0 -0
  65. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/django/otel.py +0 -0
  66. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/fastapi/__init__.py +0 -0
  67. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/fastapi/body.py +0 -0
  68. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/fastapi/otel.py +0 -0
  69. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/gunicorn.py +0 -0
  70. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/logging.py +0 -0
  71. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/observability/services.py +0 -0
  72. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/py.typed +0 -0
  73. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/redaction/__init__.py +0 -0
  74. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/redaction/cap.py +0 -0
  75. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/redaction/engine.py +0 -0
  76. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/redaction/keys.py +0 -0
  77. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/redaction/lexer.py +0 -0
  78. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/redaction/patterns.py +0 -0
  79. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/s3_utils/__init__.py +0 -0
  80. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/s3_utils/s3_utils.py +0 -0
  81. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/__init__.py +0 -0
  82. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/broker.py +0 -0
  83. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/compliance.py +0 -0
  84. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/job_scheduler.py +0 -0
  85. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/market_pricer.py +0 -0
  86. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/master_data.py +0 -0
  87. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/model_portfolio_reporting.py +0 -0
  88. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/notification.py +0 -0
  89. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/notification_finn.py +0 -0
  90. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/portfolio_business.py +0 -0
  91. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/portfolio_catalogue.py +0 -0
  92. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/portfolio_content.py +0 -0
  93. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/rebalancing_business.py +0 -0
  94. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/trade_placement.py +0 -0
  95. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/user_app.py +0 -0
  96. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/user_portfolio.py +0 -0
  97. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/user_portfolio_business.py +0 -0
  98. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/user_portfolio_reporting.py +0 -0
  99. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/services/user_referrals.py +0 -0
  100. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/tools/__init__.py +0 -0
  101. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/tools/manifest_lint.py +0 -0
  102. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials/tools/secret_grep.py +0 -0
  103. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials_core.egg-info/dependency_links.txt +0 -0
  104. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials_core.egg-info/entry_points.txt +0 -0
  105. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials_core.egg-info/requires.txt +0 -0
  106. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/bw_essentials_core.egg-info/top_level.txt +0 -0
  107. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/setup.cfg +0 -0
  108. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_api_client_errors.py +0 -0
  109. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_api_client_logging.py +0 -0
  110. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_api_client_retries.py +0 -0
  111. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_broker_reconciliation.py +0 -0
  112. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_client_body_logging.py +0 -0
  113. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_compliance.py +0 -0
  114. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_django_observability.py +0 -0
  115. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_event_bridge_publisher.py +0 -0
  116. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_fcm_platform_config.py +0 -0
  117. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_master_data_trading_calendar.py +0 -0
  118. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_notification_finn.py +0 -0
  119. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_notification_service.py +0 -0
  120. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_observability_import.py +0 -0
  121. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_payment.py +0 -0
  122. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_pii_response_log_redaction.py +0 -0
  123. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_portfolio_business.py +0 -0
  124. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_portfolio_business_service_contracts.py +0 -0
  125. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_portfolio_catalogue.py +0 -0
  126. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_rebalancing_business.py +0 -0
  127. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_user_app.py +0 -0
  128. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_user_portfolio.py +0 -0
  129. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_user_portfolio_business.py +0 -0
  130. {bw_essentials_core-0.2.2 → bw_essentials_core-0.2.4}/tests/test_user_portfolio_reporting.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-essentials-core
3
- Version: 0.2.2
3
+ Version: 0.2.4
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
@@ -18,6 +18,7 @@ class Services(Enum):
18
18
  NOTIFICATION_FINN = 'Notification_Finn'
19
19
  USER_REPORTING = 'User_Reporting'
20
20
  PAYMENT = 'Payment'
21
+ REPORTING = 'Reporting'
21
22
  MODEL_PORTFOLIO = "Model_Portfolio"
22
23
  PROMETHEUS_USER_APP = "Prometheus_User_App"
23
24
  PORTFOLIO_CATALOGUE = "Portfolio_Catalogue"
@@ -19,7 +19,7 @@ import threading
19
19
  import time
20
20
  from importlib.util import module_from_spec, spec_from_file_location
21
21
  from typing import Any, Dict, Optional
22
- from urllib.parse import urlsplit
22
+ from urllib.parse import quote, urlsplit
23
23
 
24
24
  import httpx
25
25
  import requests
@@ -261,6 +261,34 @@ class ApiClient:
261
261
  path = parsed.path or "/"
262
262
  return path
263
263
 
264
+ @staticmethod
265
+ def _path_segment(value: Any) -> str:
266
+ """Validate and percent-encode one path segment.
267
+
268
+ Args:
269
+ value: String or integer identifier to place in a URL path.
270
+
271
+ Returns:
272
+ The identifier converted to text and percent-encoded as one path
273
+ segment.
274
+
275
+ Raises:
276
+ TypeError: If ``value`` is a boolean or is not a string/integer.
277
+ ValueError: If the text is blank or contains a slash.
278
+
279
+ Encoding the complete value prevents reserved characters from
280
+ changing route structure while retaining the shared client's integer
281
+ compatibility for services that use numeric identifiers.
282
+ """
283
+ if isinstance(value, bool) or not isinstance(value, (str, int)):
284
+ raise TypeError("path segment must be a string or integer")
285
+ text = str(value)
286
+ if not text.strip():
287
+ raise ValueError("path segment must not be blank")
288
+ if "/" in text:
289
+ raise ValueError("path segment must not contain a slash")
290
+ return quote(text, safe="")
291
+
264
292
  def _build_http_error_message(self, response: requests.Response | None) -> str:
265
293
  """Compose a generic HTTP error message omitting endpoint details."""
266
294
  if response is None:
@@ -2,7 +2,6 @@
2
2
 
3
3
  import logging
4
4
  from typing import Any, Dict, Mapping, Optional
5
- from urllib.parse import quote
6
5
 
7
6
  from bw_essentials.services.api_client import ApiClient
8
7
  from bw_essentials.constants.services import Services
@@ -90,18 +89,6 @@ class Payment(ApiClient):
90
89
  """
91
90
  return {key: value for key, value in filters.items() if value is not None}
92
91
 
93
- @staticmethod
94
- def _path_segment(value: Any) -> str:
95
- """Validate and percent-encode one string or integer path segment."""
96
- if isinstance(value, bool) or not isinstance(value, (str, int)):
97
- raise TypeError("path segment must be a string or integer")
98
- text = str(value)
99
- if not text.strip():
100
- raise ValueError("path segment must not be blank")
101
- if "/" in text:
102
- raise ValueError("path segment must not contain a slash")
103
- return quote(text, safe="")
104
-
105
92
  # --- subscriptions -------------------------------------------------------------------
106
93
 
107
94
  def get_subscriptions(self, user_id: Optional[str] = None, *,
@@ -434,6 +434,30 @@ class PortfolioProduct(ApiClient):
434
434
  "put", self.urls["rebalance"], json={"rebalance_id": rebalance_id}
435
435
  )
436
436
 
437
+ def delete_rebalance(self, rebalance_id: str | int) -> Any:
438
+ """DELETE ``catalogue/rebalance/<rebalance_id>`` and confirm deletion.
439
+
440
+ The server atomically hard-deletes the record's constituents and the
441
+ record itself. It returns 404 when the record is missing and 409 when
442
+ the record is older than the server's undo window, which defaults to
443
+ 600 seconds.
444
+
445
+ Args:
446
+ rebalance_id: String or integer rebalance identifier.
447
+
448
+ Returns:
449
+ The literal server value ``Deleted Successfully`` on success.
450
+
451
+ Raises:
452
+ requests.HTTPError: If the service rejects the request, including
453
+ 404 for a missing record or 409 outside the undo window.
454
+ KeyError: If the response omits ``data``.
455
+ TypeError: If the identifier is not a string or integer.
456
+ ValueError: If the identifier is blank or contains ``/``.
457
+ """
458
+ identifier = self._path_segment(rebalance_id)
459
+ return self._call("delete", f'{self.urls["rebalance"]}/{identifier}')
460
+
437
461
  def create_subscription_plan(
438
462
  self, plan: Mapping[str, Any], *, analyst: Any
439
463
  ) -> Any:
@@ -742,6 +766,26 @@ class PortfolioProduct(ApiClient):
742
766
  identifier = self._path_segment(basket_id)
743
767
  return self._call("put", f'{self.urls["basket"]}/{identifier}/activate')
744
768
 
769
+ def get_basket(self, basket_id: str | int) -> Any:
770
+ """GET ``catalogue/basket/<basket_id>`` and return one basket.
771
+
772
+ Args:
773
+ basket_id: String or integer basket identifier.
774
+
775
+ Returns:
776
+ One basket with every model field, including ``analyst`` and
777
+ ``broker``. The server returns 404 when the basket is missing.
778
+
779
+ Raises:
780
+ requests.HTTPError: If the service rejects the request, including
781
+ 404 when the basket is missing.
782
+ KeyError: If the response omits ``data``.
783
+ TypeError: If the identifier is not a string or integer.
784
+ ValueError: If the identifier is blank or contains ``/``.
785
+ """
786
+ identifier = self._path_segment(basket_id)
787
+ return self._call("get", f'{self.urls["basket"]}/{identifier}')
788
+
745
789
  def deactivate_basket(self, basket_id: str | int) -> Any:
746
790
  """PUT ``catalogue/basket/<basket_id>/deactivate`` without a body.
747
791
 
@@ -760,6 +804,30 @@ class PortfolioProduct(ApiClient):
760
804
  identifier = self._path_segment(basket_id)
761
805
  return self._call("put", f'{self.urls["basket"]}/{identifier}/deactivate')
762
806
 
807
+ def delete_basket(self, basket_id: str | int) -> Any:
808
+ """DELETE ``catalogue/basket/<basket_id>`` and confirm deletion.
809
+
810
+ The server atomically hard-deletes the record's constituents and the
811
+ record itself. It returns 404 when the record is missing and 409 when
812
+ the record is older than the server's undo window, which defaults to
813
+ 600 seconds.
814
+
815
+ Args:
816
+ basket_id: String or integer basket identifier.
817
+
818
+ Returns:
819
+ The literal server value ``Deleted Successfully`` on success.
820
+
821
+ Raises:
822
+ requests.HTTPError: If the service rejects the request, including
823
+ 404 for a missing record or 409 outside the undo window.
824
+ KeyError: If the response omits ``data``.
825
+ TypeError: If the identifier is not a string or integer.
826
+ ValueError: If the identifier is blank or contains ``/``.
827
+ """
828
+ identifier = self._path_segment(basket_id)
829
+ return self._call("delete", f'{self.urls["basket"]}/{identifier}')
830
+
763
831
  def get_model_history(
764
832
  self, model: Any, *, status: Any = None, sort: Any = None
765
833
  ) -> Any: