bw-essentials-core 0.0.8__py3-none-any.whl → 0.0.9__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.

@@ -67,7 +67,8 @@ class MarketPricer(ApiClient):
67
67
  self.name = Services.MARKET_PRICER.value
68
68
  self.urls = {
69
69
  "live": "live",
70
- "eod": "eod"
70
+ "eod": "eod",
71
+ "index_performance": "index/{}/performance",
71
72
  }
72
73
 
73
74
  def get_live_prices(self, securities, exchange):
@@ -231,3 +232,71 @@ class MarketPricer(ApiClient):
231
232
 
232
233
  logger.info(f"{market_pricing_eod_response=}")
233
234
  return market_pricing_eod_response.get("data")
235
+
236
+ def get_index_performance_by_dates(self, index_name, start_date, end_date):
237
+ """
238
+ Fetches index performance metrics over a given date range.
239
+
240
+ Args:
241
+ index_name (str): The index name (e.g., "NIFTY50").
242
+ start_date (str): The start date for performance metrics in 'YYYY-MM-DD' format.
243
+ end_date (str): The end date for performance metrics in 'YYYY-MM-DD' format.
244
+
245
+ Returns:
246
+ dict: A dictionary containing cumulative return, volatility, drawdown, and a list
247
+ of daily return data.
248
+ Example:
249
+ {
250
+ "data": {
251
+ "cumulative_return": 2.332968692796598,
252
+ "volatility": 6.378354401960588,
253
+ "drawdown": 0,
254
+ "daily_returns": [
255
+ {
256
+ "date": "2025-06-05",
257
+ "close": 22934.5,
258
+ "daily_return": 0.5552912703301827,
259
+ "current_weight": 100.55529127033019
260
+ },
261
+ {
262
+ "date": "2025-06-06",
263
+ "close": 23165.1,
264
+ "daily_return": 1.0054721053434745,
265
+ "current_weight": 101.56634667450024
266
+ },
267
+ {
268
+ "date": "2025-06-09",
269
+ "close": 23329.4,
270
+ "daily_return": 0.7092565972087517,
271
+ "current_weight": 102.28671268883305
272
+ },
273
+ {
274
+ "date": "2025-06-10",
275
+ "close": 23339.95,
276
+ "daily_return": 0.04522190883606836,
277
+ "current_weight": 102.3329686927966
278
+ }
279
+ ]
280
+ },
281
+ "success": true
282
+ }
283
+ Raises:
284
+ ValueError: If input parameters are missing or invalid.
285
+ """
286
+ logger.info(f"In - get_index_performance_by_dates | {index_name=}, {start_date=}, {end_date=}")
287
+
288
+ if not all([index_name, start_date, end_date]):
289
+ logger.error("Missing required parameters for index performance fetch")
290
+ raise ValueError("index_name, start_date, and end_date are required")
291
+
292
+ endpoint = self.urls['index_performance'].format(index_name)
293
+ params = {"start_date": start_date, "end_date": end_date}
294
+ response = self._get(
295
+ url=self.base_url,
296
+ endpoint=endpoint,
297
+ params=params
298
+ )
299
+ logger.debug(f"Raw response from MarketPricer index API: {response}")
300
+ data = response.get("data")
301
+ logger.info("Out - get_index_performance_by_dates success")
302
+ return data
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-essentials-core
3
- Version: 0.0.8
3
+ Version: 0.0.9
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
@@ -13,13 +13,13 @@ bw_essentials/s3_utils/s3_utils.py,sha256=wzjVrTX22_8PMX86svKFYGMZwgjBHbOaeEsxO-
13
13
  bw_essentials/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  bw_essentials/services/api_client.py,sha256=74tKxhY_HiVCN3kgtk27a4GNznMaRphAspt9CWecuiY,7793
15
15
  bw_essentials/services/broker.py,sha256=As-VT1MxkCD9p-13dQJDwf0_aEJVA6H0wNqL-EYHO4g,8718
16
- bw_essentials/services/market_pricer.py,sha256=WAFcG5JfnqWxjzXRPrMdovPuKqWJIwa3ENvGAyEyjeM,8712
16
+ bw_essentials/services/market_pricer.py,sha256=Qc9lxzAjhefAvjyEKsBPDu60bF6_61cnSpZNfjGMyDg,11755
17
17
  bw_essentials/services/master_data.py,sha256=2o_r2gdhIKBeTFgn5IIY-becgCEpYBymO4BKmixdV1g,11987
18
18
  bw_essentials/services/model_portfolio_reporting.py,sha256=iOtm4gyfU8P7C0R1gp6gUJI4ZRxJD5K2GLOalI_gToM,3249
19
19
  bw_essentials/services/trade_placement.py,sha256=PrzeU2XXC9HF1IQ1dMDM_ZHxmC491sOl-JbA6GWPwII,20772
20
20
  bw_essentials/services/user_portfolio.py,sha256=_5M6yPfQt4MXedINBawEoPkb_o7IGzxPeHkvZkoQm8k,16191
21
21
  bw_essentials/services/user_portfolio_reporting.py,sha256=QaZzcw912Uos5ZafEaxLXDmCyetTFiVX3at3cTAv6MA,6003
22
- bw_essentials_core-0.0.8.dist-info/METADATA,sha256=GHHKudJ8VIoZ0nOUAeAnpQy0FYXXuPMSTQYA_aa3Wt0,7501
23
- bw_essentials_core-0.0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
- bw_essentials_core-0.0.8.dist-info/top_level.txt,sha256=gDc5T_y5snwKGXDQUusEus-FEt0RFwG644Yn_58wQOQ,14
25
- bw_essentials_core-0.0.8.dist-info/RECORD,,
22
+ bw_essentials_core-0.0.9.dist-info/METADATA,sha256=NZGAHCPsiUsVhqn8lQnMqdbHSQfTLb0SU_txe_t75B8,7501
23
+ bw_essentials_core-0.0.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ bw_essentials_core-0.0.9.dist-info/top_level.txt,sha256=gDc5T_y5snwKGXDQUusEus-FEt0RFwG644Yn_58wQOQ,14
25
+ bw_essentials_core-0.0.9.dist-info/RECORD,,