wbfdm 1.54.11__py2.py3-none-any.whl → 1.54.12__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 @@ from datetime import date
|
|
|
2
2
|
from decimal import Decimal
|
|
3
3
|
from typing import Iterator
|
|
4
4
|
|
|
5
|
-
from django.db.models import Value
|
|
5
|
+
from django.db.models import Case, Value, When
|
|
6
6
|
from django.db.models.functions import Coalesce
|
|
7
7
|
from wbcore.contrib.currency.models import Currency, CurrencyFXRates
|
|
8
8
|
from wbcore.contrib.dataloader.dataloaders import Dataloader
|
|
@@ -56,6 +56,10 @@ class MarketDataDataloader(MarketDataProtocol, Dataloader):
|
|
|
56
56
|
Returns:
|
|
57
57
|
Iterator[MarketDataDict]: An iterator of dictionaries conforming to the DailyValuationDict.
|
|
58
58
|
"""
|
|
59
|
+
if not values:
|
|
60
|
+
values = DEFAULT_VALUES
|
|
61
|
+
values_map = {value.name: MarketDataMap[value.name] for value in values if value.name in MarketDataMap}
|
|
62
|
+
calculated = kwargs.get("calculated", None)
|
|
59
63
|
try:
|
|
60
64
|
target_currency = Currency.objects.get(key=target_currency)
|
|
61
65
|
except Currency.DoesNotExist:
|
|
@@ -71,21 +75,12 @@ class MarketDataDataloader(MarketDataProtocol, Dataloader):
|
|
|
71
75
|
else Value(Decimal("1"))
|
|
72
76
|
)
|
|
73
77
|
|
|
74
|
-
prices = (
|
|
75
|
-
InstrumentPrice.objects.filter(instrument__in=self.entities)
|
|
76
|
-
.annotate_market_data()
|
|
77
|
-
.annotate(fx_rate=fx_rate)
|
|
78
|
-
) # type: ignore
|
|
79
|
-
calculated = kwargs.get("calculated", None)
|
|
78
|
+
prices = InstrumentPrice.objects.filter(instrument__in=self.entities)
|
|
80
79
|
if calculated is not None:
|
|
81
80
|
prices = prices.filter(calculated=calculated)
|
|
82
81
|
else:
|
|
83
82
|
prices = prices.filter_only_valid_prices()
|
|
84
83
|
|
|
85
|
-
prices = prices.order_by("date")
|
|
86
|
-
if not values:
|
|
87
|
-
values = DEFAULT_VALUES
|
|
88
|
-
values_map = {value.name: MarketDataMap[value.name] for value in values if value.name in MarketDataMap}
|
|
89
84
|
if exact_date:
|
|
90
85
|
prices = prices.filter(date=exact_date)
|
|
91
86
|
else:
|
|
@@ -93,7 +88,11 @@ class MarketDataDataloader(MarketDataProtocol, Dataloader):
|
|
|
93
88
|
prices = prices.filter(date__gte=from_date)
|
|
94
89
|
if to_date:
|
|
95
90
|
prices = prices.filter(date__lte=to_date)
|
|
96
|
-
|
|
91
|
+
prices = prices.annotate_market_data().annotate(
|
|
92
|
+
fx_rate=Case(When(calculated=False, then=fx_rate), default=None)
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
for row in prices.order_by("date").values(
|
|
97
96
|
"date",
|
|
98
97
|
"instrument",
|
|
99
98
|
"calculated",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wbfdm
|
|
3
|
-
Version: 1.54.
|
|
3
|
+
Version: 1.54.12
|
|
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.*
|
|
@@ -41,7 +41,7 @@ wbfdm/contrib/dsws/client.py,sha256=C598w5P85kvX7_gR0Yf-WHRLj77HqztUhofBMl3JWAE,
|
|
|
41
41
|
wbfdm/contrib/dsws/dataloaders/market_data.py,sha256=HyTP35Pf4mhhKxEwbyrlJHftTyzNBPUUQeiKArCdhQk,7486
|
|
42
42
|
wbfdm/contrib/internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
43
|
wbfdm/contrib/internal/dataloaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
-
wbfdm/contrib/internal/dataloaders/market_data.py,sha256=
|
|
44
|
+
wbfdm/contrib/internal/dataloaders/market_data.py,sha256=UYV9AlIDeow56zi_5rUWJ1qXMvWaqHLlriM2kEnuZ5U,4533
|
|
45
45
|
wbfdm/contrib/metric/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
46
|
wbfdm/contrib/metric/apps.py,sha256=T-Na_lyFeLR8ebGvaW-mcjKFLqiZcsPXnUlOuVPOiWw,297
|
|
47
47
|
wbfdm/contrib/metric/decorators.py,sha256=VPmyjEJaq5HqXOt_ZizqcXfRqSEXw4lanDmubUjb2GY,476
|
|
@@ -359,6 +359,6 @@ wbfdm/viewsets/statements/__init__.py,sha256=odxtFYUDICPmz8WCE3nx93EvKZLSPBEI4d7
|
|
|
359
359
|
wbfdm/viewsets/statements/statements.py,sha256=gA6RCI8-B__JwjEb6OZxpn8Y-9aF-YQ3HIQ7e1vfJMw,4304
|
|
360
360
|
wbfdm/viewsets/technical_analysis/__init__.py,sha256=qtCIBg0uSiZeJq_1tEQFilnorMBkMe6uCMfqar6-cLE,77
|
|
361
361
|
wbfdm/viewsets/technical_analysis/monthly_performances.py,sha256=O1j8CGfOranL74LqVvcf7jERaDIboEJZiBf_AbbVDQ8,3974
|
|
362
|
-
wbfdm-1.54.
|
|
363
|
-
wbfdm-1.54.
|
|
364
|
-
wbfdm-1.54.
|
|
362
|
+
wbfdm-1.54.12.dist-info/METADATA,sha256=RwX1BuWmAf36HWPhGq5COO1PUPjuBnLZlcsSNwoO7Xs,769
|
|
363
|
+
wbfdm-1.54.12.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
|
364
|
+
wbfdm-1.54.12.dist-info/RECORD,,
|
|
File without changes
|