kensho-kfinance 3.2.9__tar.gz → 3.2.11__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.

Files changed (148) hide show
  1. {kensho_kfinance-3.2.9/kensho_kfinance.egg-info → kensho_kfinance-3.2.11}/PKG-INFO +1 -1
  2. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11/kensho_kfinance.egg-info}/PKG-INFO +1 -1
  3. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/CHANGELOG.md +7 -2
  4. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/batch_request_handling.py +3 -1
  5. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/tests/test_batch_requests.py +5 -4
  6. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/conftest.py +10 -0
  7. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/capitalizations/capitalization_models.py +10 -0
  8. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/capitalizations/capitalization_tools.py +13 -8
  9. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/capitalizations/tests/test_capitalization_tools.py +21 -1
  10. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/companies/company_tools.py +12 -3
  11. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/companies/tests/test_company_tools.py +7 -1
  12. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/line_items/line_item_tools.py +7 -0
  13. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/tests/test_tool_calling_models.py +7 -2
  14. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/version.py +3 -3
  15. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/.coveragerc +0 -0
  16. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/.github/workflows/ci-lint.yml +0 -0
  17. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/.github/workflows/ci-test.yml +0 -0
  18. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/.github/workflows/python-publish.yml +0 -0
  19. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/.gitignore +0 -0
  20. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/.readthedocs.yaml +0 -0
  21. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/AUTHORS.md +0 -0
  22. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/CODE_OF_CONDUCT.md +0 -0
  23. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/CONTRIBUTING.md +0 -0
  24. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/LICENSE +0 -0
  25. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/README.md +0 -0
  26. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/docs/build_tool_calling_documentation.py +0 -0
  27. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/docs/conf.py +0 -0
  28. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/docs/index.rst +0 -0
  29. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/docs/kfinance.rst +0 -0
  30. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/docs/requirements.txt +0 -0
  31. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/docs/templates/apidoc/package.rst_t +0 -0
  32. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/docs/templates/apidoc/toc.rst_t +0 -0
  33. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/docs/tool_calling.rst +0 -0
  34. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/example_notebooks/basic_usage.ipynb +0 -0
  35. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/example_notebooks/tool_calling/langchain/anthropic_langchain_tool_calling.ipynb +0 -0
  36. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/example_notebooks/tool_calling/langchain/google_gemini_langchain_tool_calling.ipynb +0 -0
  37. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/example_notebooks/tool_calling/langchain/openai_langchain_tool_calling.ipynb +0 -0
  38. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/example_notebooks/tool_calling/non-langchain/anthropic_tool_calling.ipynb +0 -0
  39. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/example_notebooks/tool_calling/non-langchain/google_gemini_tool_calling.ipynb +0 -0
  40. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/example_notebooks/tool_calling/non-langchain/openai_langchain_tool_calling.ipynb +0 -0
  41. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/images/colab_logo_32px.png +0 -0
  42. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/justfile +0 -0
  43. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kensho_kfinance.egg-info/SOURCES.txt +0 -0
  44. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kensho_kfinance.egg-info/dependency_links.txt +0 -0
  45. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kensho_kfinance.egg-info/requires.txt +0 -0
  46. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kensho_kfinance.egg-info/top_level.txt +0 -0
  47. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/__init__.py +0 -0
  48. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/README.md +0 -0
  49. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/__init__.py +0 -0
  50. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/fetch.py +0 -0
  51. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/industry_models.py +0 -0
  52. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/kfinance.py +0 -0
  53. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/meta_classes.py +0 -0
  54. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/models/__init__.py +0 -0
  55. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/models/currency_models.py +0 -0
  56. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/models/date_and_period_models.py +0 -0
  57. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/models/decimal_with_unit.py +0 -0
  58. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/models/tests/__init__.py +0 -0
  59. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/models/tests/test_decimal_with_unit.py +0 -0
  60. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/permission_models.py +0 -0
  61. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/server_thread.py +0 -0
  62. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/tests/__init__.py +0 -0
  63. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/tests/test_client.py +0 -0
  64. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/tests/test_fetch.py +0 -0
  65. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/tests/test_group_objects.py +0 -0
  66. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/client/tests/test_objects.py +0 -0
  67. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/README.md +0 -0
  68. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/__init__.py +0 -0
  69. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/business_relationships/__init__.py +0 -0
  70. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/business_relationships/business_relationship_models.py +0 -0
  71. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/business_relationships/business_relationship_tools.py +0 -0
  72. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/business_relationships/tests/__init__.py +0 -0
  73. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/business_relationships/tests/test_business_relationship_tools.py +0 -0
  74. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/capitalizations/__init__.py +0 -0
  75. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/capitalizations/tests/__init__.py +0 -0
  76. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/capitalizations/tests/test_capitalization_models.py +0 -0
  77. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/companies/__init__.py +0 -0
  78. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/companies/company_identifiers.py +0 -0
  79. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/companies/company_models.py +0 -0
  80. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/companies/tests/__init__.py +0 -0
  81. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/competitors/__init__.py +0 -0
  82. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/competitors/competitor_models.py +0 -0
  83. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/competitors/competitor_tools.py +0 -0
  84. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/competitors/tests/__init__.py +0 -0
  85. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/competitors/tests/test_competitor_tools.py +0 -0
  86. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/cusip_and_isin/__init__.py +0 -0
  87. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/cusip_and_isin/cusip_and_isin_tools.py +0 -0
  88. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/cusip_and_isin/tests/__init__.py +0 -0
  89. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/cusip_and_isin/tests/test_cusip_and_isin_tools.py +0 -0
  90. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/earnings/__init__.py +0 -0
  91. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/earnings/earning_models.py +0 -0
  92. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/earnings/earning_tools.py +0 -0
  93. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/earnings/tests/__init__.py +0 -0
  94. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/earnings/tests/test_earnings_tools.py +0 -0
  95. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/line_items/__init__.py +0 -0
  96. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/line_items/line_item_models.py +0 -0
  97. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/line_items/tests/__init__.py +0 -0
  98. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/line_items/tests/test_line_item_tools.py +0 -0
  99. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/mergers_and_acquisitions/__init__.py +0 -0
  100. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/mergers_and_acquisitions/merger_and_acquisition_models.py +0 -0
  101. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/mergers_and_acquisitions/merger_and_acquisition_tools.py +0 -0
  102. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/mergers_and_acquisitions/tests/__init__.py +0 -0
  103. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/mergers_and_acquisitions/tests/test_merger_and_acquisition_tools.py +0 -0
  104. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/prices/__init__.py +0 -0
  105. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/prices/price_models.py +0 -0
  106. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/prices/price_tools.py +0 -0
  107. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/prices/tests/__init__.py +0 -0
  108. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/prices/tests/test_price_models.py +0 -0
  109. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/prices/tests/test_price_tools.py +0 -0
  110. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/segments/__init__.py +0 -0
  111. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/segments/segment_models.py +0 -0
  112. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/segments/segment_tools.py +0 -0
  113. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/segments/tests/__init__.py +0 -0
  114. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/segments/tests/test_segment_tools.py +0 -0
  115. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/statements/__init__.py +0 -0
  116. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/statements/statement_models.py +0 -0
  117. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/statements/statement_tools.py +0 -0
  118. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/statements/tests/__init__.py +0 -0
  119. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/domains/statements/tests/test_statement_tools.py +0 -0
  120. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/README.md +0 -0
  121. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/__init__.py +0 -0
  122. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/local_mcp/__init__.py +0 -0
  123. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/local_mcp/kfinance_mcp.py +0 -0
  124. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/local_mcp/local_mcp.py +0 -0
  125. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tests/__init__.py +0 -0
  126. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tests/test_example_notebook.py +0 -0
  127. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/README.md +0 -0
  128. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/__init__.py +0 -0
  129. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/all_tools.py +0 -0
  130. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/prompts.py +0 -0
  131. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/static_tools/README.md +0 -0
  132. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/static_tools/__init__.py +0 -0
  133. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/static_tools/get_latest.py +0 -0
  134. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/static_tools/get_n_quarters_ago.py +0 -0
  135. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/static_tools/tests/__init__.py +0 -0
  136. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/static_tools/tests/test_get_lastest.py +0 -0
  137. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/static_tools/tests/test_get_n_quarters_ago.py +0 -0
  138. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/tests/__init__.py +0 -0
  139. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/integrations/tool_calling/tool_calling_models.py +0 -0
  140. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/mcp.py +0 -0
  141. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/models/permission_models.py +0 -0
  142. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/kfinance/py.typed +0 -0
  143. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/pyproject.toml +0 -0
  144. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/scripts/copyright_line_check.sh +0 -0
  145. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/scripts/lint.sh +0 -0
  146. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/scripts/test.sh +0 -0
  147. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/setup.cfg +0 -0
  148. {kensho_kfinance-3.2.9 → kensho_kfinance-3.2.11}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kensho-kfinance
3
- Version: 3.2.9
3
+ Version: 3.2.11
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.9
3
+ Version: 3.2.11
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,10 +1,15 @@
1
1
  # Changelog
2
+ # 3.2.11
3
+ - Add Handling of status code 400 for Capitalizations, Modify EV/TEV ratio to target quarterly or LTM
4
+
5
+ # 3.2.10
6
+ - Add CIQ company_id to GetInfoFromIdentifiersResp
2
7
 
3
8
  # v3.2.9
4
- - Updated tool descriptions for line items, segments, and statements to mention that all period-based inputs and outputs refer only to the calendar year.
9
+ - Update tool descriptions for line items, segments, and statements to mention that all period-based inputs and outputs refer only to the calendar year.
5
10
 
6
11
  # v3.2.8
7
- - Added support for None to LineItemResponse & empty behavior for line items, segments, and statements
12
+ - Add support for None to LineItemResponse & empty behavior for line items, segments, and statements
8
13
 
9
14
  # v3.2.7
10
15
  - Fix validator for UnifiedIdTripleResponse
@@ -158,7 +158,9 @@ def resolve_future_with_error_handling(future: Future) -> Any:
158
158
  return future.result()
159
159
  except HTTPError as http_err:
160
160
  error_code = http_err.response.status_code
161
- if error_code == 404:
161
+ if error_code == 400:
162
+ return None
163
+ elif error_code == 404:
162
164
  return None
163
165
  else:
164
166
  raise http_err
@@ -212,11 +212,12 @@ class TestTradingItem(TestCase):
212
212
  )
213
213
  m.get("https://kfinance.kensho.com/api/v1/info/1002", status_code=400)
214
214
 
215
- with self.assertRaises(requests.exceptions.HTTPError) as e:
216
- companies = Companies(self.kfinance_api_client, [1001, 1002])
217
- _ = companies.city
215
+ companies = Companies(self.kfinance_api_client, [1001, 1002])
216
+ result = companies.city
217
+ id_based_result = self.company_object_keys_as_company_id(result)
218
218
 
219
- self.assertEqual(e.exception.response.status_code, 400)
219
+ expected_id_based_result = {1001: "Mock City A", 1002: None}
220
+ self.assertDictEqual(id_based_result, expected_id_based_result)
220
221
 
221
222
  @requests_mock.Mocker()
222
223
  def test_batch_request_500(self, m):
@@ -64,6 +64,16 @@ def mock_client(requests_mock: Mocker) -> Client:
64
64
  }
65
65
  },
66
66
  )
67
+ # Fetch a fake company
68
+ requests_mock.post(
69
+ url="https://kfinance.kensho.com/api/v1/ids",
70
+ additional_matcher=lambda req: req.json().get("identifiers") == ["C_1"],
71
+ json={
72
+ "data": {
73
+ "C_1": {"company_id": 1, "security_id": 1, "trading_item_id": 1},
74
+ },
75
+ },
76
+ )
67
77
  # Fetch SPGI and a non-existent company (which will include an error)
68
78
  requests_mock.post(
69
79
  url="https://kfinance.kensho.com/api/v1/ids",
@@ -30,6 +30,16 @@ class Capitalizations(BaseModel):
30
30
 
31
31
  capitalizations: list[DailyCapitalization] = Field(validation_alias="market_caps")
32
32
 
33
+ @model_validator(mode="before")
34
+ @classmethod
35
+ def handle_field_alias(cls, data: Any) -> Any:
36
+ """Handle both 'capitalizations' and 'market_caps' field names"""
37
+ if isinstance(data, dict):
38
+ if "capitalizations" in data and "market_caps" not in data:
39
+ data = deepcopy(data)
40
+ data["market_caps"] = data["capitalizations"]
41
+ return data
42
+
33
43
  @model_validator(mode="before")
34
44
  @classmethod
35
45
  def inject_currency_into_data(cls, data: Any) -> Any:
@@ -84,7 +84,11 @@ class GetCapitalizationFromIdentifiers(KfinanceTool):
84
84
  api_client=api_client, tasks=tasks
85
85
  )
86
86
 
87
- for capitalization_response in capitalization_responses.values():
87
+ for identifier, capitalization_response in capitalization_responses.items():
88
+ # If we get an empty response for a company, assign an empty object
89
+ if not capitalization_response:
90
+ capitalization_responses[identifier] = Capitalizations(capitalizations=list())
91
+ capitalization_response = capitalization_responses[identifier]
88
92
  # If we return results for more than one company and the start and end dates are unset,
89
93
  # truncate data to only return the most recent datapoint.
90
94
  if len(capitalization_responses) > 1 and start_date is None and end_date is None:
@@ -93,13 +97,14 @@ class GetCapitalizationFromIdentifiers(KfinanceTool):
93
97
  ]
94
98
  # Set capitalizations that were not requested to None.
95
99
  # That way, they can be skipped for serialization via `exclude_none=True`
96
- for daily_capitalization in capitalization_response.capitalizations:
97
- if capitalization is not Capitalization.market_cap:
98
- daily_capitalization.market_cap = None
99
- if capitalization is not Capitalization.tev:
100
- daily_capitalization.tev = None
101
- if capitalization is not Capitalization.shares_outstanding:
102
- daily_capitalization.shares_outstanding = None
100
+ if capitalization_response.capitalizations:
101
+ for daily_capitalization in capitalization_response.capitalizations:
102
+ if capitalization is not Capitalization.market_cap:
103
+ daily_capitalization.market_cap = None
104
+ if capitalization is not Capitalization.tev:
105
+ daily_capitalization.tev = None
106
+ if capitalization is not Capitalization.shares_outstanding:
107
+ daily_capitalization.shares_outstanding = None
103
108
 
104
109
  return GetCapitalizationFromIdentifiersResp(
105
110
  capitalization=capitalization,
@@ -67,7 +67,7 @@ class TestGetCapitalizationFromCompanyIds:
67
67
  shares_outstanding=None,
68
68
  ),
69
69
  ]
70
- )
70
+ ),
71
71
  },
72
72
  errors=[
73
73
  "No identification triple found for the provided identifier: NON-EXISTENT of type: ticker"
@@ -81,6 +81,26 @@ class TestGetCapitalizationFromCompanyIds:
81
81
  response = tool.run(args.model_dump(mode="json"))
82
82
  assert response == expected_response
83
83
 
84
+ def test_get_capitalization_from_identifiers_property_400(
85
+ self, requests_mock: Mocker, mock_client: Client
86
+ ) -> None:
87
+ requests_mock.get(
88
+ url=f"https://kfinance.kensho.com/api/v1/market_cap/1/none/none",
89
+ status_code=400,
90
+ )
91
+
92
+ expected_response = GetCapitalizationFromIdentifiersResp(
93
+ capitalization=Capitalization.market_cap,
94
+ results={"C_1": Capitalizations(market_caps=list())},
95
+ )
96
+
97
+ tool = GetCapitalizationFromIdentifiers(kfinance_client=mock_client)
98
+ args = GetCapitalizationFromIdentifiersArgs(
99
+ identifiers=["C_1"], capitalization=Capitalization.market_cap
100
+ )
101
+ response = tool.run(args.model_dump(mode="json"))
102
+ assert response == expected_response
103
+
84
104
  def test_most_recent_request(self, requests_mock: Mocker, mock_client: Client) -> None:
85
105
  """
86
106
  GIVEN the GetCapitalizationFromIdentifiers tool
@@ -5,7 +5,11 @@ from pydantic import BaseModel
5
5
 
6
6
  from kfinance.client.batch_request_handling import Task, process_tasks_in_thread_pool_executor
7
7
  from kfinance.client.permission_models import Permission
8
- from kfinance.domains.companies.company_models import CompanyDescriptions, CompanyOtherNames
8
+ from kfinance.domains.companies.company_models import (
9
+ COMPANY_ID_PREFIX,
10
+ CompanyDescriptions,
11
+ CompanyOtherNames,
12
+ )
9
13
  from kfinance.integrations.tool_calling.tool_calling_models import (
10
14
  KfinanceTool,
11
15
  ToolArgsWithIdentifiers,
@@ -20,7 +24,7 @@ class GetInfoFromIdentifiersResp(ToolRespWithErrors):
20
24
  class GetInfoFromIdentifiers(KfinanceTool):
21
25
  name: str = "get_info_from_identifiers"
22
26
  description: str = dedent("""
23
- Get the information associated with a list of identifiers. Info includes company name, status, type, simple industry, number of employees (if available), founding date, webpage, HQ address, HQ city, HQ zip code, HQ state, HQ country, and HQ country iso code.
27
+ Get the information associated with a list of identifiers. Info includes company name, status, type, simple industry, number of employees (if available), founding date, webpage, HQ address, HQ city, HQ zip code, HQ state, HQ country, HQ country iso code, and CIQ company_id.
24
28
 
25
29
  - When possible, pass multiple identifiers in a single call rather than making multiple calls.
26
30
  """).strip()
@@ -44,7 +48,8 @@ class GetInfoFromIdentifiers(KfinanceTool):
44
48
  "zip_code": "10041-0001",
45
49
  "state": "New York",
46
50
  "country": "United States",
47
- "iso_country": "USA"
51
+ "iso_country": "USA",
52
+ "company_id": "C_21719"
48
53
  }
49
54
  },
50
55
  "errors": [['No identification triple found for the provided identifier: NON-EXISTENT of type: ticker']
@@ -65,6 +70,10 @@ class GetInfoFromIdentifiers(KfinanceTool):
65
70
  info_responses: dict[str, dict] = process_tasks_in_thread_pool_executor(
66
71
  api_client=api_client, tasks=tasks
67
72
  )
73
+
74
+ for identifier, id_triple in id_triple_resp.identifiers_to_id_triples.items():
75
+ info_responses[identifier]["company_id"] = f"{COMPANY_ID_PREFIX}{id_triple.company_id}"
76
+
68
77
  return GetInfoFromIdentifiersResp(
69
78
  results=info_responses, errors=list(id_triple_resp.errors.values())
70
79
  )
@@ -2,6 +2,7 @@ from requests_mock import Mocker
2
2
 
3
3
  from kfinance.client.kfinance import Client
4
4
  from kfinance.conftest import SPGI_COMPANY_ID
5
+ from kfinance.domains.companies.company_models import COMPANY_ID_PREFIX
5
6
  from kfinance.domains.companies.company_tools import (
6
7
  GetCompanyDescriptionFromIdentifiers,
7
8
  GetCompanyDescriptionFromIdentifiersResp,
@@ -23,7 +24,11 @@ class TestGetInfoFromIdentifiers:
23
24
  THEN we get back info for SPGI and an error for the non-existent company
24
25
  """
25
26
 
26
- info_resp = {"name": "S&P Global Inc.", "status": "Operating"}
27
+ info_resp = {
28
+ "name": "S&P Global Inc.",
29
+ "status": "Operating",
30
+ "company_id": f"{COMPANY_ID_PREFIX}{SPGI_COMPANY_ID}",
31
+ }
27
32
  expected_response = GetInfoFromIdentifiersResp.model_validate(
28
33
  {
29
34
  "results": {"SPGI": info_resp},
@@ -32,6 +37,7 @@ class TestGetInfoFromIdentifiers:
32
37
  ],
33
38
  }
34
39
  )
40
+ del info_resp["company_id"]
35
41
  requests_mock.get(
36
42
  url=f"https://kfinance.kensho.com/api/v1/info/{SPGI_COMPANY_ID}",
37
43
  json=info_resp,
@@ -44,6 +44,13 @@ class GetFinancialLineItemFromIdentifiers(KfinanceTool):
44
44
  - When possible, pass multiple identifiers in a single call rather than making multiple calls.
45
45
  - To fetch the most recent value for the line item, leave start_year, start_quarter, end_year, and end_quarter as None.
46
46
  - The tool accepts arguments in calendar years, and all outputs will be presented in terms of calendar years. Please note that these calendar years may not align with the company's fiscal year.
47
+ - All aliases for a line item return identical data (e.g., "revenue", "normal_revenue", and "regular_revenue" all return the same financial data).
48
+ - For the following Enterprise Value (EV) ratio line items, always specify period_type as either "quarterly" or "ltm" (Last Twelve Months) - do not rely on the default annual period:
49
+ - last_close_tev_to_ebit (and its aliases: ev_to_ebit, enterprise_value_to_ebit, tev_to_ebit, etc.)
50
+ - last_close_tev_to_ebitda (and its aliases: ev_to_ebitda, enterprise_value_to_ebitda, tev_to_ebitda, etc.)
51
+ - ev_to_employees (and its aliases: ev_to_employee_count, tev_to_employees, enterprise_value_to_employees, etc.)
52
+ - ev_to_total_revenue (and its aliases: tev_to_total_revenue, enterprise_value_to_total_revenue, etc.)
53
+ - When requesting these EV ratios, explicitly set period_type="quarterly" or period_type="ltm" for optimal data availability.
47
54
 
48
55
  Example:
49
56
  Query: "What are the revenues of Lowe's and Home Depot?"
@@ -7,6 +7,7 @@ from requests_mock import Mocker
7
7
 
8
8
  from kfinance.client.kfinance import Client
9
9
  from kfinance.conftest import SPGI_COMPANY_ID
10
+ from kfinance.domains.companies.company_models import COMPANY_ID_PREFIX
10
11
  from kfinance.domains.companies.company_tools import (
11
12
  GetInfoFromIdentifiers,
12
13
  GetInfoFromIdentifiersResp,
@@ -25,7 +26,11 @@ class TestGetEndpointsFromToolCallsWithGrounding:
25
26
  """
26
27
 
27
28
  # truncated from the original
28
- resp_data = {"name": "S&P Global Inc.", "status": "Operating"}
29
+ resp_data = {
30
+ "name": "S&P Global Inc.",
31
+ "status": "Operating",
32
+ "company_id": f"{COMPANY_ID_PREFIX}{SPGI_COMPANY_ID}",
33
+ }
29
34
  resp_endpoint = [
30
35
  "https://kfinance.kensho.com/api/v1/ids",
31
36
  "https://kfinance.kensho.com/api/v1/info/21719",
@@ -34,7 +39,7 @@ class TestGetEndpointsFromToolCallsWithGrounding:
34
39
  "data": GetInfoFromIdentifiersResp.model_validate({"results": {"SPGI": resp_data}}),
35
40
  "endpoint_urls": resp_endpoint,
36
41
  }
37
-
42
+ del resp_data["company_id"]
38
43
  requests_mock.get(
39
44
  url=f"https://kfinance.kensho.com/api/v1/info/{SPGI_COMPANY_ID}",
40
45
  json=resp_data,
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '3.2.9'
32
- __version_tuple__ = version_tuple = (3, 2, 9)
31
+ __version__ = version = '3.2.11'
32
+ __version_tuple__ = version_tuple = (3, 2, 11)
33
33
 
34
- __commit_id__ = commit_id = 'g1b5b8b25a'
34
+ __commit_id__ = commit_id = 'gadcf2fd95'