bw-essentials-core 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.whl

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.

@@ -88,7 +88,7 @@ class ApiClient:
88
88
  tenant_id (str): The tenant identifier to include in the headers.
89
89
  """
90
90
  logger.info(f"Setting tenant ID: {tenant_id}")
91
- self._update_headers({"tenant_id": tenant_id})
91
+ self._update_headers({"X-Tenant-ID": tenant_id})
92
92
  logger.info(f"Updated headers: {self.headers}")
93
93
 
94
94
  def set_headers(self, headers: dict) -> None:
@@ -65,7 +65,8 @@ class UserReporting(ApiClient):
65
65
  self.urls = {
66
66
  "instructions": "reporting/instructions/",
67
67
  "portfolio_performance": "reporting/user/%s/userportfolio/%s/performance/",
68
- "portfolio_performance_breakdown": "reporting/user/%s/userportfolio/%s/performance/breakdown/"
68
+ "portfolio_performance_breakdown": "reporting/user/%s/userportfolio/%s/performance/breakdown/",
69
+ 'portfolio_stock_performance': "reporting/user/%s/userportfolio/%s/stock/performance/"
69
70
  }
70
71
 
71
72
  def _get_integer_quantity(self, qty, side):
@@ -151,3 +152,19 @@ class UserReporting(ApiClient):
151
152
  endpoint=endpoint)
152
153
  logger.info(f"{data =}")
153
154
  return data.get("data")
155
+
156
+ def get_portfolio_stock_performance(self, user_id, user_portfolio_id):
157
+ """
158
+ Retrieves a detailed breakdown of portfolio pnl
159
+
160
+ :param user_id: ID of the user
161
+ :param user_portfolio_id: ID of the user portfolio
162
+ :return: Performance breakdown data from the response
163
+ """
164
+ logger.info(f"In get_portfolio_stock_performance {user_id=}, {user_portfolio_id=}")
165
+ endpoint = self.urls.get('portfolio_stock_performance') % (
166
+ user_id, user_portfolio_id)
167
+ data = self._get(url=self.base_url,
168
+ endpoint=endpoint)
169
+ logger.info(f"{data=}")
170
+ return data.get("data")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-essentials-core
3
- Version: 0.1.4
3
+ Version: 0.1.6
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
@@ -11,7 +11,7 @@ bw_essentials/notifications/teams_notifications.py,sha256=1tkS3tTJQZ5ByMwK2WXpFg
11
11
  bw_essentials/s3_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  bw_essentials/s3_utils/s3_utils.py,sha256=wzjVrTX22_8PMX86svKFYGMZwgjBHbOaeEsxO-lR7BY,12922
13
13
  bw_essentials/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- bw_essentials/services/api_client.py,sha256=74tKxhY_HiVCN3kgtk27a4GNznMaRphAspt9CWecuiY,7793
14
+ bw_essentials/services/api_client.py,sha256=U_4CybxBH-A3lh_oLZhVXMosB3a7AHkUazXq_Vg2-Zw,7795
15
15
  bw_essentials/services/broker.py,sha256=As-VT1MxkCD9p-13dQJDwf0_aEJVA6H0wNqL-EYHO4g,8718
16
16
  bw_essentials/services/market_pricer.py,sha256=Qc9lxzAjhefAvjyEKsBPDu60bF6_61cnSpZNfjGMyDg,11755
17
17
  bw_essentials/services/master_data.py,sha256=2o_r2gdhIKBeTFgn5IIY-becgCEpYBymO4BKmixdV1g,11987
@@ -22,8 +22,8 @@ bw_essentials/services/portfolio_content.py,sha256=rdFTTsUUIt-AgFfA1SAItqg2njakV
22
22
  bw_essentials/services/trade_placement.py,sha256=PrzeU2XXC9HF1IQ1dMDM_ZHxmC491sOl-JbA6GWPwII,20772
23
23
  bw_essentials/services/user_app.py,sha256=_Y2NgDq6kEoco7ZRJ3-MMYJ-K2HGStJoFoeGOH_HotQ,11107
24
24
  bw_essentials/services/user_portfolio.py,sha256=_5M6yPfQt4MXedINBawEoPkb_o7IGzxPeHkvZkoQm8k,16191
25
- bw_essentials/services/user_portfolio_reporting.py,sha256=QaZzcw912Uos5ZafEaxLXDmCyetTFiVX3at3cTAv6MA,6003
26
- bw_essentials_core-0.1.4.dist-info/METADATA,sha256=H8GOOZwwtDbXU-DtWLK1LCMFOlyuXAeX9KD9X8Wmt0c,7501
27
- bw_essentials_core-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
- bw_essentials_core-0.1.4.dist-info/top_level.txt,sha256=gDc5T_y5snwKGXDQUusEus-FEt0RFwG644Yn_58wQOQ,14
29
- bw_essentials_core-0.1.4.dist-info/RECORD,,
25
+ bw_essentials/services/user_portfolio_reporting.py,sha256=pwqfW95LTiGOGufcTphljFxPlOd-G4Q263UtoQURPxM,6772
26
+ bw_essentials_core-0.1.6.dist-info/METADATA,sha256=_l1af2qiqA9GAR4Wdzu1AhoCncXfLVyxolbvPNk0yeU,7501
27
+ bw_essentials_core-0.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
+ bw_essentials_core-0.1.6.dist-info/top_level.txt,sha256=gDc5T_y5snwKGXDQUusEus-FEt0RFwG644Yn_58wQOQ,14
29
+ bw_essentials_core-0.1.6.dist-info/RECORD,,