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

@@ -50,8 +50,8 @@ class InstrumentModelAdmin(admin.ModelAdmin):
50
50
  {
51
51
  "fields": (
52
52
  ("name", "name_repr", "computed_str"),
53
- ("parent", "instrument_type"),
54
- ("is_cash", "is_security", "is_managed", "is_investable_universe", "is_primary"),
53
+ ("parent", "instrument_type", "is_primary"),
54
+ ("is_cash", "is_security", "is_managed", "is_cash_equivalent", "is_investable_universe"),
55
55
  ("inception_date", "delisted_date"),
56
56
  ("primary_url", "additional_urls"),
57
57
  (
@@ -55,8 +55,10 @@ class InstrumentLookup:
55
55
  instrument = None
56
56
 
57
57
  # We need to lookup ticker because some provider gives us ticker with or without space in it
58
+ exchange_lookup = {}
58
59
  if only_investable_universe:
59
60
  instruments = self.model.objects.filter(is_investable_universe=True)
61
+ exchange_lookup = {"exchange": exchange} if exchange else {"is_primary": True}
60
62
  else:
61
63
  instruments = self.model.objects.filter(is_security=True)
62
64
 
@@ -76,8 +78,14 @@ class InstrumentLookup:
76
78
  identifier_key != "refinitiv_identifier_code"
77
79
  ): # RIC cannot be uppercased because its symbology implies meaning for lowercase characters
78
80
  identifier = identifier.upper()
79
- instrument = instruments.get(**{identifier_key: identifier})
80
- break
81
+ # we try to lookup the instrument with the unique identifier
82
+ try:
83
+ instrument = instruments.get(**{identifier_key: identifier})
84
+ break
85
+ # if this return a multiple object exception, we assume there is at least one with the exchange provided or primary
86
+ except MultipleObjectsReturned:
87
+ instrument = instruments.get(**{identifier_key: identifier}, **exchange_lookup)
88
+ break
81
89
  if not instrument and not exact_lookup:
82
90
  if instrument_type:
83
91
  if isinstance(instrument_type, str): # in case we receive a key as instrument type
@@ -109,7 +117,6 @@ class InstrumentLookup:
109
117
  instruments_tmp = instruments.filter(exchange=exchange)
110
118
  if instruments_tmp.exists():
111
119
  instruments = instruments_tmp
112
-
113
120
  # last chance
114
121
  if name and instruments.count() > 1:
115
122
  instruments = instruments.annotate(similarity_score=TrigramSimilarity("name", name))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbfdm
3
- Version: 1.52.5
3
+ Version: 1.52.6
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.*
@@ -15,7 +15,7 @@ wbfdm/admin/exchanges.py,sha256=a7XCxwN5lhlIo11SPZcasT6d_Ueqvu2vy5KZwWS5XqU,1418
15
15
  wbfdm/admin/instrument_lists.py,sha256=GhdMhvclyXdpvlTaHxzsGaUjO9X2CQGk_N3pgJd2NCo,719
16
16
  wbfdm/admin/instrument_prices.py,sha256=dCiCALJAVOfIlM6KitytLJzq_9L-PYch-pu1fj7oftE,1894
17
17
  wbfdm/admin/instrument_requests.py,sha256=uOi6g2MwDVodwlJH5yGrLXxRMQ235007CvHFTMH4Flg,846
18
- wbfdm/admin/instruments.py,sha256=wVJUKV5sjQiX2xjkoQYrcs9or5G8VcYYbWVCxVlQWsg,3887
18
+ wbfdm/admin/instruments.py,sha256=-IV-Olix0SuV-cnOdHgO3cp525dyqBReHPup6SNDYIA,3909
19
19
  wbfdm/admin/instruments_relationships.py,sha256=i-F2y_w28R8mh4-Aex9mIh7K6qbjFNfg0VqwjQ-Mk9A,815
20
20
  wbfdm/admin/options.py,sha256=fWj3sFddVlpNshUWV6LDatZoyg6i5AqPFpuLJcs3lKA,2838
21
21
  wbfdm/analysis/__init__.py,sha256=ouAO2P5Y8i80tl0z3kUf2oyeO2-LsDwZUQ3SQ9evI5U,68
@@ -163,7 +163,7 @@ wbfdm/import_export/backends/refinitiv/mixin.py,sha256=DlNHOWOO71PgY0umaZd0Nbbjs
163
163
  wbfdm/import_export/backends/refinitiv/utils/__init__.py,sha256=Rz38xsLAHEyEwIuJksejYExEznlPJb9tRzwJ7JG9L1s,35
164
164
  wbfdm/import_export/backends/refinitiv/utils/controller.py,sha256=yG8V4C2TGhJdKwTeuMfaG1lzJ3MjNaV632KTe0nuym8,7348
165
165
  wbfdm/import_export/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
166
- wbfdm/import_export/handlers/instrument.py,sha256=4ElF54ke7eBlzZIXqGCEZQR563SkBbooxrEUsLOukdA,11516
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
169
  wbfdm/import_export/handlers/option.py,sha256=DtqqdOMEA-u3jWVjmxRPKJ8miENj_t1k2DzAZEoOtXU,2384
@@ -358,6 +358,6 @@ wbfdm/viewsets/statements/__init__.py,sha256=odxtFYUDICPmz8WCE3nx93EvKZLSPBEI4d7
358
358
  wbfdm/viewsets/statements/statements.py,sha256=gA6RCI8-B__JwjEb6OZxpn8Y-9aF-YQ3HIQ7e1vfJMw,4304
359
359
  wbfdm/viewsets/technical_analysis/__init__.py,sha256=qtCIBg0uSiZeJq_1tEQFilnorMBkMe6uCMfqar6-cLE,77
360
360
  wbfdm/viewsets/technical_analysis/monthly_performances.py,sha256=O1j8CGfOranL74LqVvcf7jERaDIboEJZiBf_AbbVDQ8,3974
361
- wbfdm-1.52.5.dist-info/METADATA,sha256=7sJCHj8jb4wQSh4DcU5qE1PwtkDNAzv_2omeYa4LsFA,768
362
- wbfdm-1.52.5.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
363
- wbfdm-1.52.5.dist-info/RECORD,,
361
+ wbfdm-1.52.6.dist-info/METADATA,sha256=ziOc89HxgwSgj3N0_P6kUASppfK4zIjtqX8dZLd84zQ,768
362
+ wbfdm-1.52.6.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
363
+ wbfdm-1.52.6.dist-info/RECORD,,
File without changes