wbfdm 1.46.13__py2.py3-none-any.whl → 1.46.14__py2.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 wbfdm might be problematic. Click here for more details.

@@ -128,28 +128,24 @@ class InstrumentQuerySet(QuerySet):
128
128
  )
129
129
  if not df.empty:
130
130
  df["valuation_date"] = pd.to_datetime(df["valuation_date"])
131
- df = df.rename(columns={"valuation_date": "date"}).set_index(["instrument_id", "date"]).sort_index()
132
- df = df.drop(columns=df.columns.difference(["calculated", "close", "market_capitalization", "volume"]))
133
- df["calculated"] = False
134
- idx = pd.MultiIndex.from_product(
135
- [
136
- df.index.levels[0],
137
- pd.date_range(
138
- df.index.get_level_values("date").min(), df.index.get_level_values("date").max(), freq="B"
139
- ),
140
- ],
141
- names=["instrument_id", "date"],
131
+ df = df.rename(columns={"valuation_date": "date"})
132
+ df = df.drop(
133
+ columns=df.columns.difference(
134
+ ["calculated", "close", "market_capitalization", "volume", "instrument_id", "date"]
135
+ )
142
136
  )
143
- df = df.reindex(idx)
144
- df[["close", "market_capitalization"]] = df[["close", "market_capitalization"]].astype(float).ffill()
145
- df.volume = df.volume.astype(float).fillna(0)
146
- df.calculated = df.calculated.astype(bool).fillna(
147
- True
148
- ) # we do not ffill calculated but set the to True to mark them as "estimated"/"not real"
149
- df = df.reset_index("date").dropna(subset=["close"])
150
- df = df.replace([np.inf, -np.inf, np.nan], None)
137
+ df["calculated"] = False
151
138
 
152
- for instrument_id, dff in df.groupby(level=0):
139
+ for instrument_id, dff in df.groupby("instrument_id", group_keys=False, as_index=False):
140
+ dff = dff.drop(columns=["instrument_id"]).set_index("date").sort_index()
141
+ dff = dff.reindex(pd.date_range(dff.index.min(), dff.index.max(), freq="B"))
142
+ dff[["close", "market_capitalization"]] = dff[["close", "market_capitalization"]].astype(float).ffill()
143
+ dff.volume = dff.volume.astype(float).fillna(0)
144
+ dff.calculated = dff.calculated.astype(bool).fillna(
145
+ True
146
+ ) # we do not ffill calculated but set the to True to mark them as "estimated"/"not real"
147
+ dff = dff.reset_index(names="date").dropna(subset=["close"])
148
+ dff = dff.replace([np.inf, -np.inf, np.nan], None)
153
149
  instrument = self.get(id=instrument_id)
154
150
  yield from filter(
155
151
  lambda x: x, map(lambda row: _dict_to_object(instrument, row), dff.to_dict("records"))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbfdm
3
- Version: 1.46.13
3
+ Version: 1.46.14
4
4
  Summary: The workbench module ensures rapid access to diverse financial data (market, fundamental, forecasts, ESG), with features for storing instruments, classifying them, and conducting financial analysis.
5
5
  Author-email: Christopher Wittlinger <c.wittlinger@stainly.com>
6
6
  Requires-Dist: roman==4.*
@@ -234,7 +234,7 @@ wbfdm/models/instruments/instrument_requests.py,sha256=wC07CEqQxMGfrnATyr56T6GWx
234
234
  wbfdm/models/instruments/instruments.py,sha256=V0bBgDxeEXtuu5uUBd15g4FIPAboAC53WN-FMt35qxg,39475
235
235
  wbfdm/models/instruments/options.py,sha256=hFprq7B5t4ctz8nVqzFsBEzftq_KDUSsSXl1zJyh7tE,7094
236
236
  wbfdm/models/instruments/private_equities.py,sha256=uzwZi8IkmCKAHVTxnuFya9tehx7kh57sTlTEi1ieDaM,2198
237
- wbfdm/models/instruments/querysets.py,sha256=7-hbYxfLAZQJO-e76SmYx6NjZ8q0tdR-4pAZyb-izas,6556
237
+ wbfdm/models/instruments/querysets.py,sha256=c5Op5VxR0A0uRPGHmnLJ6b7d2X5Kb5IX5bnk7MUfTjA,6475
238
238
  wbfdm/models/instruments/utils.py,sha256=88jnWINSSC0OwH-mCEOPLZXuhBCtEsxBpSaZ38GteaE,1365
239
239
  wbfdm/models/instruments/llm/__init__.py,sha256=dSmxRmEWb0A4O_lUoWuRKt2mBtUuLCTPVVJqGyi_n40,52
240
240
  wbfdm/models/instruments/llm/create_instrument_news_relationships.py,sha256=Eza39rlkNJxpURroIsJLImKC6F-KtTmkdjHn1kv4F3Q,3439
@@ -352,6 +352,6 @@ wbfdm/viewsets/statements/__init__.py,sha256=odxtFYUDICPmz8WCE3nx93EvKZLSPBEI4d7
352
352
  wbfdm/viewsets/statements/statements.py,sha256=kmtM0uZ3f7eJJe5gVmd-iVra9dHwTB9x12p7f5qTEx8,4084
353
353
  wbfdm/viewsets/technical_analysis/__init__.py,sha256=qtCIBg0uSiZeJq_1tEQFilnorMBkMe6uCMfqar6-cLE,77
354
354
  wbfdm/viewsets/technical_analysis/monthly_performances.py,sha256=O1j8CGfOranL74LqVvcf7jERaDIboEJZiBf_AbbVDQ8,3974
355
- wbfdm-1.46.13.dist-info/METADATA,sha256=MEHS76Tos0J-qwMLxwwUS3ih5p2u0xVEykz7PJ8LGfE,738
356
- wbfdm-1.46.13.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
357
- wbfdm-1.46.13.dist-info/RECORD,,
355
+ wbfdm-1.46.14.dist-info/METADATA,sha256=of_JOPABQHU8r88Gh9_L0K8B6yBY8L1s9p9hks26WNc,738
356
+ wbfdm-1.46.14.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
357
+ wbfdm-1.46.14.dist-info/RECORD,,