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

@@ -2,7 +2,7 @@ import factory
2
2
  import rstr
3
3
  from slugify import slugify
4
4
 
5
- from wbfdm.models import Instrument, InstrumentType
5
+ from wbfdm.models import Cash, Instrument, InstrumentType
6
6
 
7
7
 
8
8
  class InstrumentTypeFactory(factory.django.DjangoModelFactory):
@@ -52,9 +52,17 @@ class InstrumentFactory(factory.django.DjangoModelFactory):
52
52
  model = Instrument
53
53
 
54
54
 
55
- class CashFactory(InstrumentFactory):
55
+ class CashFactory(factory.django.DjangoModelFactory):
56
56
  is_cash = True
57
- instrument_type = factory.LazyAttribute(lambda o: InstrumentTypeFactory.create(name="Cash", key="cash"))
57
+ currency = factory.SubFactory("wbcore.contrib.currency.factories.CurrencyFactory")
58
+ name = factory.LazyAttribute(lambda o: o.currency.title)
59
+ instrument_type = factory.LazyAttribute(
60
+ lambda o: InstrumentType.objects.get_or_create(key="cash", defaults={"name": "Cash", "short_name": "Cash"})[0]
61
+ )
62
+
63
+ class Meta:
64
+ model = Cash
65
+ django_get_or_create = ("currency",)
58
66
 
59
67
 
60
68
  class EquityFactory(InstrumentFactory):
@@ -6,6 +6,7 @@ from wbcore import filters as wb_filters
6
6
  from wbcore.contrib.tags.filters import TagFilterMixin
7
7
 
8
8
  from wbfdm.filters.utils import _get_default_classification_group_id, get_earliest_date, get_latest_date
9
+ from wbfdm.models import InstrumentType
9
10
  from wbfdm.models.instruments import (
10
11
  ClassificationGroup,
11
12
  Instrument,
@@ -103,6 +104,14 @@ class InstrumentFilterSet(TagFilterMixin, InstrumentFavoriteGroupFilterSet):
103
104
  instrument_type__key = wb_filters.CharFilter(label="Instrument Type Key", hidden=True)
104
105
  instrument_type__is_classifiable = wb_filters.BooleanFilter(label="Instrument Type Classifiable", hidden=True)
105
106
 
107
+ instrument_type = wb_filters.ModelMultipleChoiceFilter(
108
+ label="Asset Classes",
109
+ queryset=InstrumentType.objects.all(),
110
+ endpoint=InstrumentType.get_representation_endpoint(),
111
+ value_key=InstrumentType.get_representation_value_key(),
112
+ label_key=InstrumentType.get_representation_label_key(),
113
+ )
114
+
106
115
  is_classifiable = wb_filters.BooleanFilter(label="Is Classifiable", method="filter_is_classifiable", hidden=True)
107
116
 
108
117
  def filter_is_classifiable(self, queryset, name, value):
@@ -1,6 +1,7 @@
1
1
  from typing import Any, Dict, Optional
2
2
 
3
3
  from django.db import models
4
+ from django.utils.translation import gettext_lazy as _
4
5
  from django_fsm import FSMField, transition
5
6
  from wbcore.contrib.authentication.models import User
6
7
  from wbcore.contrib.currency.models import Currency
@@ -112,7 +113,7 @@ class InstrumentRequest(WBModel):
112
113
 
113
114
  def can_approve(self):
114
115
  if self._check_already_existing_instrument():
115
- return {"non_field_errors": "An instrument already exists with the proposed identifier"}
116
+ return {"non_field_errors": [_("An instrument already exists with the proposed identifier")]}
116
117
 
117
118
  @transition(
118
119
  field=status,
@@ -178,7 +179,7 @@ class InstrumentRequest(WBModel):
178
179
 
179
180
  def can_submit(self) -> Dict[str, Any]:
180
181
  if self._check_already_existing_instrument():
181
- return {"non_field_errors": "An instrument already exists with the proposed identifier"}
182
+ return {"non_field_errors": [_("An instrument already exists with the proposed identifier")]}
182
183
 
183
184
  @classmethod
184
185
  def get_representation_endpoint(cls) -> str:
@@ -964,6 +964,10 @@ class CashManager(InstrumentManager):
964
964
  class Cash(Instrument):
965
965
  objects = CashManager()
966
966
 
967
+ def save(self, *args, **kwargs):
968
+ self.is_cash = True
969
+ super().save(*args, **kwargs)
970
+
967
971
  class Meta:
968
972
  proxy = True
969
973
 
@@ -971,7 +975,7 @@ class Cash(Instrument):
971
975
  @receiver(post_save, sender="currency.Currency")
972
976
  def create_cash_from_currency(sender, instance, created, raw, **kwargs):
973
977
  if created:
974
- Instrument.objects.get_or_create(
978
+ Cash.objects.get_or_create(
975
979
  instrument_type=InstrumentType.CASH, currency=instance, defaults={"name": f"Cash {instance.key}"}
976
980
  )
977
981
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbfdm
3
- Version: 1.48.0
3
+ Version: 1.49.1
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.*
@@ -127,7 +127,7 @@ wbfdm/factories/controversies.py,sha256=GhuoEms1O7DIMVNAIbFEzD9DRv8j1MXIv0u1JK6P
127
127
  wbfdm/factories/exchanges.py,sha256=heJHQE59dCDFeDuScJJti4C_SsMsz3O0kmczpGYVNlQ,831
128
128
  wbfdm/factories/instrument_list.py,sha256=ypnrTLCl0XRfGj6y-3XJSQ2Wl5TULxZU0I3nF6svH3Y,743
129
129
  wbfdm/factories/instrument_prices.py,sha256=EjRFbMjP3pLrxoNsNqNo37FGjayIiV99bkQPVgZLj4I,3623
130
- wbfdm/factories/instruments.py,sha256=vM6VymnO0bIecEk-reT8l2TO8O5uHwPYnqVnPREXRKQ,2238
130
+ wbfdm/factories/instruments.py,sha256=A4BP06Ma66uG6klsfkMjGfiP9WYh85OZPTRiXFxwUM0,2552
131
131
  wbfdm/factories/instruments_relationships.py,sha256=opGQMM3sHQV5F04nGPCCsRw8ux8vSQ78tHNJjIDPyUE,1138
132
132
  wbfdm/factories/options.py,sha256=nna8LgB_2-XNGm37--Edkdv1oc49oeKtr7f8tcIJPU4,2463
133
133
  wbfdm/figures/__init__.py,sha256=PDF_OWeTocmJIQozLxj_OjDUeUG7OYzcS2DLpe-ECEA,49
@@ -140,7 +140,7 @@ wbfdm/filters/exchanges.py,sha256=84N4AQoCwgdnxTxmhMob5Yndfr5gy_DRQ_-m2ilVLVM,83
140
140
  wbfdm/filters/financials.py,sha256=mYb2nvZo3UWtN7pWQQcug0YMgQ6uEIlDR5GhwID_Um0,2539
141
141
  wbfdm/filters/financials_analysis.py,sha256=EiWMWZ9cc3Pm7ySTKRHlM2XmB2NDFBIGKdAWNwDhJ3A,4087
142
142
  wbfdm/filters/instrument_prices.py,sha256=_yDyKWwaUIVvsSCJAitILtLdhzschVpkuyi8X8QHpAs,3647
143
- wbfdm/filters/instruments.py,sha256=aRVzy8wtrmIXjmvDrMdpcfUYwb51c9TL-d3XbhLWqF4,7515
143
+ wbfdm/filters/instruments.py,sha256=RwdLzB-96iDmdTOHpb74UkyB4k-AfLBQ1KxhPpJWvyI,7893
144
144
  wbfdm/filters/utils.py,sha256=6IpNoZ_yjRUCdpVXrj3kriTceAX-VGrS5NpZA2NgSmY,1870
145
145
  wbfdm/import_export/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
146
146
  wbfdm/import_export/backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -230,8 +230,8 @@ wbfdm/models/instruments/classifications.py,sha256=EeZ_P8f1F1NfjUmLf9fDMF0iPM73q
230
230
  wbfdm/models/instruments/instrument_lists.py,sha256=GxfFyfYxEcJS36LAarHja49TOM8ffhIivpZX2-tPtZg,4234
231
231
  wbfdm/models/instruments/instrument_prices.py,sha256=WCaFMZ9sF7xeGTp9jkq7TA8RfYHrwvTjujzqgCKj9SI,22070
232
232
  wbfdm/models/instruments/instrument_relationships.py,sha256=zpCZCnt5CqIg5bd6le_6TyirsSwGV2NaqTVKw3bd5vM,10660
233
- wbfdm/models/instruments/instrument_requests.py,sha256=wC07CEqQxMGfrnATyr56T6GWxXknai105G2WIw1i3xk,7767
234
- wbfdm/models/instruments/instruments.py,sha256=V0bBgDxeEXtuu5uUBd15g4FIPAboAC53WN-FMt35qxg,39475
233
+ wbfdm/models/instruments/instrument_requests.py,sha256=XbpofRS8WHadHlTFjvXJyd0o7K9r2pzJtnpjVQZOLdI,7832
234
+ wbfdm/models/instruments/instruments.py,sha256=jbk3rsTIddstWi6DfFPt_UHtthQb0BUtOZUwA2gocJA,39573
235
235
  wbfdm/models/instruments/options.py,sha256=hFprq7B5t4ctz8nVqzFsBEzftq_KDUSsSXl1zJyh7tE,7094
236
236
  wbfdm/models/instruments/private_equities.py,sha256=uzwZi8IkmCKAHVTxnuFya9tehx7kh57sTlTEi1ieDaM,2198
237
237
  wbfdm/models/instruments/querysets.py,sha256=c5Op5VxR0A0uRPGHmnLJ6b7d2X5Kb5IX5bnk7MUfTjA,6475
@@ -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.48.0.dist-info/METADATA,sha256=KJ1lJdQO0zhzAmHcT-aydfJacAOzUwuZ4ziHs2-7s3A,737
356
- wbfdm-1.48.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
357
- wbfdm-1.48.0.dist-info/RECORD,,
355
+ wbfdm-1.49.1.dist-info/METADATA,sha256=CRBxSPPraUiOZsZ1eDYMa8pc5-A3n0uj-DoPAC8_bKk,737
356
+ wbfdm-1.49.1.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
357
+ wbfdm-1.49.1.dist-info/RECORD,,
File without changes