wbfdm 1.46.13__py2.py3-none-any.whl → 1.47.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/contrib/qa/dataloaders/reporting_dates.py +17 -16
- wbfdm/models/instruments/querysets.py +16 -20
- wbfdm/serializers/instruments/instruments.py +7 -2
- wbfdm/viewsets/configs/display/instruments.py +19 -30
- {wbfdm-1.46.13.dist-info → wbfdm-1.47.0.dist-info}/METADATA +1 -1
- {wbfdm-1.46.13.dist-info → wbfdm-1.47.0.dist-info}/RECORD +7 -7
- {wbfdm-1.46.13.dist-info → wbfdm-1.47.0.dist-info}/WHEEL +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from itertools import batched
|
|
1
2
|
from typing import Iterator
|
|
2
3
|
|
|
3
4
|
from django.db import connections
|
|
@@ -49,20 +50,20 @@ class IbesReportingDateDataloader(ReportDateProtocol, Dataloader):
|
|
|
49
50
|
AND rp.rn = 1
|
|
50
51
|
{% endif %}
|
|
51
52
|
"""
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
60
|
-
with connections["qa"].cursor() as cursor:
|
|
61
|
-
cursor.execute(
|
|
62
|
-
query,
|
|
63
|
-
bind_params,
|
|
53
|
+
for batch in batched(lookup.keys(), 500):
|
|
54
|
+
query, bind_params = JinjaSql(param_style="format").prepare_query(
|
|
55
|
+
sql,
|
|
56
|
+
{
|
|
57
|
+
"instruments": batch,
|
|
58
|
+
"only_next": only_next,
|
|
59
|
+
},
|
|
64
60
|
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
with connections["qa"].cursor() as cursor:
|
|
62
|
+
cursor.execute(
|
|
63
|
+
query,
|
|
64
|
+
bind_params,
|
|
65
|
+
)
|
|
66
|
+
for row in dictfetchall(cursor):
|
|
67
|
+
row["instrument_id"] = lookup[row["external_id"]]
|
|
68
|
+
row["interim"] = bool(row["interim"])
|
|
69
|
+
yield row
|
|
@@ -128,28 +128,24 @@ class InstrumentQuerySet(QuerySet):
|
|
|
128
128
|
)
|
|
129
129
|
if not df.empty:
|
|
130
130
|
df["valuation_date"] = pd.to_datetime(df["valuation_date"])
|
|
131
|
-
df = df.rename(columns={"valuation_date": "date"})
|
|
132
|
-
df = df.drop(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
df.index.levels[0],
|
|
137
|
-
pd.date_range(
|
|
138
|
-
df.index.get_level_values("date").min(), df.index.get_level_values("date").max(), freq="B"
|
|
139
|
-
),
|
|
140
|
-
],
|
|
141
|
-
names=["instrument_id", "date"],
|
|
131
|
+
df = df.rename(columns={"valuation_date": "date"})
|
|
132
|
+
df = df.drop(
|
|
133
|
+
columns=df.columns.difference(
|
|
134
|
+
["calculated", "close", "market_capitalization", "volume", "instrument_id", "date"]
|
|
135
|
+
)
|
|
142
136
|
)
|
|
143
|
-
df =
|
|
144
|
-
df[["close", "market_capitalization"]] = df[["close", "market_capitalization"]].astype(float).ffill()
|
|
145
|
-
df.volume = df.volume.astype(float).fillna(0)
|
|
146
|
-
df.calculated = df.calculated.astype(bool).fillna(
|
|
147
|
-
True
|
|
148
|
-
) # we do not ffill calculated but set the to True to mark them as "estimated"/"not real"
|
|
149
|
-
df = df.reset_index("date").dropna(subset=["close"])
|
|
150
|
-
df = df.replace([np.inf, -np.inf, np.nan], None)
|
|
137
|
+
df["calculated"] = False
|
|
151
138
|
|
|
152
|
-
for instrument_id, dff in df.groupby(
|
|
139
|
+
for instrument_id, dff in df.groupby("instrument_id", group_keys=False, as_index=False):
|
|
140
|
+
dff = dff.drop(columns=["instrument_id"]).set_index("date").sort_index()
|
|
141
|
+
dff = dff.reindex(pd.date_range(dff.index.min(), dff.index.max(), freq="B"))
|
|
142
|
+
dff[["close", "market_capitalization"]] = dff[["close", "market_capitalization"]].astype(float).ffill()
|
|
143
|
+
dff.volume = dff.volume.astype(float).fillna(0)
|
|
144
|
+
dff.calculated = dff.calculated.astype(bool).fillna(
|
|
145
|
+
True
|
|
146
|
+
) # we do not ffill calculated but set the to True to mark them as "estimated"/"not real"
|
|
147
|
+
dff = dff.reset_index(names="date").dropna(subset=["close"])
|
|
148
|
+
dff = dff.replace([np.inf, -np.inf, np.nan], None)
|
|
153
149
|
instrument = self.get(id=instrument_id)
|
|
154
150
|
yield from filter(
|
|
155
151
|
lambda x: x, map(lambda row: _dict_to_object(instrument, row), dff.to_dict("records"))
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from typing import TYPE_CHECKING, Type
|
|
2
2
|
|
|
3
3
|
from django.contrib.auth import get_user_model
|
|
4
|
+
from django.contrib.contenttypes.models import ContentType
|
|
4
5
|
from rest_framework.reverse import reverse
|
|
5
6
|
from wbcore import serializers
|
|
6
7
|
from wbcore.contrib.currency.models import Currency
|
|
@@ -248,8 +249,12 @@ class InstrumentModelSerializer(InstrumentAdditionalResourcesMixin, InstrumentMo
|
|
|
248
249
|
return res
|
|
249
250
|
|
|
250
251
|
@serializers.register_only_instance_resource()
|
|
251
|
-
def
|
|
252
|
-
|
|
252
|
+
def instance_resource(self, instance, request, user, **kwargs):
|
|
253
|
+
content_type = ContentType.objects.get_for_model(instance)
|
|
254
|
+
return {
|
|
255
|
+
"children": reverse("wbfdm:instrument-children-list", args=[instance.id], request=request),
|
|
256
|
+
"news": f'{reverse("wbnews:newsrelationship-list", args=[], request=request)}?content_type={content_type.id}&object_id={instance.id}',
|
|
257
|
+
}
|
|
253
258
|
|
|
254
259
|
@serializers.register_resource()
|
|
255
260
|
def register_market_data(self, instance, request, user, **kwargs):
|
|
@@ -6,7 +6,6 @@ from dynamic_preferences.registries import global_preferences_registry
|
|
|
6
6
|
from rest_framework.reverse import reverse
|
|
7
7
|
from wbcore.metadata.configs import display as dp
|
|
8
8
|
from wbcore.metadata.configs.display import DisplayViewConfig
|
|
9
|
-
from wbcore.metadata.configs.display.instance_display import Section
|
|
10
9
|
from wbcore.metadata.configs.display.instance_display.layouts.inlines import Inline
|
|
11
10
|
from wbcore.metadata.configs.display.instance_display.layouts.layouts import Layout
|
|
12
11
|
from wbcore.metadata.configs.display.instance_display.pages import Page
|
|
@@ -329,39 +328,29 @@ class InstrumentDisplayConfig(DisplayViewConfig):
|
|
|
329
328
|
},
|
|
330
329
|
),
|
|
331
330
|
Page(
|
|
332
|
-
title="Hierarchy",
|
|
331
|
+
title=_("Hierarchy"),
|
|
333
332
|
layouts={
|
|
334
333
|
default(): Layout(
|
|
335
|
-
grid_template_areas=[
|
|
336
|
-
|
|
334
|
+
grid_template_areas=[["children"]],
|
|
335
|
+
inlines=[Inline(key="children", endpoint="children")],
|
|
336
|
+
grid_template_columns=[
|
|
337
|
+
"minmax(min-content, 1fr)",
|
|
337
338
|
],
|
|
338
|
-
grid_template_rows=["
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
inlines=[
|
|
351
|
-
Inline(
|
|
352
|
-
key="children",
|
|
353
|
-
endpoint="children",
|
|
354
|
-
)
|
|
355
|
-
],
|
|
356
|
-
)
|
|
357
|
-
}
|
|
358
|
-
)
|
|
359
|
-
]
|
|
360
|
-
),
|
|
361
|
-
collapsed=False,
|
|
362
|
-
)
|
|
339
|
+
grid_template_rows=["1fr"],
|
|
340
|
+
),
|
|
341
|
+
},
|
|
342
|
+
),
|
|
343
|
+
Page(
|
|
344
|
+
title=_("News"),
|
|
345
|
+
layouts={
|
|
346
|
+
default(): Layout(
|
|
347
|
+
grid_template_areas=[["news"]],
|
|
348
|
+
inlines=[Inline(key="news", endpoint="news")],
|
|
349
|
+
grid_template_columns=[
|
|
350
|
+
"minmax(min-content, 1fr)",
|
|
363
351
|
],
|
|
364
|
-
|
|
352
|
+
grid_template_rows=["1fr"],
|
|
353
|
+
),
|
|
365
354
|
},
|
|
366
355
|
),
|
|
367
356
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wbfdm
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.47.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.*
|
|
@@ -102,7 +102,7 @@ wbfdm/contrib/qa/dataloaders/corporate_actions.py,sha256=lWT6klrTXKqxiko2HGrxHH8
|
|
|
102
102
|
wbfdm/contrib/qa/dataloaders/financials.py,sha256=xUHpvhUkvmdPL_RyWCrs7XgChgTklX5qemmaXMedgkY,3475
|
|
103
103
|
wbfdm/contrib/qa/dataloaders/market_data.py,sha256=M8l5Eadibe0BbABifcGW-T5S0fOE7O2E_7M8EvhYTso,6508
|
|
104
104
|
wbfdm/contrib/qa/dataloaders/officers.py,sha256=vytlQJJxmn4Y5HfNh5mHJAvuIrrsQSkNO-sONyhxftY,2940
|
|
105
|
-
wbfdm/contrib/qa/dataloaders/reporting_dates.py,sha256=
|
|
105
|
+
wbfdm/contrib/qa/dataloaders/reporting_dates.py,sha256=q25ccB0pbGfLJLV1A1_AY1XYWJ_Fa10egY09L1J-C5A,2628
|
|
106
106
|
wbfdm/contrib/qa/dataloaders/statements.py,sha256=hC6YErJcvBTmaAmzscgeC4sBK3lYE2U5eIKRIE9b_cs,10094
|
|
107
107
|
wbfdm/contrib/qa/dataloaders/utils.py,sha256=E0qav459E7razVOvHKVt9ld_gteJ6eQ2oR4xN-CIOns,2941
|
|
108
108
|
wbfdm/contrib/qa/jinja2/qa/sql/companies.sql,sha256=RzTkfVjBVOgyirgKxp2rnJdjsKl8d3YM-d2qdjHx9cw,3801
|
|
@@ -234,7 +234,7 @@ wbfdm/models/instruments/instrument_requests.py,sha256=wC07CEqQxMGfrnATyr56T6GWx
|
|
|
234
234
|
wbfdm/models/instruments/instruments.py,sha256=V0bBgDxeEXtuu5uUBd15g4FIPAboAC53WN-FMt35qxg,39475
|
|
235
235
|
wbfdm/models/instruments/options.py,sha256=hFprq7B5t4ctz8nVqzFsBEzftq_KDUSsSXl1zJyh7tE,7094
|
|
236
236
|
wbfdm/models/instruments/private_equities.py,sha256=uzwZi8IkmCKAHVTxnuFya9tehx7kh57sTlTEi1ieDaM,2198
|
|
237
|
-
wbfdm/models/instruments/querysets.py,sha256=
|
|
237
|
+
wbfdm/models/instruments/querysets.py,sha256=c5Op5VxR0A0uRPGHmnLJ6b7d2X5Kb5IX5bnk7MUfTjA,6475
|
|
238
238
|
wbfdm/models/instruments/utils.py,sha256=88jnWINSSC0OwH-mCEOPLZXuhBCtEsxBpSaZ38GteaE,1365
|
|
239
239
|
wbfdm/models/instruments/llm/__init__.py,sha256=dSmxRmEWb0A4O_lUoWuRKt2mBtUuLCTPVVJqGyi_n40,52
|
|
240
240
|
wbfdm/models/instruments/llm/create_instrument_news_relationships.py,sha256=Eza39rlkNJxpURroIsJLImKC6F-KtTmkdjHn1kv4F3Q,3439
|
|
@@ -252,7 +252,7 @@ wbfdm/serializers/instruments/instrument_lists.py,sha256=M9RnH-Iy095m5xgkVcPHfvK
|
|
|
252
252
|
wbfdm/serializers/instruments/instrument_prices.py,sha256=de-IlwUJC6gSYVztuTmOXQK3r-Gjn8tVWaSCx0PXh_Q,2593
|
|
253
253
|
wbfdm/serializers/instruments/instrument_relationships.py,sha256=3hChFzdekoPtMYolEhWafcb9nTLPmx6WGEq_Hgck8jA,6454
|
|
254
254
|
wbfdm/serializers/instruments/instrument_requests.py,sha256=Sl4gfkUu63zk4o2iGFVE59wx1rKkLUG6SPYCE7Dqrs4,2176
|
|
255
|
-
wbfdm/serializers/instruments/instruments.py,sha256=
|
|
255
|
+
wbfdm/serializers/instruments/instruments.py,sha256=EX2T2fqYN1l8lzbgyl0cxFs2bDIf0ydGRAVWkB5ISzU,11831
|
|
256
256
|
wbfdm/serializers/instruments/mixins.py,sha256=kxvjgi6zgAeIDkryDm3x3VYtiwP-rk4mcI825RsVXWM,4394
|
|
257
257
|
wbfdm/sync/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
258
258
|
wbfdm/sync/abstract.py,sha256=u1zjHT0ZJabUZpy3_EUCTtEig0p5Fuhlx69O9BsV_Gs,849
|
|
@@ -297,7 +297,7 @@ wbfdm/viewsets/configs/display/financial_summary.py,sha256=K8CPV9uy0wsK-yLQIDTqM
|
|
|
297
297
|
wbfdm/viewsets/configs/display/instrument_lists.py,sha256=b0dq6py5Cn-_lONc1KXLoZydJ-LgOGpkB23QbLeQYBI,5124
|
|
298
298
|
wbfdm/viewsets/configs/display/instrument_prices.py,sha256=QWDIPxWfgJjqHNB0cEShw1jH7zRkIYhJK9jhTE983EA,6940
|
|
299
299
|
wbfdm/viewsets/configs/display/instrument_requests.py,sha256=CarX1MGe64roHZETm2N4HsEMssHVI5mWw2xTUBjgi-k,5129
|
|
300
|
-
wbfdm/viewsets/configs/display/instruments.py,sha256=
|
|
300
|
+
wbfdm/viewsets/configs/display/instruments.py,sha256=RxW7fsfnmVdJqrqENflTIcOLuXABAYUbbedzTI7Jkdg,17418
|
|
301
301
|
wbfdm/viewsets/configs/display/instruments_relationships.py,sha256=BLAl2ZciWR5Waf3qPd1QQwdiupgIf_wGK6rmYe9byuY,2480
|
|
302
302
|
wbfdm/viewsets/configs/display/monthly_performances.py,sha256=ESsGTLhPmmXz3YjEWNjwaOjA1RNzVDKtJt3JILL2MMc,2973
|
|
303
303
|
wbfdm/viewsets/configs/display/officers.py,sha256=qUwN9HPSSlT85aUSFNY-30550P35j3RZCYqRPj_rFAs,654
|
|
@@ -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.
|
|
356
|
-
wbfdm-1.
|
|
357
|
-
wbfdm-1.
|
|
355
|
+
wbfdm-1.47.0.dist-info/METADATA,sha256=WynOeJW5JrmdmgNFbVqmWagCK878bGa8d-Myf5KQt3w,737
|
|
356
|
+
wbfdm-1.47.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
|
357
|
+
wbfdm-1.47.0.dist-info/RECORD,,
|
|
File without changes
|