wbfdm 1.45.0__py2.py3-none-any.whl → 1.46.0__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.
- wbfdm/import_export/handlers/instrument.py +8 -9
- wbfdm/serializers/instruments/__init__.py +1 -0
- wbfdm/serializers/instruments/instrument_relationships.py +5 -8
- wbfdm/serializers/instruments/instruments.py +0 -1
- wbfdm/viewsets/configs/endpoints/__init__.py +1 -0
- wbfdm/viewsets/configs/endpoints/instruments_relationships.py +10 -0
- wbfdm/viewsets/instruments/instruments_relationships.py +16 -0
- {wbfdm-1.45.0.dist-info → wbfdm-1.46.0.dist-info}/METADATA +1 -1
- {wbfdm-1.45.0.dist-info → wbfdm-1.46.0.dist-info}/RECORD +10 -10
- {wbfdm-1.45.0.dist-info → wbfdm-1.46.0.dist-info}/WHEEL +0 -0
|
@@ -67,7 +67,6 @@ class InstrumentLookup:
|
|
|
67
67
|
"refinitiv_mnemonic_code",
|
|
68
68
|
"sedol",
|
|
69
69
|
"cusip",
|
|
70
|
-
"ticker",
|
|
71
70
|
"identifier",
|
|
72
71
|
]:
|
|
73
72
|
if identifier := identifiers.get(identifier_key, None):
|
|
@@ -79,7 +78,6 @@ class InstrumentLookup:
|
|
|
79
78
|
identifier = identifier.upper()
|
|
80
79
|
instrument = instruments.get(**{identifier_key: identifier})
|
|
81
80
|
break
|
|
82
|
-
|
|
83
81
|
if not instrument and not exact_lookup:
|
|
84
82
|
if instrument_type:
|
|
85
83
|
if isinstance(instrument_type, str): # in case we receive a key as instrument type
|
|
@@ -103,14 +101,15 @@ class InstrumentLookup:
|
|
|
103
101
|
conditions.append(Q(old_isins__contains=[field_value]))
|
|
104
102
|
if conditions:
|
|
105
103
|
instruments = instruments.filter(reduce(operator.or_, conditions))
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if instruments_tmp.
|
|
104
|
+
|
|
105
|
+
if currency: # if currency is provides, we use it as validator
|
|
106
|
+
instruments = instruments.filter(currency=currency)
|
|
107
|
+
|
|
108
|
+
if exchange:
|
|
109
|
+
instruments_tmp = instruments.filter(exchange=exchange)
|
|
110
|
+
if instruments_tmp.exists():
|
|
113
111
|
instruments = instruments_tmp
|
|
112
|
+
|
|
114
113
|
# last chance
|
|
115
114
|
if name and instruments.count() > 1:
|
|
116
115
|
instruments = instruments.annotate(similarity_score=TrigramSimilarity("name", name))
|
|
@@ -19,6 +19,7 @@ from .instrument_relationships import (
|
|
|
19
19
|
RelatedInstrumentThroughInstrumentModelSerializer,
|
|
20
20
|
InstrumentFavoriteGroupRepresentationSerializer,
|
|
21
21
|
InstrumentFavoriteGroupModelSerializer,
|
|
22
|
+
ReadOnlyInstrumentFavoriteGroupModelSerializer,
|
|
22
23
|
InstrumentClassificationThroughModelSerializer,
|
|
23
24
|
)
|
|
24
25
|
from .instrument_requests import InstrumentRequestRepresentationSerializer, InstrumentRequestModelSerializer
|
|
@@ -35,16 +35,8 @@ class InstrumentFavoriteGroupModelSerializer(wb_serializers.ModelSerializer):
|
|
|
35
35
|
owner = wb_serializers.PrimaryKeyRelatedField(
|
|
36
36
|
queryset=lambda: Person.objects.filter_only_internal(),
|
|
37
37
|
default=wb_serializers.CurrentUserDefault("profile"),
|
|
38
|
-
read_only=lambda view: not view.request.user.is_superuser,
|
|
39
38
|
)
|
|
40
39
|
_owner = PersonRepresentationSerializer(source="owner")
|
|
41
|
-
public = wb_serializers.BooleanField(read_only=True)
|
|
42
|
-
|
|
43
|
-
# @wb_serializers.register_only_instance_resource()
|
|
44
|
-
# def instruments(self, instance, request, user, **kwargs):
|
|
45
|
-
# if instance.instruments.exists():
|
|
46
|
-
# return {"instruments": reverse("wbfdm:favoritegroup-instrument-list", args=[instance.id], request=request)}
|
|
47
|
-
# return dict()
|
|
48
40
|
|
|
49
41
|
def validate(self, data):
|
|
50
42
|
if not data.get("owner", None):
|
|
@@ -66,6 +58,11 @@ class InstrumentFavoriteGroupModelSerializer(wb_serializers.ModelSerializer):
|
|
|
66
58
|
)
|
|
67
59
|
|
|
68
60
|
|
|
61
|
+
class ReadOnlyInstrumentFavoriteGroupModelSerializer(InstrumentFavoriteGroupModelSerializer):
|
|
62
|
+
class Meta(InstrumentFavoriteGroupModelSerializer.Meta):
|
|
63
|
+
read_only_fields = InstrumentFavoriteGroupModelSerializer.Meta.fields
|
|
64
|
+
|
|
65
|
+
|
|
69
66
|
class RelatedInstrumentThroughInstrumentModelSerializer(wb_serializers.ModelSerializer):
|
|
70
67
|
_related_instrument = InvestableInstrumentRepresentationSerializer(source="related_instrument")
|
|
71
68
|
_instrument = InvestableInstrumentRepresentationSerializer(source="instrument")
|
|
@@ -36,6 +36,7 @@ from .instrument_prices import (
|
|
|
36
36
|
from .instruments_relationships import (
|
|
37
37
|
ClassifiedInstrumentEndpointConfig,
|
|
38
38
|
RelatedInstrumentThroughInstrumentEndpointConfig,
|
|
39
|
+
InstrumentFavoriteGroupEndpointConfig
|
|
39
40
|
)
|
|
40
41
|
from .exchanges import ExchangeEndpointConfig
|
|
41
42
|
from .esg import InstrumentESGPAIEndpointViewConfig, InstrumentESGControversiesEndpointViewConfig
|
|
@@ -29,3 +29,13 @@ class ClassifiedInstrumentEndpointConfig(EndpointViewConfig):
|
|
|
29
29
|
|
|
30
30
|
def get_delete_endpoint(self, **kwargs):
|
|
31
31
|
return None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class InstrumentFavoriteGroupEndpointConfig(EndpointViewConfig):
|
|
35
|
+
def get_update_endpoint(self, **kwargs):
|
|
36
|
+
if self.view.is_owner:
|
|
37
|
+
return self.get_instance_endpoint(**kwargs)
|
|
38
|
+
return None
|
|
39
|
+
|
|
40
|
+
def get_delete_endpoint(self, **kwargs):
|
|
41
|
+
return self.get_update_endpoint(**kwargs)
|
|
@@ -29,6 +29,7 @@ from wbfdm.serializers import (
|
|
|
29
29
|
InstrumentClassificationRelatedInstrumentRepresentationSerializer,
|
|
30
30
|
InstrumentFavoriteGroupModelSerializer,
|
|
31
31
|
InstrumentFavoriteGroupRepresentationSerializer,
|
|
32
|
+
ReadOnlyInstrumentFavoriteGroupModelSerializer,
|
|
32
33
|
RelatedInstrumentThroughInstrumentModelSerializer,
|
|
33
34
|
)
|
|
34
35
|
from wbfdm.viewsets.configs.display import ClassifiedInstrumentDisplayConfig
|
|
@@ -39,6 +40,7 @@ from ..configs import (
|
|
|
39
40
|
ClassificationInstrumentRelatedInstrumentEndpointConfig,
|
|
40
41
|
ClassifiedInstrumentEndpointConfig,
|
|
41
42
|
InstrumentFavoriteGroupDisplayConfig,
|
|
43
|
+
InstrumentFavoriteGroupEndpointConfig,
|
|
42
44
|
InstrumentFavoriteGroupTitleConfig,
|
|
43
45
|
RelatedInstrumentThroughInstrumentDisplayConfig,
|
|
44
46
|
RelatedInstrumentThroughInstrumentEndpointConfig,
|
|
@@ -91,6 +93,20 @@ class InstrumentFavoriteGroupModelViewSet(InternalUserPermissionMixin, viewsets.
|
|
|
91
93
|
|
|
92
94
|
display_config_class = InstrumentFavoriteGroupDisplayConfig
|
|
93
95
|
title_config_class = InstrumentFavoriteGroupTitleConfig
|
|
96
|
+
endpoint_config_class = InstrumentFavoriteGroupEndpointConfig
|
|
97
|
+
|
|
98
|
+
@cached_property
|
|
99
|
+
def is_owner(self) -> bool:
|
|
100
|
+
try:
|
|
101
|
+
group = InstrumentFavoriteGroup.objects.get(id=self.kwargs["pk"])
|
|
102
|
+
return group.owner == self.request.user.profile
|
|
103
|
+
except (KeyError, InstrumentFavoriteGroup.DoesNotExist):
|
|
104
|
+
return False
|
|
105
|
+
|
|
106
|
+
def get_serializer_class(self):
|
|
107
|
+
if self.is_owner:
|
|
108
|
+
return InstrumentFavoriteGroupModelSerializer
|
|
109
|
+
return ReadOnlyInstrumentFavoriteGroupModelSerializer
|
|
94
110
|
|
|
95
111
|
def get_queryset(self):
|
|
96
112
|
qs = InstrumentFavoriteGroup.objects.all()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wbfdm
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.46.0
|
|
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.*
|
|
@@ -162,7 +162,7 @@ wbfdm/import_export/backends/refinitiv/mixin.py,sha256=DlNHOWOO71PgY0umaZd0Nbbjs
|
|
|
162
162
|
wbfdm/import_export/backends/refinitiv/utils/__init__.py,sha256=Rz38xsLAHEyEwIuJksejYExEznlPJb9tRzwJ7JG9L1s,35
|
|
163
163
|
wbfdm/import_export/backends/refinitiv/utils/controller.py,sha256=yG8V4C2TGhJdKwTeuMfaG1lzJ3MjNaV632KTe0nuym8,7348
|
|
164
164
|
wbfdm/import_export/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
165
|
-
wbfdm/import_export/handlers/instrument.py,sha256=
|
|
165
|
+
wbfdm/import_export/handlers/instrument.py,sha256=ccY5zcsL8SwR9-PzhFjfHpnvA4DzZ-8FoErEzmCMG3g,11463
|
|
166
166
|
wbfdm/import_export/handlers/instrument_list.py,sha256=mZRfpJFi6BhhrjH2qaFEPqqCK2ybg-DQm43Uck7G9_w,4864
|
|
167
167
|
wbfdm/import_export/handlers/instrument_price.py,sha256=RbNTo78zZuttzlVFKxJrHcW7DRfcsta7QDEI8OiiDrA,3498
|
|
168
168
|
wbfdm/import_export/handlers/option.py,sha256=DtqqdOMEA-u3jWVjmxRPKJ8miENj_t1k2DzAZEoOtXU,2384
|
|
@@ -244,13 +244,13 @@ wbfdm/serializers/__init__.py,sha256=AXb03RKHo6B0ts_IQOvx89n9wKG8pxiumYv9cr4EhvA
|
|
|
244
244
|
wbfdm/serializers/esg.py,sha256=epoX8cjkPuVv45aW-Jf85-rSO_ZrSnXcTxMcadKdC-I,1086
|
|
245
245
|
wbfdm/serializers/exchanges.py,sha256=vi5kFadYRQo-6CV2b56nrABpt80LPtjZumJVaBE4bcc,1175
|
|
246
246
|
wbfdm/serializers/officers.py,sha256=yrBJqnwxS5Eq0aGcRKe0FbEYEvDFpZlb8gzgfU9pRyk,473
|
|
247
|
-
wbfdm/serializers/instruments/__init__.py,sha256=
|
|
247
|
+
wbfdm/serializers/instruments/__init__.py,sha256=7WX6P7Fzyc_E59CpJ1RBAPptIOPXOHn9FScvGY8qWjo,1662
|
|
248
248
|
wbfdm/serializers/instruments/classifications.py,sha256=DsrKkF0lFBTtNrVs0vhjkjjlK8mDSbGfvQODarYPbDA,5669
|
|
249
249
|
wbfdm/serializers/instruments/instrument_lists.py,sha256=M9RnH-Iy095m5xgkVcPHfvKiyHgCy8kIIN9cdqOf20I,1916
|
|
250
250
|
wbfdm/serializers/instruments/instrument_prices.py,sha256=de-IlwUJC6gSYVztuTmOXQK3r-Gjn8tVWaSCx0PXh_Q,2593
|
|
251
|
-
wbfdm/serializers/instruments/instrument_relationships.py,sha256=
|
|
251
|
+
wbfdm/serializers/instruments/instrument_relationships.py,sha256=3hChFzdekoPtMYolEhWafcb9nTLPmx6WGEq_Hgck8jA,6454
|
|
252
252
|
wbfdm/serializers/instruments/instrument_requests.py,sha256=Sl4gfkUu63zk4o2iGFVE59wx1rKkLUG6SPYCE7Dqrs4,2176
|
|
253
|
-
wbfdm/serializers/instruments/instruments.py,sha256=
|
|
253
|
+
wbfdm/serializers/instruments/instruments.py,sha256=HPrIvaabkXIgiegnR6xJKyl5HhX-ozvEyfzOAHQbh-E,11496
|
|
254
254
|
wbfdm/serializers/instruments/mixins.py,sha256=kxvjgi6zgAeIDkryDm3x3VYtiwP-rk4mcI825RsVXWM,4394
|
|
255
255
|
wbfdm/sync/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
256
256
|
wbfdm/sync/abstract.py,sha256=u1zjHT0ZJabUZpy3_EUCTtEig0p5Fuhlx69O9BsV_Gs,849
|
|
@@ -302,7 +302,7 @@ wbfdm/viewsets/configs/display/officers.py,sha256=qUwN9HPSSlT85aUSFNY-30550P35j3
|
|
|
302
302
|
wbfdm/viewsets/configs/display/prices.py,sha256=09PVAbrgxE7vkZjYaloNqi2Jot2iyRjHILcJPsVj5gI,890
|
|
303
303
|
wbfdm/viewsets/configs/display/statement_with_estimates.py,sha256=pW11SmOpL5Frzc1iRmKLHFWUySNCUt8BB1akm6kVsEg,4206
|
|
304
304
|
wbfdm/viewsets/configs/display/statements.py,sha256=p7QwzGGxydHPf_igzvDworIjm4nm6vi6qxDxRQhv-_w,1715
|
|
305
|
-
wbfdm/viewsets/configs/endpoints/__init__.py,sha256=
|
|
305
|
+
wbfdm/viewsets/configs/endpoints/__init__.py,sha256=0NqyqxbeF-CBlju7lvhNvcgT6dF9pQqYHF4eNGBeZaI,1883
|
|
306
306
|
wbfdm/viewsets/configs/endpoints/classifications.py,sha256=eXejc-o0HEZDzve27qrJRLDnizio4xvqNNLPgCnfCnU,2818
|
|
307
307
|
wbfdm/viewsets/configs/endpoints/esg.py,sha256=1StqRjZIFP0lqY3ukGdxb_5wS0sDkszwMcjR2o1HrHA,636
|
|
308
308
|
wbfdm/viewsets/configs/endpoints/exchanges.py,sha256=4LzoOBuQ-s7szKF9I3f60IYkpe_vsDvq7Kao_FEQr1A,193
|
|
@@ -311,7 +311,7 @@ wbfdm/viewsets/configs/endpoints/instrument_lists.py,sha256=YOqoi2wRm98kOp8vC0Yl
|
|
|
311
311
|
wbfdm/viewsets/configs/endpoints/instrument_prices.py,sha256=7ko4ZnqD6PhOXZhbZY8GKtI58WFfp2Vj5rNex5dxCQQ,1858
|
|
312
312
|
wbfdm/viewsets/configs/endpoints/instrument_requests.py,sha256=Ij6TdGm8_qOFrK4JODK-NatU__eRjwmhRgMIA40niWQ,729
|
|
313
313
|
wbfdm/viewsets/configs/endpoints/instruments.py,sha256=7RFObP62oqF43yJOLmgGx3uxOl3Orw_tleua_vUu6HU,477
|
|
314
|
-
wbfdm/viewsets/configs/endpoints/instruments_relationships.py,sha256=
|
|
314
|
+
wbfdm/viewsets/configs/endpoints/instruments_relationships.py,sha256=kHjxVBezH3Lx-8qQcBQmcX83A8PF-P4HPo2YDun5cak,1242
|
|
315
315
|
wbfdm/viewsets/configs/endpoints/statements.py,sha256=k2lHhUrXbG_ZyJTdCIl30fogwLvkVQp6diekMcDtOVo,172
|
|
316
316
|
wbfdm/viewsets/configs/menus/__init__.py,sha256=0WuymiOTvTSjbRZj5nevwRHO9WivKwfXq9LqLAgOQCI,401
|
|
317
317
|
wbfdm/viewsets/configs/menus/classifications.py,sha256=gaXfKPlQHPzKIA5LsI4J7fDDWauuhAeDYzV55xukkC8,648
|
|
@@ -344,12 +344,12 @@ wbfdm/viewsets/instruments/instrument_lists.py,sha256=hwwHDNpHjjffxw08N_1LtkL5Fd
|
|
|
344
344
|
wbfdm/viewsets/instruments/instrument_prices.py,sha256=WGUe5WUl9PqulWSPCZgWcBWCmgxtu4lhm-UeAa4ngyg,24008
|
|
345
345
|
wbfdm/viewsets/instruments/instrument_requests.py,sha256=mmaARNl6ymDdlcLzcu16vVfFsunhtJkMw2r2NBfUp9U,1839
|
|
346
346
|
wbfdm/viewsets/instruments/instruments.py,sha256=eI0sP0B1wN8ImuACP_OIbv4n1IZQ5iT5zJyrFm9t8E4,3867
|
|
347
|
-
wbfdm/viewsets/instruments/instruments_relationships.py,sha256=
|
|
347
|
+
wbfdm/viewsets/instruments/instruments_relationships.py,sha256=D2Ym84zXBFegQC9nMThKSWqSAcWa0WvcS_GXxM2po68,11076
|
|
348
348
|
wbfdm/viewsets/instruments/utils.py,sha256=SQAdQSgYwUwhlFBbYkZd1VMDmtfoj9XLj1RGBUzzre8,1144
|
|
349
349
|
wbfdm/viewsets/statements/__init__.py,sha256=odxtFYUDICPmz8WCE3nx93EvKZLSPBEI4d7pozcQz2A,47
|
|
350
350
|
wbfdm/viewsets/statements/statements.py,sha256=kmtM0uZ3f7eJJe5gVmd-iVra9dHwTB9x12p7f5qTEx8,4084
|
|
351
351
|
wbfdm/viewsets/technical_analysis/__init__.py,sha256=qtCIBg0uSiZeJq_1tEQFilnorMBkMe6uCMfqar6-cLE,77
|
|
352
352
|
wbfdm/viewsets/technical_analysis/monthly_performances.py,sha256=O1j8CGfOranL74LqVvcf7jERaDIboEJZiBf_AbbVDQ8,3974
|
|
353
|
-
wbfdm-1.
|
|
354
|
-
wbfdm-1.
|
|
355
|
-
wbfdm-1.
|
|
353
|
+
wbfdm-1.46.0.dist-info/METADATA,sha256=m39LzxWJx6f8zcJN6T3brXQrYiLCJZNFp6E-mxt0z_k,737
|
|
354
|
+
wbfdm-1.46.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
|
355
|
+
wbfdm-1.46.0.dist-info/RECORD,,
|
|
File without changes
|