wbfdm 1.54.22__py2.py3-none-any.whl → 1.55.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/statements.py +9 -2
- wbfdm/factories/instruments.py +2 -2
- wbfdm/models/instruments/querysets.py +4 -5
- {wbfdm-1.54.22.dist-info → wbfdm-1.55.0.dist-info}/METADATA +1 -1
- {wbfdm-1.54.22.dist-info → wbfdm-1.55.0.dist-info}/RECORD +6 -6
- {wbfdm-1.54.22.dist-info → wbfdm-1.55.0.dist-info}/WHEEL +0 -0
|
@@ -239,6 +239,9 @@ class RKDStatementsDataloader(StatementsProtocol, Dataloader):
|
|
|
239
239
|
) -> Iterator[StatementDataDict]:
|
|
240
240
|
lookup = {k: v for k, v in self.entities.values_list("dl_parameters__statements__parameters", "id")}
|
|
241
241
|
sql = reported_sql if data_type is DataType.REPORTED else standardized_sql
|
|
242
|
+
if financials is None:
|
|
243
|
+
financials = []
|
|
244
|
+
external_codes = [RKDFinancial[fin.name].value for fin in financials if fin in RKDFinancial]
|
|
242
245
|
query, bind_params = JinjaSql(param_style="format").prepare_query(
|
|
243
246
|
sql,
|
|
244
247
|
{
|
|
@@ -249,7 +252,7 @@ class RKDStatementsDataloader(StatementsProtocol, Dataloader):
|
|
|
249
252
|
"from_date": from_date,
|
|
250
253
|
"to_date": to_date,
|
|
251
254
|
"period_type": period_type.value,
|
|
252
|
-
"external_codes":
|
|
255
|
+
"external_codes": external_codes,
|
|
253
256
|
},
|
|
254
257
|
)
|
|
255
258
|
with connections["qa"].cursor() as cursor:
|
|
@@ -263,6 +266,10 @@ class RKDStatementsDataloader(StatementsProtocol, Dataloader):
|
|
|
263
266
|
# sometime we get None for the year. We default to the period end date year then
|
|
264
267
|
row["year"] = int(row["year"] or row["period_end_date"].year)
|
|
265
268
|
row["instrument_id"] = lookup[row["external_identifier"]]
|
|
269
|
+
|
|
266
270
|
if financials:
|
|
267
|
-
|
|
271
|
+
try:
|
|
272
|
+
row["financial"] = Financial[RKDFinancial(row["external_code"]).name].value
|
|
273
|
+
except (ValueError, KeyError):
|
|
274
|
+
continue
|
|
268
275
|
yield row
|
wbfdm/factories/instruments.py
CHANGED
|
@@ -21,7 +21,7 @@ class InstrumentFactory(factory.django.DjangoModelFactory):
|
|
|
21
21
|
instrument_type = factory.SubFactory(InstrumentTypeFactory)
|
|
22
22
|
inception_date = factory.Faker("past_date")
|
|
23
23
|
delisted_date = None
|
|
24
|
-
currency = factory.SubFactory("wbcore.contrib.currency.factories.
|
|
24
|
+
currency = factory.SubFactory("wbcore.contrib.currency.factories.CurrencyUSDFactory")
|
|
25
25
|
country = factory.SubFactory("wbcore.contrib.geography.factories.CountryFactory")
|
|
26
26
|
exchange = factory.SubFactory("wbfdm.factories.exchanges.ExchangeFactory")
|
|
27
27
|
|
|
@@ -54,7 +54,7 @@ class InstrumentFactory(factory.django.DjangoModelFactory):
|
|
|
54
54
|
|
|
55
55
|
class CashFactory(factory.django.DjangoModelFactory):
|
|
56
56
|
is_cash = True
|
|
57
|
-
currency = factory.SubFactory("wbcore.contrib.currency.factories.
|
|
57
|
+
currency = factory.SubFactory("wbcore.contrib.currency.factories.CurrencyUSDFactory")
|
|
58
58
|
name = factory.LazyAttribute(lambda o: o.currency.title)
|
|
59
59
|
instrument_type = factory.LazyAttribute(
|
|
60
60
|
lambda o: InstrumentType.objects.get_or_create(key="cash", defaults={"name": "Cash", "short_name": "Cash"})[0]
|
|
@@ -200,7 +200,7 @@ class InstrumentQuerySet(QuerySet):
|
|
|
200
200
|
padded_from_date = from_date - timedelta(days=15)
|
|
201
201
|
padded_to_date = to_date + timedelta(days=3)
|
|
202
202
|
logger.info(
|
|
203
|
-
f"Loading returns from {from_date:%Y-%m-%d} (padded to {padded_from_date:%Y-%m-%d}) to {to_date:%Y-%m-%d} (padded to {padded_to_date:%Y-%m-%d})"
|
|
203
|
+
f"Loading returns from {from_date:%Y-%m-%d} (padded to {padded_from_date:%Y-%m-%d}) to {to_date:%Y-%m-%d} (padded to {padded_to_date:%Y-%m-%d}) for {self.count()} instruments"
|
|
204
204
|
)
|
|
205
205
|
|
|
206
206
|
if use_dl:
|
|
@@ -248,13 +248,12 @@ class InstrumentQuerySet(QuerySet):
|
|
|
248
248
|
(df.index <= pd.Timestamp(to_date)) & (df.index >= pd.Timestamp(from_date))
|
|
249
249
|
] # ensure the returned df corresponds to requested date range
|
|
250
250
|
prices_df = df["close"]
|
|
251
|
-
|
|
252
251
|
if "fx_rate" in df.columns:
|
|
253
252
|
fx_rate_df = df["fx_rate"].fillna(1.0)
|
|
254
253
|
else:
|
|
255
254
|
fx_rate_df = pd.DataFrame(np.ones(prices_df.shape), index=prices_df.index, columns=prices_df.columns)
|
|
256
255
|
returns = prices_to_returns(fx_rate_df * prices_df, drop_inceptions_nan=False, fill_nan=True)
|
|
257
|
-
return {
|
|
258
|
-
|
|
259
|
-
)
|
|
256
|
+
return {
|
|
257
|
+
ts.date(): row for ts, row in prices_df.replace([np.nan], None).to_dict("index").items()
|
|
258
|
+
}, returns.replace([np.inf, -np.inf, np.nan], 0)
|
|
260
259
|
return {}, pd.DataFrame()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wbfdm
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.55.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.*
|
|
@@ -103,7 +103,7 @@ wbfdm/contrib/qa/dataloaders/financials.py,sha256=xUHpvhUkvmdPL_RyWCrs7XgChgTklX
|
|
|
103
103
|
wbfdm/contrib/qa/dataloaders/market_data.py,sha256=_B_QgoA_TAUK3KkHYsi1FM-K265wqiDCU-3ztA4mpiM,8374
|
|
104
104
|
wbfdm/contrib/qa/dataloaders/officers.py,sha256=vytlQJJxmn4Y5HfNh5mHJAvuIrrsQSkNO-sONyhxftY,2940
|
|
105
105
|
wbfdm/contrib/qa/dataloaders/reporting_dates.py,sha256=q25ccB0pbGfLJLV1A1_AY1XYWJ_Fa10egY09L1J-C5A,2628
|
|
106
|
-
wbfdm/contrib/qa/dataloaders/statements.py,sha256=
|
|
106
|
+
wbfdm/contrib/qa/dataloaders/statements.py,sha256=nLD4SQYb2g4Sm04NiIepNwJ6Q28m2_nzzdRX-zO1li8,10324
|
|
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
|
|
109
109
|
wbfdm/contrib/qa/jinja2/qa/sql/instruments.sql,sha256=7p31aJDtKusfSzhrjyUo8FlmbPXNyffWtNclm8DZkFM,3863
|
|
@@ -127,7 +127,7 @@ wbfdm/factories/controversies.py,sha256=GhuoEms1O7DIMVNAIbFEzD9DRv8j1MXIv0u1JK6P
|
|
|
127
127
|
wbfdm/factories/exchanges.py,sha256=heJHQE59dCDFeDuScJJti4C_SsMsz3O0kmczpGYVNlQ,831
|
|
128
128
|
wbfdm/factories/instrument_list.py,sha256=ypnrTLCl0XRfGj6y-3XJSQ2Wl5TULxZU0I3nF6svH3Y,743
|
|
129
129
|
wbfdm/factories/instrument_prices.py,sha256=EjRFbMjP3pLrxoNsNqNo37FGjayIiV99bkQPVgZLj4I,3623
|
|
130
|
-
wbfdm/factories/instruments.py,sha256=
|
|
130
|
+
wbfdm/factories/instruments.py,sha256=sJqHNA6Cs-NNm9RQrCimUVjKTrJS-ajjpTP4taPRTqA,2558
|
|
131
131
|
wbfdm/factories/instruments_relationships.py,sha256=opGQMM3sHQV5F04nGPCCsRw8ux8vSQ78tHNJjIDPyUE,1138
|
|
132
132
|
wbfdm/factories/options.py,sha256=nna8LgB_2-XNGm37--Edkdv1oc49oeKtr7f8tcIJPU4,2463
|
|
133
133
|
wbfdm/figures/__init__.py,sha256=PDF_OWeTocmJIQozLxj_OjDUeUG7OYzcS2DLpe-ECEA,49
|
|
@@ -241,7 +241,7 @@ wbfdm/models/instruments/instrument_requests.py,sha256=XbpofRS8WHadHlTFjvXJyd0o7
|
|
|
241
241
|
wbfdm/models/instruments/instruments.py,sha256=Tn9vIu0kys8pVVBiO58Z0Z5fAv0KWzkp4L4kjm7oh3c,44485
|
|
242
242
|
wbfdm/models/instruments/options.py,sha256=hFprq7B5t4ctz8nVqzFsBEzftq_KDUSsSXl1zJyh7tE,7094
|
|
243
243
|
wbfdm/models/instruments/private_equities.py,sha256=uzwZi8IkmCKAHVTxnuFya9tehx7kh57sTlTEi1ieDaM,2198
|
|
244
|
-
wbfdm/models/instruments/querysets.py,sha256=
|
|
244
|
+
wbfdm/models/instruments/querysets.py,sha256=7r3pXNlpROkYgKc6gQH07RNeWX6jGeBAPUabUevE6Jo,11587
|
|
245
245
|
wbfdm/models/instruments/utils.py,sha256=88jnWINSSC0OwH-mCEOPLZXuhBCtEsxBpSaZ38GteaE,1365
|
|
246
246
|
wbfdm/models/instruments/llm/__init__.py,sha256=dSmxRmEWb0A4O_lUoWuRKt2mBtUuLCTPVVJqGyi_n40,52
|
|
247
247
|
wbfdm/models/instruments/llm/create_instrument_news_relationships.py,sha256=f9MT-8cWYlexUfCkaOJa9erI9RaUNI-nqCEyf2tDkbA,3809
|
|
@@ -360,6 +360,6 @@ wbfdm/viewsets/statements/__init__.py,sha256=odxtFYUDICPmz8WCE3nx93EvKZLSPBEI4d7
|
|
|
360
360
|
wbfdm/viewsets/statements/statements.py,sha256=gA6RCI8-B__JwjEb6OZxpn8Y-9aF-YQ3HIQ7e1vfJMw,4304
|
|
361
361
|
wbfdm/viewsets/technical_analysis/__init__.py,sha256=qtCIBg0uSiZeJq_1tEQFilnorMBkMe6uCMfqar6-cLE,77
|
|
362
362
|
wbfdm/viewsets/technical_analysis/monthly_performances.py,sha256=O1j8CGfOranL74LqVvcf7jERaDIboEJZiBf_AbbVDQ8,3974
|
|
363
|
-
wbfdm-1.
|
|
364
|
-
wbfdm-1.
|
|
365
|
-
wbfdm-1.
|
|
363
|
+
wbfdm-1.55.0.dist-info/METADATA,sha256=ezMUXfqfuEKhqzOZLVtgz3HGTyHVsOpcN6MRs2vEi-s,768
|
|
364
|
+
wbfdm-1.55.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
|
365
|
+
wbfdm-1.55.0.dist-info/RECORD,,
|
|
File without changes
|