kensho-kfinance 3.2.5__tar.gz → 3.2.7__tar.gz
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 kensho-kfinance might be problematic. Click here for more details.
- {kensho_kfinance-3.2.5/kensho_kfinance.egg-info → kensho_kfinance-3.2.7}/PKG-INFO +1 -1
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7/kensho_kfinance.egg-info}/PKG-INFO +1 -1
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/CHANGELOG.md +6 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/fetch.py +7 -5
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/kfinance.py +38 -39
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/models/date_and_period_models.py +8 -7
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/tests/test_fetch.py +3 -1
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/tests/test_objects.py +38 -95
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/business_relationships/business_relationship_tools.py +4 -4
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/business_relationships/tests/test_business_relationship_tools.py +18 -16
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/capitalizations/capitalization_models.py +3 -3
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/capitalizations/capitalization_tools.py +7 -5
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/capitalizations/tests/test_capitalization_tools.py +46 -36
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/companies/company_models.py +8 -2
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/companies/company_tools.py +8 -12
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/companies/tests/test_company_tools.py +21 -9
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/competitors/competitor_tools.py +2 -3
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/competitors/tests/test_competitor_tools.py +22 -19
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/cusip_and_isin/cusip_and_isin_tools.py +4 -6
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/cusip_and_isin/tests/test_cusip_and_isin_tools.py +13 -8
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/earnings/earning_tools.py +12 -9
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/earnings/tests/test_earnings_tools.py +52 -43
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/line_items/line_item_tools.py +2 -3
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/line_items/tests/test_line_item_tools.py +20 -23
- kensho_kfinance-3.2.7/kfinance/domains/mergers_and_acquisitions/merger_and_acquisition_models.py +65 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/mergers_and_acquisitions/merger_and_acquisition_tools.py +13 -68
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/mergers_and_acquisitions/tests/test_merger_and_acquisition_tools.py +61 -59
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/prices/price_tools.py +4 -7
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/prices/tests/test_price_tools.py +47 -39
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/segments/segment_tools.py +2 -3
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/segments/tests/test_segment_tools.py +16 -11
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/statements/statement_tools.py +2 -3
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/statements/tests/test_statement_tools.py +40 -35
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/static_tools/get_n_quarters_ago.py +5 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/static_tools/tests/test_get_lastest.py +13 -10
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/static_tools/tests/test_get_n_quarters_ago.py +2 -1
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/tests/test_tool_calling_models.py +8 -2
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/tool_calling_models.py +11 -5
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/version.py +3 -3
- kensho_kfinance-3.2.5/kfinance/domains/mergers_and_acquisitions/merger_and_acquisition_models.py +0 -21
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/.coveragerc +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/.github/workflows/ci-lint.yml +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/.github/workflows/ci-test.yml +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/.github/workflows/python-publish.yml +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/.gitignore +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/.readthedocs.yaml +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/AUTHORS.md +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/CODE_OF_CONDUCT.md +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/CONTRIBUTING.md +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/LICENSE +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/README.md +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/docs/build_tool_calling_documentation.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/docs/conf.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/docs/index.rst +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/docs/kfinance.rst +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/docs/requirements.txt +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/docs/templates/apidoc/package.rst_t +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/docs/templates/apidoc/toc.rst_t +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/docs/tool_calling.rst +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/example_notebooks/basic_usage.ipynb +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/example_notebooks/tool_calling/langchain/anthropic_langchain_tool_calling.ipynb +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/example_notebooks/tool_calling/langchain/google_gemini_langchain_tool_calling.ipynb +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/example_notebooks/tool_calling/langchain/openai_langchain_tool_calling.ipynb +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/example_notebooks/tool_calling/non-langchain/anthropic_tool_calling.ipynb +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/example_notebooks/tool_calling/non-langchain/google_gemini_tool_calling.ipynb +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/example_notebooks/tool_calling/non-langchain/openai_langchain_tool_calling.ipynb +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/images/colab_logo_32px.png +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/justfile +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kensho_kfinance.egg-info/SOURCES.txt +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kensho_kfinance.egg-info/dependency_links.txt +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kensho_kfinance.egg-info/requires.txt +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kensho_kfinance.egg-info/top_level.txt +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/README.md +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/batch_request_handling.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/industry_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/meta_classes.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/models/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/models/currency_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/models/decimal_with_unit.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/models/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/models/tests/test_decimal_with_unit.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/permission_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/server_thread.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/tests/test_batch_requests.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/tests/test_client.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/tests/test_group_objects.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/conftest.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/README.md +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/business_relationships/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/business_relationships/business_relationship_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/business_relationships/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/capitalizations/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/capitalizations/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/capitalizations/tests/test_capitalization_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/companies/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/companies/company_identifiers.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/companies/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/competitors/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/competitors/competitor_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/competitors/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/cusip_and_isin/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/cusip_and_isin/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/earnings/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/earnings/earning_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/earnings/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/line_items/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/line_items/line_item_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/line_items/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/mergers_and_acquisitions/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/mergers_and_acquisitions/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/prices/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/prices/price_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/prices/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/prices/tests/test_price_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/segments/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/segments/segment_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/segments/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/statements/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/statements/statement_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/domains/statements/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/README.md +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/local_mcp/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/local_mcp/kfinance_mcp.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/local_mcp/local_mcp.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tests/test_example_notebook.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/README.md +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/all_tools.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/prompts.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/static_tools/README.md +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/static_tools/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/static_tools/get_latest.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/static_tools/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/integrations/tool_calling/tests/__init__.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/mcp.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/models/permission_models.py +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/py.typed +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/pyproject.toml +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/scripts/copyright_line_check.sh +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/scripts/lint.sh +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/scripts/test.sh +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/setup.cfg +0 -0
- {kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kensho-kfinance
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.7
|
|
4
4
|
Summary: Python CLI for kFinance
|
|
5
5
|
Author-email: Luke Brown <luke.brown@kensho.com>, Michelle Keoy <michelle.keoy@kensho.com>, Keith Page <keith.page@kensho.com>, Matthew Rosen <matthew.rosen@kensho.com>, Nick Roshdieh <nick.roshdieh@kensho.com>
|
|
6
6
|
Project-URL: source, https://github.com/kensho-technologies/kfinance
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kensho-kfinance
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.7
|
|
4
4
|
Summary: Python CLI for kFinance
|
|
5
5
|
Author-email: Luke Brown <luke.brown@kensho.com>, Michelle Keoy <michelle.keoy@kensho.com>, Keith Page <keith.page@kensho.com>, Matthew Rosen <matthew.rosen@kensho.com>, Nick Roshdieh <nick.roshdieh@kensho.com>
|
|
6
6
|
Project-URL: source, https://github.com/kensho-technologies/kfinance
|
|
@@ -26,7 +26,10 @@ from kfinance.domains.companies.company_models import (
|
|
|
26
26
|
from kfinance.domains.competitors.competitor_models import CompetitorResponse, CompetitorSource
|
|
27
27
|
from kfinance.domains.earnings.earning_models import EarningsCallResp
|
|
28
28
|
from kfinance.domains.line_items.line_item_models import LineItemResponse
|
|
29
|
-
from kfinance.domains.mergers_and_acquisitions.merger_and_acquisition_models import
|
|
29
|
+
from kfinance.domains.mergers_and_acquisitions.merger_and_acquisition_models import (
|
|
30
|
+
MergerInfo,
|
|
31
|
+
MergersResp,
|
|
32
|
+
)
|
|
30
33
|
from kfinance.domains.prices.price_models import HistoryMetadataResp, PriceHistory
|
|
31
34
|
from kfinance.domains.segments.segment_models import SegmentsResp, SegmentType
|
|
32
35
|
from kfinance.domains.statements.statement_models import StatementsResp
|
|
@@ -645,17 +648,16 @@ class KFinanceApiClient:
|
|
|
645
648
|
def fetch_merger_info(
|
|
646
649
|
self,
|
|
647
650
|
transaction_id: int,
|
|
648
|
-
) ->
|
|
651
|
+
) -> MergerInfo:
|
|
649
652
|
"""Fetches information about the given merger or acquisition, including the timeline, the participants, and the considerations.
|
|
650
653
|
|
|
651
|
-
Returns a complex dictionary.
|
|
652
654
|
:param transaction_id: The transaction ID to filter on.
|
|
653
655
|
:type transaction_id: int
|
|
654
656
|
:return: A dictionary containing the timeline, the participants, and the considerations (eith their details) of the transaction.
|
|
655
|
-
:rtype:
|
|
657
|
+
:rtype: MergerInfo
|
|
656
658
|
"""
|
|
657
659
|
url = f"{self.url_base}merger/info/{transaction_id}"
|
|
658
|
-
return self.fetch(url)
|
|
660
|
+
return MergerInfo.model_validate(self.fetch(url))
|
|
659
661
|
|
|
660
662
|
def fetch_advisors_for_company_in_merger(
|
|
661
663
|
self,
|
|
@@ -31,13 +31,21 @@ from kfinance.client.meta_classes import (
|
|
|
31
31
|
DelegatedCompanyFunctionsMetaClass,
|
|
32
32
|
)
|
|
33
33
|
from kfinance.client.models.date_and_period_models import (
|
|
34
|
+
CurrentPeriod,
|
|
35
|
+
LatestAnnualPeriod,
|
|
34
36
|
LatestPeriods,
|
|
37
|
+
LatestQuarterlyPeriod,
|
|
35
38
|
Periodicity,
|
|
36
39
|
YearAndQuarter,
|
|
37
40
|
)
|
|
38
41
|
from kfinance.client.server_thread import ServerThread
|
|
39
42
|
from kfinance.domains.companies.company_models import IdentificationTriple
|
|
40
43
|
from kfinance.domains.earnings.earning_models import EarningsCall, TranscriptComponent
|
|
44
|
+
from kfinance.domains.mergers_and_acquisitions.merger_and_acquisition_models import (
|
|
45
|
+
MergerConsideration,
|
|
46
|
+
MergerInfo,
|
|
47
|
+
MergerTimelineElement,
|
|
48
|
+
)
|
|
41
49
|
from kfinance.domains.prices.price_models import HistoryMetadataResp, PriceHistory
|
|
42
50
|
|
|
43
51
|
|
|
@@ -1266,24 +1274,13 @@ class MergerOrAcquisition:
|
|
|
1266
1274
|
self.transaction_id = transaction_id
|
|
1267
1275
|
self.merger_title = merger_title
|
|
1268
1276
|
self.closed_date = closed_date
|
|
1269
|
-
self._merger_info:
|
|
1277
|
+
self._merger_info: MergerInfo | None = None
|
|
1270
1278
|
|
|
1271
1279
|
@property
|
|
1272
|
-
def merger_info(self) ->
|
|
1280
|
+
def merger_info(self) -> MergerInfo:
|
|
1273
1281
|
"""Property for the combined information in the merger."""
|
|
1274
1282
|
if not self._merger_info:
|
|
1275
1283
|
self._merger_info = self.kfinance_api_client.fetch_merger_info(self.transaction_id)
|
|
1276
|
-
if "timeline" in self._merger_info and self._merger_info["timeline"]:
|
|
1277
|
-
timeline = pd.DataFrame(self._merger_info["timeline"])
|
|
1278
|
-
timeline["date"] = pd.to_datetime(timeline["date"])
|
|
1279
|
-
self._merger_info["timeline"] = timeline
|
|
1280
|
-
if (
|
|
1281
|
-
"consideration" in self._merger_info
|
|
1282
|
-
and self._merger_info["consideration"]
|
|
1283
|
-
and "details" in self._merger_info["consideration"]
|
|
1284
|
-
):
|
|
1285
|
-
details = pd.DataFrame(self._merger_info["consideration"]["details"])
|
|
1286
|
-
self._merger_info["consideration"]["details"] = details
|
|
1287
1284
|
return self._merger_info
|
|
1288
1285
|
|
|
1289
1286
|
@property
|
|
@@ -1292,9 +1289,9 @@ class MergerOrAcquisition:
|
|
|
1292
1289
|
return self.merger_title
|
|
1293
1290
|
|
|
1294
1291
|
@property
|
|
1295
|
-
def get_timeline(self) ->
|
|
1292
|
+
def get_timeline(self) -> list[MergerTimelineElement]:
|
|
1296
1293
|
"""The timeline of the merger includes every new status, along with the dates of each status change."""
|
|
1297
|
-
return self.merger_info
|
|
1294
|
+
return self.merger_info.timeline
|
|
1298
1295
|
|
|
1299
1296
|
@property
|
|
1300
1297
|
def get_participants(self) -> dict:
|
|
@@ -1308,8 +1305,8 @@ class MergerOrAcquisition:
|
|
|
1308
1305
|
transaction_id=self.transaction_id,
|
|
1309
1306
|
company=Company(
|
|
1310
1307
|
kfinance_api_client=self.kfinance_api_client,
|
|
1311
|
-
company_id=self.merger_info
|
|
1312
|
-
company_name=self.merger_info
|
|
1308
|
+
company_id=self.merger_info.participants.target.company_id,
|
|
1309
|
+
company_name=self.merger_info.participants.target.company_name,
|
|
1313
1310
|
),
|
|
1314
1311
|
),
|
|
1315
1312
|
"buyers": [
|
|
@@ -1318,11 +1315,11 @@ class MergerOrAcquisition:
|
|
|
1318
1315
|
transaction_id=self.transaction_id,
|
|
1319
1316
|
company=Company(
|
|
1320
1317
|
kfinance_api_client=self.kfinance_api_client,
|
|
1321
|
-
company_id=company
|
|
1322
|
-
company_name=company
|
|
1318
|
+
company_id=company.company_id,
|
|
1319
|
+
company_name=company.company_name,
|
|
1323
1320
|
),
|
|
1324
1321
|
)
|
|
1325
|
-
for company in self.merger_info
|
|
1322
|
+
for company in self.merger_info.participants.buyers
|
|
1326
1323
|
],
|
|
1327
1324
|
"sellers": [
|
|
1328
1325
|
ParticipantInMerger(
|
|
@@ -1330,16 +1327,16 @@ class MergerOrAcquisition:
|
|
|
1330
1327
|
transaction_id=self.transaction_id,
|
|
1331
1328
|
company=Company(
|
|
1332
1329
|
kfinance_api_client=self.kfinance_api_client,
|
|
1333
|
-
company_id=company
|
|
1334
|
-
company_name=company
|
|
1330
|
+
company_id=company.company_id,
|
|
1331
|
+
company_name=company.company_name,
|
|
1335
1332
|
),
|
|
1336
1333
|
)
|
|
1337
|
-
for company in self.merger_info
|
|
1334
|
+
for company in self.merger_info.participants.sellers
|
|
1338
1335
|
],
|
|
1339
1336
|
}
|
|
1340
1337
|
|
|
1341
1338
|
@property
|
|
1342
|
-
def get_consideration(self) ->
|
|
1339
|
+
def get_consideration(self) -> MergerConsideration:
|
|
1343
1340
|
"""A merger's consideration is the assets exchanged for the target company.
|
|
1344
1341
|
|
|
1345
1342
|
Properties in the consideration include:
|
|
@@ -1354,7 +1351,7 @@ class MergerOrAcquisition:
|
|
|
1354
1351
|
- The number of shares in the target company.
|
|
1355
1352
|
- The current gross total of the consideration detail.
|
|
1356
1353
|
"""
|
|
1357
|
-
return self.merger_info
|
|
1354
|
+
return self.merger_info.consideration
|
|
1358
1355
|
|
|
1359
1356
|
|
|
1360
1357
|
@add_methods_of_singular_class_to_iterable_class(Company)
|
|
@@ -1903,16 +1900,18 @@ class Client:
|
|
|
1903
1900
|
most_recent_year_annual = current_year - 1
|
|
1904
1901
|
|
|
1905
1902
|
current_month = datetime_now.month
|
|
1906
|
-
latest
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1903
|
+
latest = LatestPeriods(
|
|
1904
|
+
annual=LatestAnnualPeriod(latest_year=most_recent_year_annual),
|
|
1905
|
+
quarterly=LatestQuarterlyPeriod(
|
|
1906
|
+
latest_quarter=most_recent_qtr, latest_year=most_recent_year_qtrly
|
|
1907
|
+
),
|
|
1908
|
+
now=CurrentPeriod(
|
|
1909
|
+
current_year=current_year,
|
|
1910
|
+
current_quarter=current_qtr,
|
|
1911
|
+
current_month=current_month,
|
|
1912
|
+
current_date=datetime_now.date(),
|
|
1913
|
+
),
|
|
1914
|
+
)
|
|
1916
1915
|
return latest
|
|
1917
1916
|
|
|
1918
1917
|
@staticmethod
|
|
@@ -1932,9 +1931,9 @@ class Client:
|
|
|
1932
1931
|
year_n_quarters_ago = total_quarters_completed_n_quarters_ago // 4
|
|
1933
1932
|
quarter_n_quarters_ago = total_quarters_completed_n_quarters_ago % 4 + 1
|
|
1934
1933
|
|
|
1935
|
-
year_quarter_n_quarters_ago
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1934
|
+
year_quarter_n_quarters_ago = YearAndQuarter(
|
|
1935
|
+
year=year_n_quarters_ago,
|
|
1936
|
+
quarter=quarter_n_quarters_ago,
|
|
1937
|
+
)
|
|
1939
1938
|
|
|
1940
1939
|
return year_quarter_n_quarters_ago
|
{kensho_kfinance-3.2.5 → kensho_kfinance-3.2.7}/kfinance/client/models/date_and_period_models.py
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
from
|
|
1
|
+
from datetime import date
|
|
2
2
|
|
|
3
|
+
from pydantic import BaseModel
|
|
3
4
|
from strenum import StrEnum
|
|
4
5
|
|
|
5
6
|
|
|
@@ -21,28 +22,28 @@ class Periodicity(StrEnum):
|
|
|
21
22
|
year = "year"
|
|
22
23
|
|
|
23
24
|
|
|
24
|
-
class YearAndQuarter(
|
|
25
|
+
class YearAndQuarter(BaseModel):
|
|
25
26
|
year: int
|
|
26
27
|
quarter: int
|
|
27
28
|
|
|
28
29
|
|
|
29
|
-
class LatestAnnualPeriod(
|
|
30
|
+
class LatestAnnualPeriod(BaseModel):
|
|
30
31
|
latest_year: int
|
|
31
32
|
|
|
32
33
|
|
|
33
|
-
class LatestQuarterlyPeriod(
|
|
34
|
+
class LatestQuarterlyPeriod(BaseModel):
|
|
34
35
|
latest_quarter: int
|
|
35
36
|
latest_year: int
|
|
36
37
|
|
|
37
38
|
|
|
38
|
-
class CurrentPeriod(
|
|
39
|
+
class CurrentPeriod(BaseModel):
|
|
39
40
|
current_year: int
|
|
40
41
|
current_quarter: int
|
|
41
42
|
current_month: int
|
|
42
|
-
current_date:
|
|
43
|
+
current_date: date
|
|
43
44
|
|
|
44
45
|
|
|
45
|
-
class LatestPeriods(
|
|
46
|
+
class LatestPeriods(BaseModel):
|
|
46
47
|
annual: LatestAnnualPeriod
|
|
47
48
|
quarterly: LatestQuarterlyPeriod
|
|
48
49
|
now: CurrentPeriod
|
|
@@ -311,7 +311,9 @@ class TestFetchItem(TestCase):
|
|
|
311
311
|
def test_fetch_merger_info(self) -> None:
|
|
312
312
|
transaction_id = 554979212
|
|
313
313
|
expected_fetch_url = f"{self.kfinance_api_client.url_base}merger/info/{transaction_id}"
|
|
314
|
-
|
|
314
|
+
# Validation error is ok, we only care that the function was called with the correct url
|
|
315
|
+
with pytest.raises(ValidationError):
|
|
316
|
+
self.kfinance_api_client.fetch_merger_info(transaction_id=transaction_id)
|
|
315
317
|
self.kfinance_api_client.fetch.assert_called_with(expected_fetch_url)
|
|
316
318
|
|
|
317
319
|
def test_fetch_advisors_for_company_in_merger(self) -> None:
|
|
@@ -14,7 +14,6 @@ from kfinance.client.kfinance import (
|
|
|
14
14
|
BusinessRelationships,
|
|
15
15
|
Company,
|
|
16
16
|
Earnings,
|
|
17
|
-
MergerOrAcquisition,
|
|
18
17
|
ParticipantInMerger,
|
|
19
18
|
Security,
|
|
20
19
|
Ticker,
|
|
@@ -29,7 +28,10 @@ from kfinance.domains.capitalizations.capitalization_models import Capitalizatio
|
|
|
29
28
|
from kfinance.domains.companies.company_models import CompanyIdAndName, IdentificationTriple
|
|
30
29
|
from kfinance.domains.earnings.earning_models import EarningsCallResp
|
|
31
30
|
from kfinance.domains.line_items.line_item_models import LineItemResponse
|
|
32
|
-
from kfinance.domains.mergers_and_acquisitions.merger_and_acquisition_models import
|
|
31
|
+
from kfinance.domains.mergers_and_acquisitions.merger_and_acquisition_models import (
|
|
32
|
+
MergerInfo,
|
|
33
|
+
MergersResp,
|
|
34
|
+
)
|
|
33
35
|
from kfinance.domains.prices.price_models import HistoryMetadataResp
|
|
34
36
|
from kfinance.domains.segments.segment_models import SegmentsResp
|
|
35
37
|
from kfinance.domains.statements.statement_models import StatementsResp
|
|
@@ -254,39 +256,41 @@ MOCK_ISIN_DB = {msft_isin: msft_id_triple.model_dump(mode="json")}
|
|
|
254
256
|
MOCK_CUSIP_DB = {msft_cusip: msft_id_triple.model_dump(mode="json")}
|
|
255
257
|
|
|
256
258
|
MOCK_MERGERS_DB = {
|
|
257
|
-
msft_buys_mongo:
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
"participants": {
|
|
263
|
-
"target": {"company_id": 31696, "company_name": "MongoMusic, Inc."},
|
|
264
|
-
"buyers": [{"company_id": 21835, "company_name": "Microsoft Corporation"}],
|
|
265
|
-
"sellers": [
|
|
266
|
-
{"company_id": 18805, "company_name": "Angel Investors L.P."},
|
|
267
|
-
{"company_id": 20087, "company_name": "Draper Richards, L.P."},
|
|
268
|
-
{"company_id": 22103, "company_name": "BRV Partners, LLC"},
|
|
269
|
-
{"company_id": 23745, "company_name": "Venture Frogs, LLC"},
|
|
270
|
-
{"company_id": 105902, "company_name": "ARGUS Capital International Limited"},
|
|
271
|
-
{"company_id": 880300, "company_name": "Sony Music Entertainment, Inc."},
|
|
272
|
-
],
|
|
273
|
-
},
|
|
274
|
-
"consideration": {
|
|
275
|
-
"currency_name": "US Dollar",
|
|
276
|
-
"current_calculated_gross_total_transaction_value": "51609375.000000",
|
|
277
|
-
"current_calculated_implied_equity_value": "51609375.000000",
|
|
278
|
-
"current_calculated_implied_enterprise_value": "51609375.000000",
|
|
279
|
-
"details": [
|
|
280
|
-
{
|
|
281
|
-
"scenario": "Stock Lump Sum",
|
|
282
|
-
"subtype": "Common Equity",
|
|
283
|
-
"cash_or_cash_equivalent_per_target_share_unit": None,
|
|
284
|
-
"number_of_target_shares_sought": "1000000.000000",
|
|
285
|
-
"current_calculated_gross_value_of_consideration": "51609375.000000",
|
|
286
|
-
}
|
|
259
|
+
msft_buys_mongo: MergerInfo.model_validate(
|
|
260
|
+
{
|
|
261
|
+
"timeline": [
|
|
262
|
+
{"status": "Announced", "date": "2000-09-12"},
|
|
263
|
+
{"status": "Closed", "date": "2000-09-12"},
|
|
287
264
|
],
|
|
288
|
-
|
|
289
|
-
|
|
265
|
+
"participants": {
|
|
266
|
+
"target": {"company_id": 31696, "company_name": "MongoMusic, Inc."},
|
|
267
|
+
"buyers": [{"company_id": 21835, "company_name": "Microsoft Corporation"}],
|
|
268
|
+
"sellers": [
|
|
269
|
+
{"company_id": 18805, "company_name": "Angel Investors L.P."},
|
|
270
|
+
{"company_id": 20087, "company_name": "Draper Richards, L.P."},
|
|
271
|
+
{"company_id": 22103, "company_name": "BRV Partners, LLC"},
|
|
272
|
+
{"company_id": 23745, "company_name": "Venture Frogs, LLC"},
|
|
273
|
+
{"company_id": 105902, "company_name": "ARGUS Capital International Limited"},
|
|
274
|
+
{"company_id": 880300, "company_name": "Sony Music Entertainment, Inc."},
|
|
275
|
+
],
|
|
276
|
+
},
|
|
277
|
+
"consideration": {
|
|
278
|
+
"currency_name": "US Dollar",
|
|
279
|
+
"current_calculated_gross_total_transaction_value": "51609375.000000",
|
|
280
|
+
"current_calculated_implied_equity_value": "51609375.000000",
|
|
281
|
+
"current_calculated_implied_enterprise_value": "51609375.000000",
|
|
282
|
+
"details": [
|
|
283
|
+
{
|
|
284
|
+
"scenario": "Stock Lump Sum",
|
|
285
|
+
"subtype": "Common Equity",
|
|
286
|
+
"cash_or_cash_equivalent_per_target_share_unit": None,
|
|
287
|
+
"number_of_target_shares_sought": "1000000.000000",
|
|
288
|
+
"current_calculated_gross_value_of_consideration": "51609375.000000",
|
|
289
|
+
}
|
|
290
|
+
],
|
|
291
|
+
},
|
|
292
|
+
}
|
|
293
|
+
)
|
|
290
294
|
}
|
|
291
295
|
|
|
292
296
|
|
|
@@ -1012,64 +1016,3 @@ class TestCompanyEarnings(TestCase):
|
|
|
1012
1016
|
"""test company next_earnings property"""
|
|
1013
1017
|
next_earnings = self.msft_company.next_earnings
|
|
1014
1018
|
self.assertEqual(next_earnings.key_dev_id, 1916266380)
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
class TestMerger(TestCase):
|
|
1018
|
-
def setUp(self):
|
|
1019
|
-
self.kfinance_api_client = MockKFinanceApiClient()
|
|
1020
|
-
self.merger = MergerOrAcquisition(
|
|
1021
|
-
kfinance_api_client=self.kfinance_api_client,
|
|
1022
|
-
transaction_id=int(msft_buys_mongo),
|
|
1023
|
-
merger_title="Closed M/A of MongoMusic, Inc.",
|
|
1024
|
-
closed_date=date(2021, 1, 1),
|
|
1025
|
-
)
|
|
1026
|
-
|
|
1027
|
-
def test_merger_info(self) -> None:
|
|
1028
|
-
expected_merger_info = MOCK_MERGERS_DB[msft_buys_mongo]
|
|
1029
|
-
merger_info = {
|
|
1030
|
-
"timeline": [
|
|
1031
|
-
{"status": timeline["status"], "date": timeline["date"].strftime("%Y-%m-%d")}
|
|
1032
|
-
for timeline in self.merger.get_timeline.to_dict(orient="records")
|
|
1033
|
-
],
|
|
1034
|
-
"participants": {
|
|
1035
|
-
"target": {
|
|
1036
|
-
"company_id": self.merger.get_participants["target"].company.company_id,
|
|
1037
|
-
"company_name": self.merger.get_participants["target"].company.name,
|
|
1038
|
-
},
|
|
1039
|
-
"buyers": [
|
|
1040
|
-
{"company_id": buyer.company.company_id, "company_name": buyer.company.name}
|
|
1041
|
-
for buyer in self.merger.get_participants["buyers"]
|
|
1042
|
-
],
|
|
1043
|
-
"sellers": [
|
|
1044
|
-
{"company_id": seller.company.company_id, "company_name": seller.company.name}
|
|
1045
|
-
for seller in self.merger.get_participants["sellers"]
|
|
1046
|
-
],
|
|
1047
|
-
},
|
|
1048
|
-
"consideration": {
|
|
1049
|
-
"currency_name": self.merger.get_consideration["currency_name"],
|
|
1050
|
-
"current_calculated_gross_total_transaction_value": self.merger.get_consideration[
|
|
1051
|
-
"current_calculated_gross_total_transaction_value"
|
|
1052
|
-
],
|
|
1053
|
-
"current_calculated_implied_equity_value": self.merger.get_consideration[
|
|
1054
|
-
"current_calculated_implied_equity_value"
|
|
1055
|
-
],
|
|
1056
|
-
"current_calculated_implied_enterprise_value": self.merger.get_consideration[
|
|
1057
|
-
"current_calculated_implied_enterprise_value"
|
|
1058
|
-
],
|
|
1059
|
-
"details": [
|
|
1060
|
-
{
|
|
1061
|
-
"scenario": detail["scenario"],
|
|
1062
|
-
"subtype": detail["subtype"],
|
|
1063
|
-
"cash_or_cash_equivalent_per_target_share_unit": detail[
|
|
1064
|
-
"cash_or_cash_equivalent_per_target_share_unit"
|
|
1065
|
-
],
|
|
1066
|
-
"number_of_target_shares_sought": detail["number_of_target_shares_sought"],
|
|
1067
|
-
"current_calculated_gross_value_of_consideration": detail[
|
|
1068
|
-
"current_calculated_gross_value_of_consideration"
|
|
1069
|
-
],
|
|
1070
|
-
}
|
|
1071
|
-
for detail in self.merger.get_consideration["details"].to_dict(orient="records")
|
|
1072
|
-
],
|
|
1073
|
-
},
|
|
1074
|
-
}
|
|
1075
|
-
self.assertEqual(ordered(expected_merger_info), ordered(merger_info))
|
|
@@ -38,7 +38,9 @@ class GetBusinessRelationshipFromIdentifiers(KfinanceTool):
|
|
|
38
38
|
args_schema: Type[BaseModel] = GetBusinessRelationshipFromIdentifiersArgs
|
|
39
39
|
accepted_permissions: set[Permission] | None = {Permission.RelationshipPermission}
|
|
40
40
|
|
|
41
|
-
def _run(
|
|
41
|
+
def _run(
|
|
42
|
+
self, identifiers: list[str], business_relationship: BusinessRelationshipType
|
|
43
|
+
) -> GetBusinessRelationshipFromIdentifiersResp:
|
|
42
44
|
"""Sample response:
|
|
43
45
|
|
|
44
46
|
{
|
|
@@ -76,10 +78,8 @@ class GetBusinessRelationshipFromIdentifiers(KfinanceTool):
|
|
|
76
78
|
api_client=api_client, tasks=tasks
|
|
77
79
|
)
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
return GetBusinessRelationshipFromIdentifiersResp(
|
|
80
82
|
business_relationship=business_relationship,
|
|
81
83
|
results=relationship_responses,
|
|
82
84
|
errors=list(id_triple_resp.errors.values()),
|
|
83
85
|
)
|
|
84
|
-
|
|
85
|
-
return output_model.model_dump(mode="json")
|
|
@@ -8,6 +8,7 @@ from kfinance.domains.business_relationships.business_relationship_models import
|
|
|
8
8
|
from kfinance.domains.business_relationships.business_relationship_tools import (
|
|
9
9
|
GetBusinessRelationshipFromIdentifiers,
|
|
10
10
|
GetBusinessRelationshipFromIdentifiersArgs,
|
|
11
|
+
GetBusinessRelationshipFromIdentifiersResp,
|
|
11
12
|
)
|
|
12
13
|
|
|
13
14
|
|
|
@@ -27,21 +28,23 @@ class TestGetBusinessRelationshipFromIdentifiers:
|
|
|
27
28
|
{"company_id": 8182358, "company_name": "Eloqua, Inc."},
|
|
28
29
|
],
|
|
29
30
|
}
|
|
30
|
-
expected_result =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
expected_result = GetBusinessRelationshipFromIdentifiersResp.model_validate(
|
|
32
|
+
{
|
|
33
|
+
"business_relationship": "supplier",
|
|
34
|
+
"results": {
|
|
35
|
+
"SPGI": {
|
|
36
|
+
"current": [{"company_id": 883103, "company_name": "CRISIL Limited"}],
|
|
37
|
+
"previous": [
|
|
38
|
+
{"company_id": 472898, "company_name": "Morgan Stanley"},
|
|
39
|
+
{"company_id": 8182358, "company_name": "Eloqua, Inc."},
|
|
40
|
+
],
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"errors": [
|
|
44
|
+
"No identification triple found for the provided identifier: NON-EXISTENT of type: ticker"
|
|
45
|
+
],
|
|
46
|
+
}
|
|
47
|
+
)
|
|
45
48
|
|
|
46
49
|
requests_mock.get(
|
|
47
50
|
url=f"https://kfinance.kensho.com/api/v1/relationship/{SPGI_COMPANY_ID}/supplier",
|
|
@@ -54,5 +57,4 @@ class TestGetBusinessRelationshipFromIdentifiers:
|
|
|
54
57
|
business_relationship=BusinessRelationshipType.supplier,
|
|
55
58
|
)
|
|
56
59
|
resp = tool.run(args.model_dump(mode="json"))
|
|
57
|
-
resp["results"]["SPGI"]["previous"].sort(key=lambda x: x["company_id"])
|
|
58
60
|
assert resp == expected_result
|
|
@@ -20,9 +20,9 @@ class DailyCapitalization(BaseModel):
|
|
|
20
20
|
"""DailyCapitalization represents market cap, TEV, and shares outstanding for a day"""
|
|
21
21
|
|
|
22
22
|
date: date
|
|
23
|
-
market_cap: Money
|
|
24
|
-
tev: Money
|
|
25
|
-
shares_outstanding: Shares
|
|
23
|
+
market_cap: Money | None
|
|
24
|
+
tev: Money | None
|
|
25
|
+
shares_outstanding: Shares | None
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
class Capitalizations(BaseModel):
|
|
@@ -26,6 +26,7 @@ class GetCapitalizationFromIdentifiersArgs(ToolArgsWithIdentifiers):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
class GetCapitalizationFromIdentifiersResp(ToolRespWithErrors):
|
|
29
|
+
capitalization: Capitalization
|
|
29
30
|
results: dict[str, Capitalizations]
|
|
30
31
|
|
|
31
32
|
|
|
@@ -50,13 +51,13 @@ class GetCapitalizationFromIdentifiers(KfinanceTool):
|
|
|
50
51
|
capitalization: Capitalization,
|
|
51
52
|
start_date: str | None = None,
|
|
52
53
|
end_date: str | None = None,
|
|
53
|
-
) ->
|
|
54
|
+
) -> GetCapitalizationFromIdentifiersResp:
|
|
54
55
|
"""Sample response:
|
|
55
56
|
|
|
56
57
|
{
|
|
58
|
+
'capitalization': 'market_cap'
|
|
57
59
|
'results': {
|
|
58
60
|
'SPGI': {
|
|
59
|
-
'capitalizations': [
|
|
60
61
|
{'date': '2024-04-10', 'market_cap': {'value': '132766738270.00', 'unit': 'USD'}},
|
|
61
62
|
{'date': '2024-04-11', 'market_cap': {'value': '132416066761.00', 'unit': 'USD'}}
|
|
62
63
|
]
|
|
@@ -100,7 +101,8 @@ class GetCapitalizationFromIdentifiers(KfinanceTool):
|
|
|
100
101
|
if capitalization is not Capitalization.shares_outstanding:
|
|
101
102
|
daily_capitalization.shares_outstanding = None
|
|
102
103
|
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
return GetCapitalizationFromIdentifiersResp(
|
|
105
|
+
capitalization=capitalization,
|
|
106
|
+
results=capitalization_responses,
|
|
107
|
+
errors=list(id_triple_resp.errors.values()),
|
|
105
108
|
)
|
|
106
|
-
return resp_model.model_dump(mode="json", exclude_none=True)
|