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

@@ -26,7 +26,7 @@ class OptionAggregateImportHandler(ImportExportHandler):
26
26
 
27
27
  def _get_instance(self, data: Dict[str, Any], history: Optional[models.QuerySet] = None, **kwargs) -> models.Model:
28
28
  with suppress(ObjectDoesNotExist):
29
- return self.model.objects.filter(instrument=data["instrument"], date=data["date"], type=data["type"])
29
+ return self.model.objects.get(instrument=data["instrument"], date=data["date"], type=data["type"])
30
30
 
31
31
 
32
32
  class OptionImportHandler(ImportExportHandler):
@@ -46,7 +46,7 @@ class OptionImportHandler(ImportExportHandler):
46
46
 
47
47
  def _get_instance(self, data: Dict[str, Any], history: Optional[models.QuerySet] = None, **kwargs) -> models.Model:
48
48
  with suppress(ObjectDoesNotExist):
49
- return self.model.objects.filter(
49
+ return self.model.objects.get(
50
50
  instrument=data["instrument"],
51
51
  contract_identifier=data["contract_identifier"],
52
52
  date=data["date"],
@@ -0,0 +1,18 @@
1
+ # Generated by Django 5.0.14 on 2025-08-27 07:59
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('wbfdm', '0031_exchange_apply_round_lot_size_and_more'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterField(
14
+ model_name='instrumentprice',
15
+ name='outstanding_shares',
16
+ field=models.DecimalField(blank=True, decimal_places=4, help_text='The amount of outstanding share for this instrument', max_digits=16, null=True, verbose_name='Outstanding Shares'),
17
+ ),
18
+ ]
@@ -195,9 +195,11 @@ class InstrumentPrice(
195
195
  verbose_name="Value (Gross)",
196
196
  ) # TODO: I think we need to remove this field that is not really used here.
197
197
 
198
- outstanding_shares = DynamicDecimalField(
198
+ outstanding_shares = models.DecimalField(
199
199
  decimal_places=4,
200
200
  max_digits=16,
201
+ blank=True,
202
+ null=True,
201
203
  verbose_name="Outstanding Shares",
202
204
  help_text="The amount of outstanding share for this instrument",
203
205
  )
@@ -697,10 +697,6 @@ import pandas as pd
697
697
  #
698
698
  #
699
699
  class InstrumentPriceComputedMixin:
700
- def _compute_outstanding_shares(self):
701
- if self.outstanding_shares is None and (previous_price := self.previous_price):
702
- return previous_price.outstanding_shares
703
-
704
700
  def _compute_outstanding_shares_consolidated(self):
705
701
  if self.outstanding_shares_consolidated is None and self.outstanding_shares is not None:
706
702
  return self.outstanding_shares
@@ -1,10 +1,8 @@
1
1
  from datetime import date
2
- from decimal import Decimal
3
2
 
4
3
  import pandas as pd
5
4
  import pytest
6
5
  from faker import Faker
7
- from pandas.tseries.offsets import BDay
8
6
  from wbcore.models import DynamicDecimalField, DynamicFloatField
9
7
 
10
8
  from wbfdm.models import Instrument, InstrumentPrice, RelatedInstrumentThroughModel
@@ -168,18 +166,6 @@ class TestInstrumentPriceModel:
168
166
  assert isinstance(instrument_price._meta.get_field("gross_value"), DynamicDecimalField)
169
167
  assert instrument_price.gross_value == instrument_price.net_value
170
168
 
171
- @pytest.mark.parametrize("instrument_price__outstanding_shares", [Decimal(10)])
172
- def test_compute_outstanding_shares(self, instrument_price, instrument_price_factory):
173
- next_price = instrument_price_factory.create(
174
- instrument=instrument_price.instrument,
175
- date=instrument_price.date + BDay(1),
176
- outstanding_shares=None,
177
- calculated=instrument_price.calculated,
178
- )
179
- assert hasattr(instrument_price, "_compute_outstanding_shares")
180
- assert isinstance(instrument_price._meta.get_field("outstanding_shares"), DynamicDecimalField)
181
- assert next_price.outstanding_shares == instrument_price.outstanding_shares
182
-
183
169
  @pytest.mark.parametrize("instrument_price__volume_50d", [None])
184
170
  def test_compute_volume_50d(self, instrument_price, instrument_price_factory):
185
171
  assert hasattr(instrument_price, "_compute_volume_50d")
@@ -174,22 +174,22 @@ class InstrumentPriceInstrumentStatisticsChartView(InstrumentMixin, viewsets.Cha
174
174
 
175
175
  if self.instrument.related_instruments.count() > 0:
176
176
  reference = self.instrument.related_instruments.first().name_repr
177
- risk = self.instrument.primary_risk_instrument.name_repr
178
177
  df = pd.DataFrame(queryset.values("date", "sharpe_ratio", "correlation", "beta")).replace(
179
178
  [np.inf, -np.inf], np.nan
180
179
  )
181
180
 
182
181
  if not df.empty:
183
182
  df = df.set_index("date").sort_index().dropna()
184
- fig.add_trace(
185
- go.Scatter(
186
- x=df.index,
187
- y=df.sharpe_ratio,
188
- mode="lines",
189
- name=f"Sharpe Ratio ({risk})",
190
- hovertemplate=get_hovertemplate_timeserie(currency=""),
183
+ if risk_instrument := self.instrument.primary_risk_instrument:
184
+ fig.add_trace(
185
+ go.Scatter(
186
+ x=df.index,
187
+ y=df.sharpe_ratio,
188
+ mode="lines",
189
+ name=f"Sharpe Ratio ({risk_instrument.name_repr})",
190
+ hovertemplate=get_hovertemplate_timeserie(currency=""),
191
+ )
191
192
  )
192
- )
193
193
  fig.add_trace(
194
194
  go.Scatter(
195
195
  x=df.index,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbfdm
3
- Version: 1.55.0
3
+ Version: 1.55.2
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.*
@@ -166,7 +166,7 @@ wbfdm/import_export/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
166
166
  wbfdm/import_export/handlers/instrument.py,sha256=ZtXwqoCh--_Bgn7mB_A7U2w1S6HfMr9MqFCc4VMw7ls,12071
167
167
  wbfdm/import_export/handlers/instrument_list.py,sha256=mZRfpJFi6BhhrjH2qaFEPqqCK2ybg-DQm43Uck7G9_w,4864
168
168
  wbfdm/import_export/handlers/instrument_price.py,sha256=RbNTo78zZuttzlVFKxJrHcW7DRfcsta7QDEI8OiiDrA,3498
169
- wbfdm/import_export/handlers/option.py,sha256=DtqqdOMEA-u3jWVjmxRPKJ8miENj_t1k2DzAZEoOtXU,2384
169
+ wbfdm/import_export/handlers/option.py,sha256=MPzluMPJ3Yu7Ahmw9BA7-ssAbvPDdyca_rC-YVhU8bY,2378
170
170
  wbfdm/import_export/handlers/private_equities.py,sha256=tOx4lgQOB68lYTi3UzIPzDQsfay5k2pu5qv8jGzG030,1957
171
171
  wbfdm/import_export/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
172
172
  wbfdm/import_export/parsers/cbinsights/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -223,6 +223,7 @@ wbfdm/migrations/0028_instrumentprice_annualized_daily_volatility.py,sha256=pO5M
223
223
  wbfdm/migrations/0029_alter_instrumentprice_volume.py,sha256=0UFUwEaBcqiWjKw6un1gf8sluKCRRh9snDM4z4THDw8,510
224
224
  wbfdm/migrations/0030_alter_relatedinstrumentthroughmodel_related_type.py,sha256=10-89NB7-T7t3xFPpd4fYQkKejNR36UewIhe5_20QCo,565
225
225
  wbfdm/migrations/0031_exchange_apply_round_lot_size_and_more.py,sha256=MqcHxgJIt67BEuEYK8vnJHhx_cGFw9Ca9Az2EvsDy1o,863
226
+ wbfdm/migrations/0032_alter_instrumentprice_outstanding_shares.py,sha256=uRgkf6j97kNaXAo0-_V3XzHNE59hvxSruJB18g53YwU,570
226
227
  wbfdm/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
227
228
  wbfdm/models/__init__.py,sha256=PWsLtlKJFDYycCohPbjsRLeWi1xaxEkZbaoUKo0yOBU,96
228
229
  wbfdm/models/fields.py,sha256=eQ_6EnDBMy0U7WzE2DsdXIXOJH5dFiIN2VbO2Svw4R0,3942
@@ -235,7 +236,7 @@ wbfdm/models/exchanges/exchanges.py,sha256=RmM5shyyuxEGN2Y3JmeSWyU-SbpVARrvVFW72
235
236
  wbfdm/models/instruments/__init__.py,sha256=OvEkECJaCubBQC7B9yUrx15V982labvegeGXyEASVno,636
236
237
  wbfdm/models/instruments/classifications.py,sha256=EeZ_P8f1F1NfjUmLf9fDMF0iPM73qxQoArUfvjuCwHg,10906
237
238
  wbfdm/models/instruments/instrument_lists.py,sha256=GxfFyfYxEcJS36LAarHja49TOM8ffhIivpZX2-tPtZg,4234
238
- wbfdm/models/instruments/instrument_prices.py,sha256=4xDZ2ulwQ1grVuznchz3m3920LTmHkxWfiSLy-c2u0g,22306
239
+ wbfdm/models/instruments/instrument_prices.py,sha256=K7oMIz76WSrLmpNwcabThvtrP6WpBZZnrE9CHB5-UPQ,22345
239
240
  wbfdm/models/instruments/instrument_relationships.py,sha256=zpCZCnt5CqIg5bd6le_6TyirsSwGV2NaqTVKw3bd5vM,10660
240
241
  wbfdm/models/instruments/instrument_requests.py,sha256=XbpofRS8WHadHlTFjvXJyd0o7K9r2pzJtnpjVQZOLdI,7832
241
242
  wbfdm/models/instruments/instruments.py,sha256=Tn9vIu0kys8pVVBiO58Z0Z5fAv0KWzkp4L4kjm7oh3c,44485
@@ -246,7 +247,7 @@ wbfdm/models/instruments/utils.py,sha256=88jnWINSSC0OwH-mCEOPLZXuhBCtEsxBpSaZ38G
246
247
  wbfdm/models/instruments/llm/__init__.py,sha256=dSmxRmEWb0A4O_lUoWuRKt2mBtUuLCTPVVJqGyi_n40,52
247
248
  wbfdm/models/instruments/llm/create_instrument_news_relationships.py,sha256=f9MT-8cWYlexUfCkaOJa9erI9RaUNI-nqCEyf2tDkbA,3809
248
249
  wbfdm/models/instruments/mixin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
249
- wbfdm/models/instruments/mixin/financials_computed.py,sha256=L5wjXDsR0maiwfOKP6KyWNJNH4nGOoAjSc_hDM7fsj0,35105
250
+ wbfdm/models/instruments/mixin/financials_computed.py,sha256=E87I7O2WQgjY3zM3so4dzfExBzVtKTkTqnRjPwLHbyM,34920
250
251
  wbfdm/models/instruments/mixin/financials_serializer_fields.py,sha256=-OkpcUt1rZmB3nUcO2vckpJdVm8IxRqkPDEgcPqqoRU,68886
251
252
  wbfdm/models/instruments/mixin/instruments.py,sha256=fpt03q_Sq35R_ZmJpdcw81aA7wTocnp7ANE1jb-_cfI,10022
252
253
  wbfdm/serializers/__init__.py,sha256=AXb03RKHo6B0ts_IQOvx89n9wKG8pxiumYv9cr4EhvA,197
@@ -279,7 +280,7 @@ wbfdm/tests/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
279
280
  wbfdm/tests/models/test_classifications.py,sha256=f2aM9UyV54fkEncp-uewEdOc3_0D-iPMN5LwhIhJC9w,4979
280
281
  wbfdm/tests/models/test_exchanges.py,sha256=KwK278MpA3FkpVgjW2l2PIHL7e8uDur7dOzIaTQEwyw,138
281
282
  wbfdm/tests/models/test_instrument_list.py,sha256=UIxKgBd4U-T2I4WDZfwacgJ1nKwJWYX1HKhdQDpx1tA,4899
282
- wbfdm/tests/models/test_instrument_prices.py,sha256=ObqFbJxZveiOPAK9_kC_JO9VBNmZB6bvGM4BejsFJ3c,16633
283
+ wbfdm/tests/models/test_instrument_prices.py,sha256=dRaFGc3epG_N6p0KtDzXOH7Gkx_aCSUKNn3JZBhHr8M,15875
283
284
  wbfdm/tests/models/test_instruments.py,sha256=Vg2cYWAwdu00dziKDUe_MrTzrsygHaZQHnvibF8pvew,9784
284
285
  wbfdm/tests/models/test_merge.py,sha256=tXD5xIxZyZtXpm9WIQ4Yc8TQwsUnkxkKIvMNwaHOvgM,4632
285
286
  wbfdm/tests/models/test_options.py,sha256=DoEAHhNQE4kucpBRRm2S05ozabkERz-I4mUolsE2Qi8,2269
@@ -351,7 +352,7 @@ wbfdm/viewsets/instruments/__init__.py,sha256=uydDdU6oZ6W2lgFkr3-cU7WZU7TeokXAA1
351
352
  wbfdm/viewsets/instruments/classifications.py,sha256=CMRTeI6hUClXzZUr7PeRWBXhT9fMiPiu-FvNP_jUQkM,11947
352
353
  wbfdm/viewsets/instruments/financials_analysis.py,sha256=xcVKR2H0P07NIyxFwPPPmVi3hWA0ZrfxOWMO8KjG6Ms,29202
353
354
  wbfdm/viewsets/instruments/instrument_lists.py,sha256=hwwHDNpHjjffxw08N_1LtkL5Fdi8c1Om-PLz6pTu4Ok,2878
354
- wbfdm/viewsets/instruments/instrument_prices.py,sha256=WGUe5WUl9PqulWSPCZgWcBWCmgxtu4lhm-UeAa4ngyg,24008
355
+ wbfdm/viewsets/instruments/instrument_prices.py,sha256=9mdNPU1D6ZFS5Bf0U1d3c6ZlYSCjrNMWv6Vhas3D8Ns,24075
355
356
  wbfdm/viewsets/instruments/instrument_requests.py,sha256=mmaARNl6ymDdlcLzcu16vVfFsunhtJkMw2r2NBfUp9U,1839
356
357
  wbfdm/viewsets/instruments/instruments.py,sha256=9sZIjvWFFQ6SRAal3OXhiqK8_JZJcKb7f_lGtiubqVE,4037
357
358
  wbfdm/viewsets/instruments/instruments_relationships.py,sha256=D2Ym84zXBFegQC9nMThKSWqSAcWa0WvcS_GXxM2po68,11076
@@ -360,6 +361,6 @@ wbfdm/viewsets/statements/__init__.py,sha256=odxtFYUDICPmz8WCE3nx93EvKZLSPBEI4d7
360
361
  wbfdm/viewsets/statements/statements.py,sha256=gA6RCI8-B__JwjEb6OZxpn8Y-9aF-YQ3HIQ7e1vfJMw,4304
361
362
  wbfdm/viewsets/technical_analysis/__init__.py,sha256=qtCIBg0uSiZeJq_1tEQFilnorMBkMe6uCMfqar6-cLE,77
362
363
  wbfdm/viewsets/technical_analysis/monthly_performances.py,sha256=O1j8CGfOranL74LqVvcf7jERaDIboEJZiBf_AbbVDQ8,3974
363
- wbfdm-1.55.0.dist-info/METADATA,sha256=ezMUXfqfuEKhqzOZLVtgz3HGTyHVsOpcN6MRs2vEi-s,768
364
- wbfdm-1.55.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
365
- wbfdm-1.55.0.dist-info/RECORD,,
364
+ wbfdm-1.55.2.dist-info/METADATA,sha256=TAF7w86f1n--02xb-I4oGXoKF-A8v2ZMgO3E905RbIE,768
365
+ wbfdm-1.55.2.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
366
+ wbfdm-1.55.2.dist-info/RECORD,,
File without changes