wbfdm 2.2.1__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/__init__.py +2 -0
- wbfdm/admin/__init__.py +42 -0
- wbfdm/admin/classifications.py +39 -0
- wbfdm/admin/esg.py +23 -0
- wbfdm/admin/exchanges.py +53 -0
- wbfdm/admin/instrument_lists.py +23 -0
- wbfdm/admin/instrument_prices.py +62 -0
- wbfdm/admin/instrument_requests.py +33 -0
- wbfdm/admin/instruments.py +117 -0
- wbfdm/admin/instruments_relationships.py +25 -0
- wbfdm/admin/options.py +101 -0
- wbfdm/analysis/__init__.py +2 -0
- wbfdm/analysis/esg/__init__.py +0 -0
- wbfdm/analysis/esg/enums.py +82 -0
- wbfdm/analysis/esg/esg_analysis.py +217 -0
- wbfdm/analysis/esg/utils.py +13 -0
- wbfdm/analysis/financial_analysis/__init__.py +1 -0
- wbfdm/analysis/financial_analysis/financial_metric_analysis.py +88 -0
- wbfdm/analysis/financial_analysis/financial_ratio_analysis.py +125 -0
- wbfdm/analysis/financial_analysis/financial_statistics_analysis.py +271 -0
- wbfdm/analysis/financial_analysis/statement_with_estimates.py +558 -0
- wbfdm/analysis/financial_analysis/utils.py +316 -0
- wbfdm/analysis/technical_analysis/__init__.py +1 -0
- wbfdm/analysis/technical_analysis/technical_analysis.py +138 -0
- wbfdm/analysis/technical_analysis/traces.py +165 -0
- wbfdm/analysis/utils.py +32 -0
- wbfdm/apps.py +14 -0
- wbfdm/contrib/__init__.py +0 -0
- wbfdm/contrib/dsws/__init__.py +0 -0
- wbfdm/contrib/dsws/client.py +285 -0
- wbfdm/contrib/internal/__init__.py +0 -0
- wbfdm/contrib/internal/dataloaders/__init__.py +0 -0
- wbfdm/contrib/internal/dataloaders/market_data.py +87 -0
- wbfdm/contrib/metric/__init__.py +0 -0
- wbfdm/contrib/metric/admin/__init__.py +2 -0
- wbfdm/contrib/metric/admin/instruments.py +12 -0
- wbfdm/contrib/metric/admin/metrics.py +43 -0
- wbfdm/contrib/metric/apps.py +10 -0
- wbfdm/contrib/metric/backends/__init__.py +2 -0
- wbfdm/contrib/metric/backends/base.py +159 -0
- wbfdm/contrib/metric/backends/performances.py +265 -0
- wbfdm/contrib/metric/backends/statistics.py +182 -0
- wbfdm/contrib/metric/decorators.py +14 -0
- wbfdm/contrib/metric/dispatch.py +23 -0
- wbfdm/contrib/metric/dto.py +88 -0
- wbfdm/contrib/metric/exceptions.py +6 -0
- wbfdm/contrib/metric/factories.py +33 -0
- wbfdm/contrib/metric/filters.py +28 -0
- wbfdm/contrib/metric/migrations/0001_initial.py +88 -0
- wbfdm/contrib/metric/migrations/0002_remove_instrumentmetric_unique_instrument_metric_and_more.py +26 -0
- wbfdm/contrib/metric/migrations/__init__.py +0 -0
- wbfdm/contrib/metric/models.py +180 -0
- wbfdm/contrib/metric/orchestrators.py +94 -0
- wbfdm/contrib/metric/registry.py +80 -0
- wbfdm/contrib/metric/serializers.py +44 -0
- wbfdm/contrib/metric/tasks.py +27 -0
- wbfdm/contrib/metric/tests/__init__.py +0 -0
- wbfdm/contrib/metric/tests/backends/__init__.py +0 -0
- wbfdm/contrib/metric/tests/backends/test_performances.py +152 -0
- wbfdm/contrib/metric/tests/backends/test_statistics.py +48 -0
- wbfdm/contrib/metric/tests/conftest.py +92 -0
- wbfdm/contrib/metric/tests/test_dto.py +73 -0
- wbfdm/contrib/metric/tests/test_models.py +72 -0
- wbfdm/contrib/metric/tests/test_tasks.py +24 -0
- wbfdm/contrib/metric/tests/test_viewsets.py +79 -0
- wbfdm/contrib/metric/urls.py +19 -0
- wbfdm/contrib/metric/viewsets/__init__.py +1 -0
- wbfdm/contrib/metric/viewsets/configs/__init__.py +1 -0
- wbfdm/contrib/metric/viewsets/configs/display.py +92 -0
- wbfdm/contrib/metric/viewsets/configs/menus.py +11 -0
- wbfdm/contrib/metric/viewsets/configs/utils.py +137 -0
- wbfdm/contrib/metric/viewsets/mixins.py +245 -0
- wbfdm/contrib/metric/viewsets/viewsets.py +40 -0
- wbfdm/contrib/msci/__init__.py +0 -0
- wbfdm/contrib/msci/client.py +92 -0
- wbfdm/contrib/msci/dataloaders/__init__.py +0 -0
- wbfdm/contrib/msci/dataloaders/esg.py +87 -0
- wbfdm/contrib/msci/dataloaders/esg_controversies.py +81 -0
- wbfdm/contrib/msci/sync.py +58 -0
- wbfdm/contrib/msci/tests/__init__.py +0 -0
- wbfdm/contrib/msci/tests/conftest.py +1 -0
- wbfdm/contrib/msci/tests/test_client.py +70 -0
- wbfdm/contrib/qa/__init__.py +0 -0
- wbfdm/contrib/qa/apps.py +22 -0
- wbfdm/contrib/qa/database_routers.py +25 -0
- wbfdm/contrib/qa/dataloaders/__init__.py +0 -0
- wbfdm/contrib/qa/dataloaders/adjustments.py +56 -0
- wbfdm/contrib/qa/dataloaders/corporate_actions.py +59 -0
- wbfdm/contrib/qa/dataloaders/financials.py +83 -0
- wbfdm/contrib/qa/dataloaders/market_data.py +117 -0
- wbfdm/contrib/qa/dataloaders/officers.py +59 -0
- wbfdm/contrib/qa/dataloaders/reporting_dates.py +67 -0
- wbfdm/contrib/qa/dataloaders/statements.py +267 -0
- wbfdm/contrib/qa/tasks.py +0 -0
- wbfdm/dataloaders/__init__.py +0 -0
- wbfdm/dataloaders/cache.py +129 -0
- wbfdm/dataloaders/protocols.py +112 -0
- wbfdm/dataloaders/proxies.py +201 -0
- wbfdm/dataloaders/types.py +209 -0
- wbfdm/dynamic_preferences_registry.py +45 -0
- wbfdm/enums.py +657 -0
- wbfdm/factories/__init__.py +13 -0
- wbfdm/factories/classifications.py +56 -0
- wbfdm/factories/controversies.py +27 -0
- wbfdm/factories/exchanges.py +21 -0
- wbfdm/factories/instrument_list.py +22 -0
- wbfdm/factories/instrument_prices.py +79 -0
- wbfdm/factories/instruments.py +63 -0
- wbfdm/factories/instruments_relationships.py +31 -0
- wbfdm/factories/options.py +66 -0
- wbfdm/figures/__init__.py +1 -0
- wbfdm/figures/financials/__init__.py +1 -0
- wbfdm/figures/financials/financial_analysis_charts.py +469 -0
- wbfdm/figures/financials/financials_charts.py +711 -0
- wbfdm/filters/__init__.py +31 -0
- wbfdm/filters/classifications.py +100 -0
- wbfdm/filters/exchanges.py +22 -0
- wbfdm/filters/financials.py +95 -0
- wbfdm/filters/financials_analysis.py +119 -0
- wbfdm/filters/instrument_prices.py +112 -0
- wbfdm/filters/instruments.py +198 -0
- wbfdm/filters/utils.py +44 -0
- wbfdm/import_export/__init__.py +0 -0
- wbfdm/import_export/backends/__init__.py +0 -0
- wbfdm/import_export/backends/cbinsights/__init__.py +2 -0
- wbfdm/import_export/backends/cbinsights/deals.py +44 -0
- wbfdm/import_export/backends/cbinsights/equities.py +41 -0
- wbfdm/import_export/backends/cbinsights/mixin.py +15 -0
- wbfdm/import_export/backends/cbinsights/utils/__init__.py +0 -0
- wbfdm/import_export/backends/cbinsights/utils/classifications.py +4150 -0
- wbfdm/import_export/backends/cbinsights/utils/client.py +217 -0
- wbfdm/import_export/backends/refinitiv/__init__.py +5 -0
- wbfdm/import_export/backends/refinitiv/daily_fundamental.py +36 -0
- wbfdm/import_export/backends/refinitiv/fiscal_period.py +63 -0
- wbfdm/import_export/backends/refinitiv/forecast.py +178 -0
- wbfdm/import_export/backends/refinitiv/fundamental.py +103 -0
- wbfdm/import_export/backends/refinitiv/geographic_segment.py +32 -0
- wbfdm/import_export/backends/refinitiv/instrument.py +55 -0
- wbfdm/import_export/backends/refinitiv/instrument_price.py +77 -0
- wbfdm/import_export/backends/refinitiv/mixin.py +29 -0
- wbfdm/import_export/backends/refinitiv/utils/__init__.py +1 -0
- wbfdm/import_export/backends/refinitiv/utils/controller.py +182 -0
- wbfdm/import_export/handlers/__init__.py +0 -0
- wbfdm/import_export/handlers/instrument.py +253 -0
- wbfdm/import_export/handlers/instrument_list.py +101 -0
- wbfdm/import_export/handlers/instrument_price.py +71 -0
- wbfdm/import_export/handlers/option.py +54 -0
- wbfdm/import_export/handlers/private_equities.py +49 -0
- wbfdm/import_export/parsers/__init__.py +0 -0
- wbfdm/import_export/parsers/cbinsights/__init__.py +0 -0
- wbfdm/import_export/parsers/cbinsights/deals.py +39 -0
- wbfdm/import_export/parsers/cbinsights/equities.py +56 -0
- wbfdm/import_export/parsers/cbinsights/fundamentals.py +45 -0
- wbfdm/import_export/parsers/refinitiv/__init__.py +0 -0
- wbfdm/import_export/parsers/refinitiv/daily_fundamental.py +7 -0
- wbfdm/import_export/parsers/refinitiv/forecast.py +7 -0
- wbfdm/import_export/parsers/refinitiv/fundamental.py +9 -0
- wbfdm/import_export/parsers/refinitiv/geographic_segment.py +7 -0
- wbfdm/import_export/parsers/refinitiv/instrument.py +75 -0
- wbfdm/import_export/parsers/refinitiv/instrument_price.py +26 -0
- wbfdm/import_export/parsers/refinitiv/utils.py +96 -0
- wbfdm/import_export/resources/__init__.py +0 -0
- wbfdm/import_export/resources/classification.py +23 -0
- wbfdm/import_export/resources/instrument_prices.py +33 -0
- wbfdm/import_export/resources/instruments.py +176 -0
- wbfdm/jinja2.py +7 -0
- wbfdm/management/__init__.py +30 -0
- wbfdm/menu.py +11 -0
- wbfdm/migrations/0001_initial.py +71 -0
- wbfdm/migrations/0002_rename_statements_instrumentlookup_financials_and_more.py +144 -0
- wbfdm/migrations/0003_instrument_estimate_backend_and_more.py +34 -0
- wbfdm/migrations/0004_rename_financials_instrumentlookup_statements_and_more.py +86 -0
- wbfdm/migrations/0005_instrument_corporate_action_backend.py +29 -0
- wbfdm/migrations/0006_instrument_officer_backend.py +29 -0
- wbfdm/migrations/0007_instrument_country_instrument_currency_and_more.py +117 -0
- wbfdm/migrations/0008_controversy.py +75 -0
- wbfdm/migrations/0009_alter_controversy_flag_alter_controversy_initiated_and_more.py +85 -0
- wbfdm/migrations/0010_classification_classificationgroup_deal_exchange_and_more.py +1299 -0
- wbfdm/migrations/0011_delete_instrumentlookup_instrument_corporate_actions_and_more.py +169 -0
- wbfdm/migrations/0012_instrumentprice_created_instrumentprice_modified.py +564 -0
- wbfdm/migrations/0013_instrument_is_investable_universe_and_more.py +199 -0
- wbfdm/migrations/0014_alter_controversy_instrument.py +22 -0
- wbfdm/migrations/0015_instrument_instrument_investible_index.py +16 -0
- wbfdm/migrations/0016_instrumenttype_name_repr.py +18 -0
- wbfdm/migrations/0017_instrument_instrument_security_index.py +16 -0
- wbfdm/migrations/0018_instrument_instrument_level_index.py +20 -0
- wbfdm/migrations/0019_alter_controversy_source.py +17 -0
- wbfdm/migrations/0020_optionaggregate_option_and_more.py +249 -0
- wbfdm/migrations/0021_delete_instrumentdailystatistics.py +15 -0
- wbfdm/migrations/0022_instrument_cusip_option_open_interest_20d_and_more.py +91 -0
- wbfdm/migrations/0023_instrument_unique_ric_instrument_unique_rmc_and_more.py +53 -0
- wbfdm/migrations/0024_option_open_interest_10d_option_volume_10d_and_more.py +36 -0
- wbfdm/migrations/0025_instrument_is_primary_and_more.py +29 -0
- wbfdm/migrations/0026_instrument_is_cash_equivalent.py +30 -0
- wbfdm/migrations/0027_remove_instrument_unique_ric_and_more.py +100 -0
- wbfdm/migrations/__init__.py +0 -0
- wbfdm/models/__init__.py +4 -0
- wbfdm/models/esg/__init__.py +1 -0
- wbfdm/models/esg/controversies.py +81 -0
- wbfdm/models/exchanges/__init__.py +1 -0
- wbfdm/models/exchanges/exchanges.py +223 -0
- wbfdm/models/fields.py +117 -0
- wbfdm/models/fk_fields.py +403 -0
- wbfdm/models/indicators.py +0 -0
- wbfdm/models/instruments/__init__.py +19 -0
- wbfdm/models/instruments/classifications.py +265 -0
- wbfdm/models/instruments/instrument_lists.py +120 -0
- wbfdm/models/instruments/instrument_prices.py +540 -0
- wbfdm/models/instruments/instrument_relationships.py +251 -0
- wbfdm/models/instruments/instrument_requests.py +196 -0
- wbfdm/models/instruments/instruments.py +991 -0
- wbfdm/models/instruments/llm/__init__.py +1 -0
- wbfdm/models/instruments/llm/create_instrument_news_relationships.py +78 -0
- wbfdm/models/instruments/mixin/__init__.py +0 -0
- wbfdm/models/instruments/mixin/financials_computed.py +804 -0
- wbfdm/models/instruments/mixin/financials_serializer_fields.py +1407 -0
- wbfdm/models/instruments/mixin/instruments.py +294 -0
- wbfdm/models/instruments/options.py +225 -0
- wbfdm/models/instruments/private_equities.py +59 -0
- wbfdm/models/instruments/querysets.py +73 -0
- wbfdm/models/instruments/utils.py +41 -0
- wbfdm/preferences.py +21 -0
- wbfdm/serializers/__init__.py +4 -0
- wbfdm/serializers/esg.py +36 -0
- wbfdm/serializers/exchanges.py +39 -0
- wbfdm/serializers/instruments/__init__.py +37 -0
- wbfdm/serializers/instruments/classifications.py +139 -0
- wbfdm/serializers/instruments/instrument_lists.py +61 -0
- wbfdm/serializers/instruments/instrument_prices.py +73 -0
- wbfdm/serializers/instruments/instrument_relationships.py +170 -0
- wbfdm/serializers/instruments/instrument_requests.py +61 -0
- wbfdm/serializers/instruments/instruments.py +274 -0
- wbfdm/serializers/instruments/mixins.py +104 -0
- wbfdm/serializers/officers.py +20 -0
- wbfdm/signals.py +7 -0
- wbfdm/sync/__init__.py +0 -0
- wbfdm/sync/abstract.py +31 -0
- wbfdm/sync/runner.py +22 -0
- wbfdm/tasks.py +69 -0
- wbfdm/tests/__init__.py +0 -0
- wbfdm/tests/analysis/__init__.py +0 -0
- wbfdm/tests/analysis/financial_analysis/__init__.py +0 -0
- wbfdm/tests/analysis/financial_analysis/test_statement_with_estimates.py +392 -0
- wbfdm/tests/analysis/financial_analysis/test_utils.py +322 -0
- wbfdm/tests/analysis/test_esg.py +159 -0
- wbfdm/tests/conftest.py +92 -0
- wbfdm/tests/dataloaders/__init__.py +0 -0
- wbfdm/tests/dataloaders/test_cache.py +73 -0
- wbfdm/tests/models/__init__.py +0 -0
- wbfdm/tests/models/test_classifications.py +99 -0
- wbfdm/tests/models/test_exchanges.py +7 -0
- wbfdm/tests/models/test_instrument_list.py +117 -0
- wbfdm/tests/models/test_instrument_prices.py +306 -0
- wbfdm/tests/models/test_instruments.py +202 -0
- wbfdm/tests/models/test_merge.py +99 -0
- wbfdm/tests/models/test_options.py +69 -0
- wbfdm/tests/test_tasks.py +6 -0
- wbfdm/tests/tests.py +10 -0
- wbfdm/urls.py +222 -0
- wbfdm/utils.py +54 -0
- wbfdm/viewsets/__init__.py +10 -0
- wbfdm/viewsets/configs/__init__.py +5 -0
- wbfdm/viewsets/configs/buttons/__init__.py +8 -0
- wbfdm/viewsets/configs/buttons/classifications.py +23 -0
- wbfdm/viewsets/configs/buttons/exchanges.py +9 -0
- wbfdm/viewsets/configs/buttons/instrument_prices.py +49 -0
- wbfdm/viewsets/configs/buttons/instruments.py +283 -0
- wbfdm/viewsets/configs/display/__init__.py +22 -0
- wbfdm/viewsets/configs/display/classifications.py +138 -0
- wbfdm/viewsets/configs/display/esg.py +75 -0
- wbfdm/viewsets/configs/display/exchanges.py +42 -0
- wbfdm/viewsets/configs/display/instrument_lists.py +137 -0
- wbfdm/viewsets/configs/display/instrument_prices.py +199 -0
- wbfdm/viewsets/configs/display/instrument_requests.py +116 -0
- wbfdm/viewsets/configs/display/instruments.py +618 -0
- wbfdm/viewsets/configs/display/instruments_relationships.py +65 -0
- wbfdm/viewsets/configs/display/monthly_performances.py +72 -0
- wbfdm/viewsets/configs/display/officers.py +16 -0
- wbfdm/viewsets/configs/display/prices.py +21 -0
- wbfdm/viewsets/configs/display/statement_with_estimates.py +101 -0
- wbfdm/viewsets/configs/display/statements.py +48 -0
- wbfdm/viewsets/configs/endpoints/__init__.py +41 -0
- wbfdm/viewsets/configs/endpoints/classifications.py +87 -0
- wbfdm/viewsets/configs/endpoints/esg.py +20 -0
- wbfdm/viewsets/configs/endpoints/exchanges.py +6 -0
- wbfdm/viewsets/configs/endpoints/financials_analysis.py +65 -0
- wbfdm/viewsets/configs/endpoints/instrument_lists.py +38 -0
- wbfdm/viewsets/configs/endpoints/instrument_prices.py +51 -0
- wbfdm/viewsets/configs/endpoints/instrument_requests.py +20 -0
- wbfdm/viewsets/configs/endpoints/instruments.py +13 -0
- wbfdm/viewsets/configs/endpoints/instruments_relationships.py +31 -0
- wbfdm/viewsets/configs/endpoints/statements.py +6 -0
- wbfdm/viewsets/configs/menus/__init__.py +9 -0
- wbfdm/viewsets/configs/menus/classifications.py +19 -0
- wbfdm/viewsets/configs/menus/exchanges.py +10 -0
- wbfdm/viewsets/configs/menus/instrument_lists.py +10 -0
- wbfdm/viewsets/configs/menus/instruments.py +20 -0
- wbfdm/viewsets/configs/menus/instruments_relationships.py +33 -0
- wbfdm/viewsets/configs/titles/__init__.py +42 -0
- wbfdm/viewsets/configs/titles/classifications.py +79 -0
- wbfdm/viewsets/configs/titles/esg.py +11 -0
- wbfdm/viewsets/configs/titles/exchanges.py +12 -0
- wbfdm/viewsets/configs/titles/financial_ratio_analysis.py +6 -0
- wbfdm/viewsets/configs/titles/financials_analysis.py +50 -0
- wbfdm/viewsets/configs/titles/instrument_prices.py +50 -0
- wbfdm/viewsets/configs/titles/instrument_requests.py +16 -0
- wbfdm/viewsets/configs/titles/instruments.py +31 -0
- wbfdm/viewsets/configs/titles/instruments_relationships.py +21 -0
- wbfdm/viewsets/configs/titles/market_data.py +13 -0
- wbfdm/viewsets/configs/titles/prices.py +15 -0
- wbfdm/viewsets/configs/titles/statement_with_estimates.py +10 -0
- wbfdm/viewsets/esg.py +72 -0
- wbfdm/viewsets/exchanges.py +63 -0
- wbfdm/viewsets/financial_analysis/__init__.py +3 -0
- wbfdm/viewsets/financial_analysis/financial_metric_analysis.py +85 -0
- wbfdm/viewsets/financial_analysis/financial_ratio_analysis.py +85 -0
- wbfdm/viewsets/financial_analysis/statement_with_estimates.py +145 -0
- wbfdm/viewsets/instruments/__init__.py +80 -0
- wbfdm/viewsets/instruments/classifications.py +279 -0
- wbfdm/viewsets/instruments/financials_analysis.py +614 -0
- wbfdm/viewsets/instruments/instrument_lists.py +77 -0
- wbfdm/viewsets/instruments/instrument_prices.py +542 -0
- wbfdm/viewsets/instruments/instrument_requests.py +51 -0
- wbfdm/viewsets/instruments/instruments.py +106 -0
- wbfdm/viewsets/instruments/instruments_relationships.py +235 -0
- wbfdm/viewsets/instruments/utils.py +27 -0
- wbfdm/viewsets/market_data.py +172 -0
- wbfdm/viewsets/mixins.py +9 -0
- wbfdm/viewsets/officers.py +27 -0
- wbfdm/viewsets/prices.py +62 -0
- wbfdm/viewsets/statements/__init__.py +1 -0
- wbfdm/viewsets/statements/statements.py +100 -0
- wbfdm/viewsets/technical_analysis/__init__.py +1 -0
- wbfdm/viewsets/technical_analysis/monthly_performances.py +93 -0
- wbfdm-2.2.1.dist-info/METADATA +15 -0
- wbfdm-2.2.1.dist-info/RECORD +337 -0
- wbfdm-2.2.1.dist-info/WHEEL +5 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
from datetime import date
|
|
2
|
+
from unittest.mock import patch
|
|
3
|
+
|
|
4
|
+
import pandas as pd
|
|
5
|
+
import pytest
|
|
6
|
+
from faker import Faker
|
|
7
|
+
from wbfdm.analysis.financial_analysis.statement_with_estimates import (
|
|
8
|
+
StatementWithEstimates,
|
|
9
|
+
)
|
|
10
|
+
from wbfdm.analysis.financial_analysis.utils import Loader
|
|
11
|
+
from wbfdm.enums import Financial, MarketData
|
|
12
|
+
|
|
13
|
+
fake = Faker()
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.mark.django_db
|
|
17
|
+
class TestStatementWithEstimates:
|
|
18
|
+
# Coverage test to cover all the Statement with estimates properties
|
|
19
|
+
@pytest.fixture()
|
|
20
|
+
def df(self, values):
|
|
21
|
+
data = []
|
|
22
|
+
for financial in values:
|
|
23
|
+
for interim in ["Y", "S1", "S2"]:
|
|
24
|
+
data.append(
|
|
25
|
+
{
|
|
26
|
+
"year": 2021,
|
|
27
|
+
"estimate": False,
|
|
28
|
+
"interim": interim,
|
|
29
|
+
"period_end_date": date(2021, 12, 31),
|
|
30
|
+
"financial": financial.value,
|
|
31
|
+
"value": fake.pyfloat(),
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
df = pd.DataFrame(data).pivot_table(
|
|
35
|
+
index=["year", "interim", "estimate", "period_end_date"], columns="financial", values="value"
|
|
36
|
+
)
|
|
37
|
+
return df.reset_index(level=[2, 3])
|
|
38
|
+
|
|
39
|
+
@pytest.fixture()
|
|
40
|
+
def summery_with_estimate_df(self):
|
|
41
|
+
values = [
|
|
42
|
+
Financial.REVENUE,
|
|
43
|
+
Financial.GROSS_PROFIT,
|
|
44
|
+
Financial.GROSS_PROFIT_MARGIN,
|
|
45
|
+
Financial.NET_INCOME_REPORTED,
|
|
46
|
+
Financial.EPS_REPORTED,
|
|
47
|
+
Financial.EPS,
|
|
48
|
+
Financial.EBITDA,
|
|
49
|
+
Financial.EBIT,
|
|
50
|
+
Financial.CASH_FLOW_PER_SHARE,
|
|
51
|
+
Financial.BOOK_VALUE_PER_SHARE,
|
|
52
|
+
Financial.CAPEX,
|
|
53
|
+
Financial.SHARES_OUTSTANDING,
|
|
54
|
+
Financial.TOTAL_ASSETS,
|
|
55
|
+
Financial.CURRENT_LIABILITIES,
|
|
56
|
+
Financial.ENTERPRISE_VALUE,
|
|
57
|
+
Financial.CASH_EQUIVALENTS,
|
|
58
|
+
MarketData.CLOSE,
|
|
59
|
+
MarketData.MARKET_CAPITALIZATION,
|
|
60
|
+
Financial.EMPLOYEES,
|
|
61
|
+
Financial.CASH_AND_SHORT_TERM_INVESTMENT,
|
|
62
|
+
Financial.DILUTED_WEIGHTED_AVG_SHARES,
|
|
63
|
+
Financial.TOTAL_DEBT,
|
|
64
|
+
Financial.NET_DEBT,
|
|
65
|
+
Financial.STOCK_COMPENSATION,
|
|
66
|
+
Financial.TANGIBLE_BOOK_VALUE_PER_SHARE,
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
data = []
|
|
70
|
+
for financial in values:
|
|
71
|
+
for interim in ["Y", "S1", "S2"]:
|
|
72
|
+
data.append(
|
|
73
|
+
{
|
|
74
|
+
"year": 2021,
|
|
75
|
+
"estimate": False,
|
|
76
|
+
"interim": interim,
|
|
77
|
+
"period_end_date": date(2021, 12, 31),
|
|
78
|
+
"financial": financial.value,
|
|
79
|
+
"value": fake.pyfloat(),
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
df = pd.DataFrame(data).pivot_table(
|
|
83
|
+
index=["year", "interim", "estimate", "period_end_date"], columns="financial", values="value"
|
|
84
|
+
)
|
|
85
|
+
return df.reset_index(level=[2, 3])
|
|
86
|
+
|
|
87
|
+
@pytest.mark.parametrize(
|
|
88
|
+
"values",
|
|
89
|
+
[
|
|
90
|
+
[
|
|
91
|
+
Financial.NET_DEBT,
|
|
92
|
+
Financial.EBITDA,
|
|
93
|
+
Financial.TOTAL_DEBT,
|
|
94
|
+
Financial.FREE_CASH_FLOW,
|
|
95
|
+
Financial.CASH_FLOW_FROM_OPERATIONS,
|
|
96
|
+
]
|
|
97
|
+
],
|
|
98
|
+
)
|
|
99
|
+
@patch.object(Loader, "load")
|
|
100
|
+
def test_credit_with_estimates(self, mock_fct, instrument, df, values):
|
|
101
|
+
mock_fct.return_value = df
|
|
102
|
+
res = StatementWithEstimates(instrument).credit_with_estimates
|
|
103
|
+
assert set(res.df.columns) == {
|
|
104
|
+
"net_debt_ebitda_ratio",
|
|
105
|
+
"total_debt_ebitda_ratio",
|
|
106
|
+
"fcf_total_debt_ratio",
|
|
107
|
+
"cfo_total_debt_ratio",
|
|
108
|
+
"period_end_date",
|
|
109
|
+
"estimate",
|
|
110
|
+
}
|
|
111
|
+
assert not res.formatted_df.empty
|
|
112
|
+
|
|
113
|
+
@pytest.mark.parametrize(
|
|
114
|
+
"values",
|
|
115
|
+
[
|
|
116
|
+
[
|
|
117
|
+
Financial.TOTAL_DEBT,
|
|
118
|
+
Financial.SHAREHOLDERS_EQUITY,
|
|
119
|
+
Financial.WORKING_CAPITAL,
|
|
120
|
+
]
|
|
121
|
+
],
|
|
122
|
+
)
|
|
123
|
+
@patch.object(Loader, "load")
|
|
124
|
+
def test_long_term_solvency_with_estimates(self, mock_fct, instrument, df, values):
|
|
125
|
+
mock_fct.return_value = df
|
|
126
|
+
res = StatementWithEstimates(instrument).long_term_solvency_with_estimates
|
|
127
|
+
assert set(res.df.columns) == {
|
|
128
|
+
"total_debt_equity_ratio",
|
|
129
|
+
"total_debt_capital_ratio",
|
|
130
|
+
"period_end_date",
|
|
131
|
+
"estimate",
|
|
132
|
+
}
|
|
133
|
+
assert not res.formatted_df.empty
|
|
134
|
+
|
|
135
|
+
@pytest.mark.parametrize(
|
|
136
|
+
"values",
|
|
137
|
+
[
|
|
138
|
+
[
|
|
139
|
+
Financial.CURRENT_ASSETS,
|
|
140
|
+
Financial.CURRENT_LIABILITIES,
|
|
141
|
+
Financial.CASH_FLOW_FROM_OPERATIONS,
|
|
142
|
+
]
|
|
143
|
+
],
|
|
144
|
+
)
|
|
145
|
+
@patch.object(Loader, "load")
|
|
146
|
+
def test_short_term_liquidity_with_estimates(self, mock_fct, instrument, df, values):
|
|
147
|
+
mock_fct.return_value = df
|
|
148
|
+
res = StatementWithEstimates(instrument).short_term_liquidity_with_estimates
|
|
149
|
+
assert set(res.df.columns) == {
|
|
150
|
+
"current_ratio",
|
|
151
|
+
"cash_from_operation_current_liabilities_ratio",
|
|
152
|
+
"period_end_date",
|
|
153
|
+
"estimate",
|
|
154
|
+
}
|
|
155
|
+
assert not res.formatted_df.empty
|
|
156
|
+
|
|
157
|
+
@pytest.mark.parametrize(
|
|
158
|
+
"values",
|
|
159
|
+
[
|
|
160
|
+
[
|
|
161
|
+
Financial.REVENUE,
|
|
162
|
+
Financial.TOTAL_ASSETS,
|
|
163
|
+
Financial.COST_OF_GOODS_SOLD,
|
|
164
|
+
]
|
|
165
|
+
],
|
|
166
|
+
)
|
|
167
|
+
@patch.object(Loader, "load")
|
|
168
|
+
def test_asset_turnover_with_estimates(self, mock_fct, instrument, df, values):
|
|
169
|
+
mock_fct.return_value = df
|
|
170
|
+
res = StatementWithEstimates(instrument).asset_turnover_with_estimates
|
|
171
|
+
assert set(res.df.columns) == {"asset_turnover", "period_end_date", "estimate"}
|
|
172
|
+
assert not res.formatted_df.empty
|
|
173
|
+
|
|
174
|
+
@pytest.mark.parametrize(
|
|
175
|
+
"values",
|
|
176
|
+
[
|
|
177
|
+
[
|
|
178
|
+
Financial.CASH_FLOW_FROM_OPERATIONS,
|
|
179
|
+
Financial.CURRENT_LIABILITIES,
|
|
180
|
+
Financial.REVENUE,
|
|
181
|
+
Financial.TOTAL_ASSETS,
|
|
182
|
+
Financial.TOTAL_DEBT,
|
|
183
|
+
]
|
|
184
|
+
],
|
|
185
|
+
)
|
|
186
|
+
@patch.object(Loader, "load")
|
|
187
|
+
def test_cashflow_ratios_with_estimates(self, mock_fct, instrument, df, values):
|
|
188
|
+
mock_fct.return_value = df
|
|
189
|
+
res = StatementWithEstimates(instrument).cashflow_ratios_with_estimates
|
|
190
|
+
assert set(res.df.columns) == {
|
|
191
|
+
"current_liability_coverage_ratio",
|
|
192
|
+
"cash_flow_margin",
|
|
193
|
+
"asset_efficiency_margin",
|
|
194
|
+
"net_debt_coverage_ratio",
|
|
195
|
+
"period_end_date",
|
|
196
|
+
"estimate",
|
|
197
|
+
}
|
|
198
|
+
assert not res.formatted_df.empty
|
|
199
|
+
|
|
200
|
+
@pytest.mark.parametrize(
|
|
201
|
+
"values",
|
|
202
|
+
[
|
|
203
|
+
[
|
|
204
|
+
Financial.REVENUE,
|
|
205
|
+
Financial.GROSS_PROFIT,
|
|
206
|
+
Financial.SGA_EXPENSES,
|
|
207
|
+
Financial.EBITDA,
|
|
208
|
+
Financial.EBIT,
|
|
209
|
+
Financial.NET_INCOME,
|
|
210
|
+
Financial.FREE_CASH_FLOW,
|
|
211
|
+
]
|
|
212
|
+
],
|
|
213
|
+
)
|
|
214
|
+
@patch.object(Loader, "load")
|
|
215
|
+
def test_margins_with_estimates(self, mock_fct, instrument, df, values):
|
|
216
|
+
mock_fct.return_value = df
|
|
217
|
+
res = StatementWithEstimates(instrument).margins_with_estimates
|
|
218
|
+
assert set(res.df.columns) == {
|
|
219
|
+
"gross_margin",
|
|
220
|
+
"sga_margin",
|
|
221
|
+
"ebitda_margin",
|
|
222
|
+
"ebit_margin",
|
|
223
|
+
"net_income_margin",
|
|
224
|
+
"free_cash_flow_margin",
|
|
225
|
+
"period_end_date",
|
|
226
|
+
"estimate",
|
|
227
|
+
}
|
|
228
|
+
assert not res.formatted_df.empty
|
|
229
|
+
|
|
230
|
+
@pytest.mark.parametrize(
|
|
231
|
+
"values",
|
|
232
|
+
[
|
|
233
|
+
[
|
|
234
|
+
Financial.REVENUE,
|
|
235
|
+
Financial.COST_OF_GOODS_SOLD,
|
|
236
|
+
Financial.GROSS_PROFIT,
|
|
237
|
+
Financial.GROSS_PROFIT_MARGIN,
|
|
238
|
+
Financial.SELLING_MARKETING_EXPENSES,
|
|
239
|
+
Financial.SGA_EXPENSES,
|
|
240
|
+
Financial.GENERAL_ADMIN_EXPENSES,
|
|
241
|
+
Financial.RND_EXPENSES,
|
|
242
|
+
Financial.STOCK_COMPENSATION,
|
|
243
|
+
Financial.TOTAL_OPERATING_EXPENSES,
|
|
244
|
+
Financial.EBITDA,
|
|
245
|
+
Financial.EBITDA_PER_SHARE,
|
|
246
|
+
Financial.DEPRECATION,
|
|
247
|
+
Financial.AMORTIZATION,
|
|
248
|
+
Financial.EBIT,
|
|
249
|
+
Financial.INTEREST_EXPENSE,
|
|
250
|
+
Financial.NET_INCOME_BEFORE_TAXES,
|
|
251
|
+
Financial.TAX_PROVISION,
|
|
252
|
+
Financial.TAX_RATE,
|
|
253
|
+
Financial.NET_INCOME,
|
|
254
|
+
Financial.SHARES_OUTSTANDING,
|
|
255
|
+
Financial.EPS,
|
|
256
|
+
Financial.EBITDA_REPORTED,
|
|
257
|
+
Financial.NET_INCOME_BEFORE_TAXES_REPORTED,
|
|
258
|
+
Financial.NET_INCOME_REPORTED,
|
|
259
|
+
Financial.EPS_REPORTED,
|
|
260
|
+
Financial.DIVIDEND_PER_SHARE,
|
|
261
|
+
]
|
|
262
|
+
],
|
|
263
|
+
)
|
|
264
|
+
@patch.object(Loader, "load")
|
|
265
|
+
def test_income_statement_with_estimate(self, mock_fct, instrument, df, values):
|
|
266
|
+
mock_fct.return_value = df
|
|
267
|
+
res = StatementWithEstimates(instrument).income_statement_with_estimate
|
|
268
|
+
assert set(res.df.columns) == {*[v.value for v in values], "period_end_date", "estimate"}
|
|
269
|
+
assert not res.formatted_df.empty
|
|
270
|
+
|
|
271
|
+
@pytest.mark.parametrize(
|
|
272
|
+
"values",
|
|
273
|
+
[
|
|
274
|
+
[
|
|
275
|
+
Financial.CASH_EQUIVALENTS,
|
|
276
|
+
Financial.INVENTORY,
|
|
277
|
+
Financial.CURRENT_ASSETS,
|
|
278
|
+
Financial.TOTAL_ASSETS,
|
|
279
|
+
Financial.CURRENT_LIABILITIES,
|
|
280
|
+
Financial.CURRENT_DEFERRED_REVENUE,
|
|
281
|
+
Financial.TOTAL_DEBT,
|
|
282
|
+
Financial.NET_DEBT,
|
|
283
|
+
Financial.SHAREHOLDERS_EQUITY,
|
|
284
|
+
Financial.GOODWILL,
|
|
285
|
+
Financial.NET_ASSET_VALUE,
|
|
286
|
+
Financial.BOOK_VALUE_PER_SHARE,
|
|
287
|
+
Financial.TANGIBLE_BOOK_VALUE_PER_SHARE,
|
|
288
|
+
Financial.ENTERPRISE_VALUE,
|
|
289
|
+
Financial.TANGIBLE_BOOK_VALUE,
|
|
290
|
+
]
|
|
291
|
+
],
|
|
292
|
+
)
|
|
293
|
+
@patch.object(Loader, "load")
|
|
294
|
+
def test_balance_sheet_with_estimate(self, mock_fct, instrument, df, values):
|
|
295
|
+
mock_fct.return_value = df
|
|
296
|
+
res = StatementWithEstimates(instrument).balance_sheet_with_estimate
|
|
297
|
+
assert set(res.df.columns) == {*[v.value for v in values], "period_end_date", "estimate"}
|
|
298
|
+
assert not res.formatted_df.empty
|
|
299
|
+
|
|
300
|
+
@pytest.mark.parametrize(
|
|
301
|
+
"values",
|
|
302
|
+
[
|
|
303
|
+
[
|
|
304
|
+
Financial.WORKING_CAPITAL,
|
|
305
|
+
Financial.INCOME_TAXES_PAID,
|
|
306
|
+
Financial.CASH_FLOW_FROM_OPERATIONS,
|
|
307
|
+
Financial.CAPEX,
|
|
308
|
+
Financial.CASH_FLOW_FROM_INVESTING,
|
|
309
|
+
Financial.FREE_CASH_FLOW,
|
|
310
|
+
Financial.FREE_CASH_FLOW_PER_SHARE,
|
|
311
|
+
Financial.TOTAL_DIVIDENDS,
|
|
312
|
+
Financial.CASH_FLOW_FROM_FINANCING,
|
|
313
|
+
Financial.CASH_FLOW_PER_SHARE,
|
|
314
|
+
]
|
|
315
|
+
],
|
|
316
|
+
)
|
|
317
|
+
@patch.object(Loader, "load")
|
|
318
|
+
def test_cash_flow_statement_with_estimate(self, mock_fct, instrument, df, values):
|
|
319
|
+
mock_fct.return_value = df
|
|
320
|
+
res = StatementWithEstimates(instrument).cash_flow_statement_with_estimate
|
|
321
|
+
assert set(res.df.columns) == {*[v.value for v in values], "period_end_date", "estimate"}
|
|
322
|
+
assert not res.formatted_df.empty
|
|
323
|
+
|
|
324
|
+
@pytest.mark.parametrize(
|
|
325
|
+
"values",
|
|
326
|
+
[
|
|
327
|
+
[
|
|
328
|
+
Financial.RETURN_ON_EQUITY,
|
|
329
|
+
Financial.RETURN_ON_INVESTED_CAPITAL,
|
|
330
|
+
Financial.RETURN_ON_CAPITAL,
|
|
331
|
+
Financial.RETURN_ON_ASSETS,
|
|
332
|
+
]
|
|
333
|
+
],
|
|
334
|
+
)
|
|
335
|
+
@patch.object(Loader, "load")
|
|
336
|
+
def test_ratios_with_estimate(self, mock_fct, instrument, df, values):
|
|
337
|
+
mock_fct.return_value = df
|
|
338
|
+
res = StatementWithEstimates(instrument).ratios_with_estimate
|
|
339
|
+
assert set(res.df.columns) == {*[v.value for v in values], "period_end_date", "estimate"}
|
|
340
|
+
assert not res.formatted_df.empty
|
|
341
|
+
|
|
342
|
+
@patch.object(Loader, "load")
|
|
343
|
+
def test_summary_with_estimate(self, mock_fct, summery_with_estimate_df, instrument):
|
|
344
|
+
mock_fct.return_value = summery_with_estimate_df
|
|
345
|
+
res = StatementWithEstimates(instrument).summary_with_estimate
|
|
346
|
+
expected_values = {
|
|
347
|
+
"revenue",
|
|
348
|
+
"price_sales_ratio",
|
|
349
|
+
"gross_profit",
|
|
350
|
+
"gross_profit_margin",
|
|
351
|
+
"net_income_reported",
|
|
352
|
+
"net_income_margin",
|
|
353
|
+
"eps_reported",
|
|
354
|
+
"price_earning_reported_ratio",
|
|
355
|
+
"eps",
|
|
356
|
+
"price_earning_ratio",
|
|
357
|
+
"ebitda",
|
|
358
|
+
"ebitda_margin",
|
|
359
|
+
"ev_ebitda_ratio",
|
|
360
|
+
"ebit",
|
|
361
|
+
"ebit_margin",
|
|
362
|
+
"ev_ebit_ratio",
|
|
363
|
+
"total_assets",
|
|
364
|
+
"current_liabilities",
|
|
365
|
+
"roce",
|
|
366
|
+
"cash_flow_per_share",
|
|
367
|
+
"price_to_cash_flow_ratio",
|
|
368
|
+
"book_value_per_share",
|
|
369
|
+
"price_to_book_ratio",
|
|
370
|
+
"tangible_book_value_per_share",
|
|
371
|
+
"price_to_tangible_bv_ratio",
|
|
372
|
+
"cash_and_short_term_investment",
|
|
373
|
+
"diluded_weighted_avg_shares",
|
|
374
|
+
"cash_shares_ratio",
|
|
375
|
+
"total_debt",
|
|
376
|
+
"total_debt_shares_ratio",
|
|
377
|
+
"net_debt",
|
|
378
|
+
"net_debt_shares_ratio",
|
|
379
|
+
"stock_compensation",
|
|
380
|
+
"employees",
|
|
381
|
+
"stock_compensation_employee_ratio",
|
|
382
|
+
"capex",
|
|
383
|
+
"outstanding_shares",
|
|
384
|
+
"market_capitalization",
|
|
385
|
+
"close",
|
|
386
|
+
"market_capitalization",
|
|
387
|
+
"net_cash",
|
|
388
|
+
"period_end_date",
|
|
389
|
+
"estimate",
|
|
390
|
+
}
|
|
391
|
+
assert set(res.df.columns) == expected_values
|
|
392
|
+
assert not res.formatted_df.empty
|