wbfdm 1.54.3__py2.py3-none-any.whl → 1.54.4__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.

@@ -989,6 +989,10 @@ class Cash(Instrument):
989
989
 
990
990
  def save(self, *args, **kwargs):
991
991
  self.is_cash = True
992
+ self.dl_parameters["market_data"] = {
993
+ "path": "wbfdm.contrib.internal.dataloaders.market_data.MarketDataDataloader"
994
+ }
995
+
992
996
  super().save(*args, **kwargs)
993
997
 
994
998
  class Meta:
@@ -46,7 +46,10 @@ class InstrumentPMSMixin:
46
46
 
47
47
  def _build_dto(self, val_date: date, price_date_timedelta: int = 3) -> PriceDTO: # for backward compatibility
48
48
  try:
49
- price = self.valuations.get(date=val_date)
49
+ try:
50
+ price = self.valuations.get(date=val_date)
51
+ except InstrumentPrice.DoesNotExist:
52
+ price = self.prices.get(date=val_date)
50
53
  close = float(price.net_value)
51
54
  return PriceDTO(
52
55
  pk=price.id,
@@ -38,23 +38,25 @@ class TestInstrumentModel:
38
38
  assert res[0]["market_capitalization"] == price.market_capitalization
39
39
  assert res[0]["outstanding_shares"] == float(price.outstanding_shares)
40
40
 
41
- def test_get_price(self, instrument_factory, instrument_price_factory):
41
+ def test_get_price(self, weekday, instrument_factory, instrument_price_factory):
42
42
  instrument = instrument_factory.create()
43
43
  other_instrument = instrument_factory.create()
44
- price = instrument_price_factory.create(instrument=instrument)
45
- price.refresh_from_db()
44
+ price_calculated = instrument_price_factory.create(date=weekday, instrument=instrument, calculated=True)
45
+
46
46
  instrument_price_factory.create(instrument=other_instrument) # Noise
47
- assert instrument.get_price(price.date) == float(price.net_value)
48
- assert instrument.get_price((price.date + BDay(1)).date()) == float(price.net_value)
49
- assert instrument.get_price((price.date + BDay(2)).date()) == float(price.net_value)
50
- assert instrument.get_price((price.date + BDay(3)).date()) == float(price.net_value)
47
+ assert instrument.get_price(weekday) == float(price_calculated.net_value)
48
+ price_real = instrument_price_factory.create(date=weekday, instrument=instrument, calculated=False)
49
+ assert instrument.get_price(weekday) == float(price_real.net_value) # we prioritize real price
50
+ assert instrument.get_price((weekday + BDay(1)).date()) == float(price_real.net_value)
51
+ assert instrument.get_price((weekday + BDay(2)).date()) == float(price_real.net_value)
52
+ assert instrument.get_price((weekday + BDay(3)).date()) == float(price_real.net_value)
51
53
  with pytest.raises(ValueError):
52
- instrument.get_price((price.date + BDay(4)).date()) # for return the latest valid price 3 days earlier.
54
+ instrument.get_price((weekday + BDay(4)).date()) # for return the latest valid price 3 days earlier.
53
55
 
54
56
  # if the instrument is considered cash, we always return a value of 1
55
57
  instrument.is_cash = True
56
58
  instrument.save()
57
- assert instrument.get_price(price.date) == Decimal(1)
59
+ assert instrument.get_price(weekday) == Decimal(1)
58
60
 
59
61
  def test_extract_daily_performance_df(self):
60
62
  tidx = pd.date_range("2016-07-01", periods=4, freq="B")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbfdm
3
- Version: 1.54.3
3
+ Version: 1.54.4
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.*
@@ -238,7 +238,7 @@ wbfdm/models/instruments/instrument_lists.py,sha256=GxfFyfYxEcJS36LAarHja49TOM8f
238
238
  wbfdm/models/instruments/instrument_prices.py,sha256=4xDZ2ulwQ1grVuznchz3m3920LTmHkxWfiSLy-c2u0g,22306
239
239
  wbfdm/models/instruments/instrument_relationships.py,sha256=zpCZCnt5CqIg5bd6le_6TyirsSwGV2NaqTVKw3bd5vM,10660
240
240
  wbfdm/models/instruments/instrument_requests.py,sha256=XbpofRS8WHadHlTFjvXJyd0o7K9r2pzJtnpjVQZOLdI,7832
241
- wbfdm/models/instruments/instruments.py,sha256=3I7s5hHcIQcBKjVjF4go9SSTw3Kr1RX9vImYYctjszQ,44035
241
+ wbfdm/models/instruments/instruments.py,sha256=N_g3yM5bajyo1tQBIeKkmQ4SdpPkUcEhKeEuTOJGwLw,44182
242
242
  wbfdm/models/instruments/options.py,sha256=hFprq7B5t4ctz8nVqzFsBEzftq_KDUSsSXl1zJyh7tE,7094
243
243
  wbfdm/models/instruments/private_equities.py,sha256=uzwZi8IkmCKAHVTxnuFya9tehx7kh57sTlTEi1ieDaM,2198
244
244
  wbfdm/models/instruments/querysets.py,sha256=zBY3lX_l0_gqIGjX4vkfn7DQ5QyF_okmIYZ6SV1Y6I4,7729
@@ -248,7 +248,7 @@ wbfdm/models/instruments/llm/create_instrument_news_relationships.py,sha256=f9MT
248
248
  wbfdm/models/instruments/mixin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
249
249
  wbfdm/models/instruments/mixin/financials_computed.py,sha256=L5wjXDsR0maiwfOKP6KyWNJNH4nGOoAjSc_hDM7fsj0,35105
250
250
  wbfdm/models/instruments/mixin/financials_serializer_fields.py,sha256=-OkpcUt1rZmB3nUcO2vckpJdVm8IxRqkPDEgcPqqoRU,68886
251
- wbfdm/models/instruments/mixin/instruments.py,sha256=W9v29cjST-5MAMMuXVnlH4ItdRTdoA_vMCkLUhQgW2s,9888
251
+ wbfdm/models/instruments/mixin/instruments.py,sha256=BNcI1pnGQFjHHTx2qqzYnbfcJ_dq84OzO5g_uxxDOVI,10013
252
252
  wbfdm/serializers/__init__.py,sha256=AXb03RKHo6B0ts_IQOvx89n9wKG8pxiumYv9cr4EhvA,197
253
253
  wbfdm/serializers/esg.py,sha256=epoX8cjkPuVv45aW-Jf85-rSO_ZrSnXcTxMcadKdC-I,1086
254
254
  wbfdm/serializers/exchanges.py,sha256=wYvy0XBS9tRFHqin23gABQ_pj3Rmsx1B075SZ5GqwDo,1211
@@ -280,7 +280,7 @@ wbfdm/tests/models/test_classifications.py,sha256=f2aM9UyV54fkEncp-uewEdOc3_0D-i
280
280
  wbfdm/tests/models/test_exchanges.py,sha256=KwK278MpA3FkpVgjW2l2PIHL7e8uDur7dOzIaTQEwyw,138
281
281
  wbfdm/tests/models/test_instrument_list.py,sha256=UIxKgBd4U-T2I4WDZfwacgJ1nKwJWYX1HKhdQDpx1tA,4899
282
282
  wbfdm/tests/models/test_instrument_prices.py,sha256=ObqFbJxZveiOPAK9_kC_JO9VBNmZB6bvGM4BejsFJ3c,16633
283
- wbfdm/tests/models/test_instruments.py,sha256=DCl73yP2n6hIBZWtXGr2H5UvYbVO_5iGN5lwGo3bgtk,9544
283
+ wbfdm/tests/models/test_instruments.py,sha256=Vg2cYWAwdu00dziKDUe_MrTzrsygHaZQHnvibF8pvew,9784
284
284
  wbfdm/tests/models/test_merge.py,sha256=tXD5xIxZyZtXpm9WIQ4Yc8TQwsUnkxkKIvMNwaHOvgM,4632
285
285
  wbfdm/tests/models/test_options.py,sha256=DoEAHhNQE4kucpBRRm2S05ozabkERz-I4mUolsE2Qi8,2269
286
286
  wbfdm/viewsets/__init__.py,sha256=ZM29X0-5AkSH2rzF_gKUI4FoaEWCcMTXPjruJ4Gi_x8,383
@@ -359,6 +359,6 @@ wbfdm/viewsets/statements/__init__.py,sha256=odxtFYUDICPmz8WCE3nx93EvKZLSPBEI4d7
359
359
  wbfdm/viewsets/statements/statements.py,sha256=gA6RCI8-B__JwjEb6OZxpn8Y-9aF-YQ3HIQ7e1vfJMw,4304
360
360
  wbfdm/viewsets/technical_analysis/__init__.py,sha256=qtCIBg0uSiZeJq_1tEQFilnorMBkMe6uCMfqar6-cLE,77
361
361
  wbfdm/viewsets/technical_analysis/monthly_performances.py,sha256=O1j8CGfOranL74LqVvcf7jERaDIboEJZiBf_AbbVDQ8,3974
362
- wbfdm-1.54.3.dist-info/METADATA,sha256=Va66JevcnIknLO3xjCAkgUOT1xMUYsw2A9plYI3aZOE,768
363
- wbfdm-1.54.3.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
364
- wbfdm-1.54.3.dist-info/RECORD,,
362
+ wbfdm-1.54.4.dist-info/METADATA,sha256=XI3xyUaklo297IMvhNPC2hGUjqL5e2HaJmQzWkN5esM,768
363
+ wbfdm-1.54.4.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
364
+ wbfdm-1.54.4.dist-info/RECORD,,
File without changes