wbfdm 1.52.1__py2.py3-none-any.whl → 1.52.2rc0__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.

@@ -9,6 +9,7 @@ from django.db import IntegrityError, connections
9
9
  from django.db.models import Max, QuerySet
10
10
  from django.template.loader import get_template
11
11
  from jinjasql import JinjaSql # type: ignore
12
+ from mptt.exceptions import InvalidMove
12
13
  from psycopg.errors import UniqueViolation
13
14
  from tqdm import tqdm
14
15
  from wbcore.contrib.currency.models import Currency
@@ -241,22 +242,26 @@ def update_instruments(sql_name: str, parent_source: str | None = None, context=
241
242
 
242
243
  def update_or_create_item(
243
244
  external_id: int, get_item: Callable, source: str, parent_source: str | None = None
244
- ) -> Instrument:
245
+ ) -> Instrument | None:
245
246
  defaults = convert_data(get_item(external_id), parent_source=parent_source)
246
247
 
247
248
  dl_parameters = defaults.pop("dl_parameters", {})
248
249
  defaults.pop("source", None)
249
250
  defaults.pop("source_id", None)
251
+ try:
252
+ instrument, _ = Instrument.objects.update_or_create(
253
+ source=source,
254
+ source_id=external_id,
255
+ defaults=defaults,
256
+ )
257
+ instrument.dl_parameters.update(dl_parameters)
258
+ _save_single_instrument(instrument)
259
+ return instrument
250
260
 
251
- instrument, _ = Instrument.objects.update_or_create(
252
- source=source,
253
- source_id=external_id,
254
- defaults=defaults,
255
- )
256
- instrument.dl_parameters.update(dl_parameters)
257
- _save_single_instrument(instrument)
258
-
259
- return instrument
261
+ except InvalidMove:
262
+ logger.warning(
263
+ f"We encountered a MPTT ill-formed node for source ID {external_id}. Rebuilding the tree might be necessary."
264
+ )
260
265
 
261
266
 
262
267
  def get_item(external_id: int, template_name: str) -> dict:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbfdm
3
- Version: 1.52.1
3
+ Version: 1.52.2rc0
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.*
@@ -115,7 +115,7 @@ wbfdm/contrib/qa/jinja2/qa/sql/ibes/estimates.sql,sha256=OWgeogSFj7-OdXvJTvNsThN
115
115
  wbfdm/contrib/qa/jinja2/qa/sql/ibes/financials.sql,sha256=0jXNMdX8ixVRJ8YyvtoJRQ510pHFYEioMy7NTp5ecck,2582
116
116
  wbfdm/contrib/qa/sync/exchanges.py,sha256=XU7dj-rQzMlDku9lnmAACaTRoxx8pFSyr5kCK79cYAc,3124
117
117
  wbfdm/contrib/qa/sync/instruments.py,sha256=8aTQVJ_cw1phe4FWikn79pjCfUijaTcwkdhQCtSXKH0,3156
118
- wbfdm/contrib/qa/sync/utils.py,sha256=582wwGFRRqBxq_H45sTPe0GqnWemy9uU1cYDqQ3BtKs,11249
118
+ wbfdm/contrib/qa/sync/utils.py,sha256=8bJoKrTqosOofVLu5fBtHTLw4df86wgD2illJeUmbZM,11516
119
119
  wbfdm/dataloaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
120
  wbfdm/dataloaders/cache.py,sha256=K9BeVxT7p-BMvjurINt18bfrUDccp840uIjfDBLJRNk,4841
121
121
  wbfdm/dataloaders/protocols.py,sha256=xFbexmhh38MWmkWsOSsfcNxdtrrWfO02qNihsqwA_BQ,2987
@@ -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.1.dist-info/METADATA,sha256=e2wOs7aetxDqk3GTccii_Wl2IPw7wvO4iK_c2p5dieo,768
362
- wbfdm-1.52.1.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
363
- wbfdm-1.52.1.dist-info/RECORD,,
361
+ wbfdm-1.52.2rc0.dist-info/METADATA,sha256=nX7LfncMTg8XEMrlSR-m3-TpNr0_6eUzt0CO5xvIzX0,771
362
+ wbfdm-1.52.2rc0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
363
+ wbfdm-1.52.2rc0.dist-info/RECORD,,