kensho-kfinance 3.2.10__tar.gz → 3.2.12__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.10/kensho_kfinance.egg-info → kensho_kfinance-3.2.12}/PKG-INFO +1 -1
  2. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12/kensho_kfinance.egg-info}/PKG-INFO +1 -1
  3. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/CHANGELOG.md +6 -0
  4. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/batch_request_handling.py +3 -1
  5. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/tests/test_batch_requests.py +5 -4
  6. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/conftest.py +10 -0
  7. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/capitalizations/capitalization_models.py +2 -1
  8. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/capitalizations/capitalization_tools.py +13 -8
  9. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/capitalizations/tests/test_capitalization_tools.py +21 -1
  10. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/line_items/line_item_models.py +0 -121
  11. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/line_items/line_item_tools.py +1 -0
  12. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/version.py +3 -3
  13. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/.coveragerc +0 -0
  14. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/.github/workflows/ci-lint.yml +0 -0
  15. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/.github/workflows/ci-test.yml +0 -0
  16. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/.github/workflows/python-publish.yml +0 -0
  17. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/.gitignore +0 -0
  18. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/.readthedocs.yaml +0 -0
  19. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/AUTHORS.md +0 -0
  20. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/CODE_OF_CONDUCT.md +0 -0
  21. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/CONTRIBUTING.md +0 -0
  22. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/LICENSE +0 -0
  23. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/README.md +0 -0
  24. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/docs/build_tool_calling_documentation.py +0 -0
  25. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/docs/conf.py +0 -0
  26. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/docs/index.rst +0 -0
  27. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/docs/kfinance.rst +0 -0
  28. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/docs/requirements.txt +0 -0
  29. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/docs/templates/apidoc/package.rst_t +0 -0
  30. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/docs/templates/apidoc/toc.rst_t +0 -0
  31. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/docs/tool_calling.rst +0 -0
  32. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/example_notebooks/basic_usage.ipynb +0 -0
  33. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/example_notebooks/tool_calling/langchain/anthropic_langchain_tool_calling.ipynb +0 -0
  34. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/example_notebooks/tool_calling/langchain/google_gemini_langchain_tool_calling.ipynb +0 -0
  35. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/example_notebooks/tool_calling/langchain/openai_langchain_tool_calling.ipynb +0 -0
  36. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/example_notebooks/tool_calling/non-langchain/anthropic_tool_calling.ipynb +0 -0
  37. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/example_notebooks/tool_calling/non-langchain/google_gemini_tool_calling.ipynb +0 -0
  38. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/example_notebooks/tool_calling/non-langchain/openai_langchain_tool_calling.ipynb +0 -0
  39. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/images/colab_logo_32px.png +0 -0
  40. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/justfile +0 -0
  41. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kensho_kfinance.egg-info/SOURCES.txt +0 -0
  42. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kensho_kfinance.egg-info/dependency_links.txt +0 -0
  43. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kensho_kfinance.egg-info/requires.txt +0 -0
  44. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kensho_kfinance.egg-info/top_level.txt +0 -0
  45. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/__init__.py +0 -0
  46. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/README.md +0 -0
  47. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/__init__.py +0 -0
  48. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/fetch.py +0 -0
  49. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/industry_models.py +0 -0
  50. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/kfinance.py +0 -0
  51. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/meta_classes.py +0 -0
  52. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/models/__init__.py +0 -0
  53. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/models/currency_models.py +0 -0
  54. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/models/date_and_period_models.py +0 -0
  55. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/models/decimal_with_unit.py +0 -0
  56. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/models/tests/__init__.py +0 -0
  57. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/models/tests/test_decimal_with_unit.py +0 -0
  58. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/permission_models.py +0 -0
  59. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/server_thread.py +0 -0
  60. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/tests/__init__.py +0 -0
  61. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/tests/test_client.py +0 -0
  62. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/tests/test_fetch.py +0 -0
  63. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/tests/test_group_objects.py +0 -0
  64. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/client/tests/test_objects.py +0 -0
  65. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/README.md +0 -0
  66. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/__init__.py +0 -0
  67. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/business_relationships/__init__.py +0 -0
  68. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/business_relationships/business_relationship_models.py +0 -0
  69. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/business_relationships/business_relationship_tools.py +0 -0
  70. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/business_relationships/tests/__init__.py +0 -0
  71. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/business_relationships/tests/test_business_relationship_tools.py +0 -0
  72. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/capitalizations/__init__.py +0 -0
  73. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/capitalizations/tests/__init__.py +0 -0
  74. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/capitalizations/tests/test_capitalization_models.py +0 -0
  75. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/companies/__init__.py +0 -0
  76. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/companies/company_identifiers.py +0 -0
  77. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/companies/company_models.py +0 -0
  78. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/companies/company_tools.py +0 -0
  79. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/companies/tests/__init__.py +0 -0
  80. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/companies/tests/test_company_tools.py +0 -0
  81. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/competitors/__init__.py +0 -0
  82. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/competitors/competitor_models.py +0 -0
  83. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/competitors/competitor_tools.py +0 -0
  84. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/competitors/tests/__init__.py +0 -0
  85. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/competitors/tests/test_competitor_tools.py +0 -0
  86. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/cusip_and_isin/__init__.py +0 -0
  87. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/cusip_and_isin/cusip_and_isin_tools.py +0 -0
  88. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/cusip_and_isin/tests/__init__.py +0 -0
  89. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/cusip_and_isin/tests/test_cusip_and_isin_tools.py +0 -0
  90. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/earnings/__init__.py +0 -0
  91. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/earnings/earning_models.py +0 -0
  92. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/earnings/earning_tools.py +0 -0
  93. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/earnings/tests/__init__.py +0 -0
  94. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/earnings/tests/test_earnings_tools.py +0 -0
  95. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/line_items/__init__.py +0 -0
  96. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/line_items/tests/__init__.py +0 -0
  97. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/line_items/tests/test_line_item_tools.py +0 -0
  98. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/mergers_and_acquisitions/__init__.py +0 -0
  99. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/mergers_and_acquisitions/merger_and_acquisition_models.py +0 -0
  100. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/mergers_and_acquisitions/merger_and_acquisition_tools.py +0 -0
  101. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/mergers_and_acquisitions/tests/__init__.py +0 -0
  102. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/mergers_and_acquisitions/tests/test_merger_and_acquisition_tools.py +0 -0
  103. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/prices/__init__.py +0 -0
  104. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/prices/price_models.py +0 -0
  105. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/prices/price_tools.py +0 -0
  106. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/prices/tests/__init__.py +0 -0
  107. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/prices/tests/test_price_models.py +0 -0
  108. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/prices/tests/test_price_tools.py +0 -0
  109. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/segments/__init__.py +0 -0
  110. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/segments/segment_models.py +0 -0
  111. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/segments/segment_tools.py +0 -0
  112. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/segments/tests/__init__.py +0 -0
  113. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/segments/tests/test_segment_tools.py +0 -0
  114. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/statements/__init__.py +0 -0
  115. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/statements/statement_models.py +0 -0
  116. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/statements/statement_tools.py +0 -0
  117. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/statements/tests/__init__.py +0 -0
  118. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/domains/statements/tests/test_statement_tools.py +0 -0
  119. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/README.md +0 -0
  120. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/__init__.py +0 -0
  121. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/local_mcp/__init__.py +0 -0
  122. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/local_mcp/kfinance_mcp.py +0 -0
  123. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/local_mcp/local_mcp.py +0 -0
  124. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tests/__init__.py +0 -0
  125. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tests/test_example_notebook.py +0 -0
  126. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/README.md +0 -0
  127. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/__init__.py +0 -0
  128. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/all_tools.py +0 -0
  129. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/prompts.py +0 -0
  130. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/static_tools/README.md +0 -0
  131. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/static_tools/__init__.py +0 -0
  132. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/static_tools/get_latest.py +0 -0
  133. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/static_tools/get_n_quarters_ago.py +0 -0
  134. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/static_tools/tests/__init__.py +0 -0
  135. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/static_tools/tests/test_get_lastest.py +0 -0
  136. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/static_tools/tests/test_get_n_quarters_ago.py +0 -0
  137. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/tests/__init__.py +0 -0
  138. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/tests/test_tool_calling_models.py +0 -0
  139. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/integrations/tool_calling/tool_calling_models.py +0 -0
  140. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/mcp.py +0 -0
  141. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/models/permission_models.py +0 -0
  142. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/kfinance/py.typed +0 -0
  143. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/pyproject.toml +0 -0
  144. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/scripts/copyright_line_check.sh +0 -0
  145. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/scripts/lint.sh +0 -0
  146. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/scripts/test.sh +0 -0
  147. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/setup.cfg +0 -0
  148. {kensho_kfinance-3.2.10 → kensho_kfinance-3.2.12}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kensho-kfinance
3
- Version: 3.2.10
3
+ Version: 3.2.12
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.10
3
+ Version: 3.2.12
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,4 +1,10 @@
1
1
  # Changelog
2
+ # 3.2.12
3
+ - Remove multiples line item support
4
+
5
+ # 3.2.11
6
+ - Add Handling of status code 400 for Capitalizations, Modify EV/TEV ratio to target quarterly or LTM
7
+
2
8
  # 3.2.10
3
9
  - Add CIQ company_id to GetInfoFromIdentifiersResp
4
10
 
@@ -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",
@@ -2,7 +2,7 @@ from copy import deepcopy
2
2
  from datetime import date
3
3
  from typing import Any
4
4
 
5
- from pydantic import BaseModel, Field, model_validator
5
+ from pydantic import BaseModel, ConfigDict, Field, model_validator
6
6
  from strenum import StrEnum
7
7
 
8
8
  from kfinance.client.models.decimal_with_unit import Money, Shares
@@ -28,6 +28,7 @@ class DailyCapitalization(BaseModel):
28
28
  class Capitalizations(BaseModel):
29
29
  """Capitalizations represents market cap, TEV, and shares outstanding for a date range"""
30
30
 
31
+ model_config = ConfigDict(validate_by_name=True)
31
32
  capitalizations: list[DailyCapitalization] = Field(validation_alias="market_caps")
32
33
 
33
34
  @model_validator(mode="before")
@@ -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
@@ -1599,127 +1599,6 @@ LINE_ITEMS: list[LineItemType] = [
1599
1599
  "dataitemid": 4034,
1600
1600
  "spgi_name": "Total Debt/Equity",
1601
1601
  },
1602
- {
1603
- "name": "last_close_tev_to_ebit",
1604
- "aliases": {
1605
- "ev_to_ebit",
1606
- "enterprise_value_to_ebit",
1607
- "enterprise_value_to_earnings_before_interest_and_taxes",
1608
- "tev_to_ebit",
1609
- "total_ev_to_ebit",
1610
- "total_enterprise_value_to_ebit",
1611
- "total_enterprise_value_to_earnings_before_interest_and_taxes",
1612
- "last_tev_to_ebit",
1613
- "last_total_ev_to_ebit",
1614
- "last_enterprise_value_to_ebit",
1615
- "last_enterprise_value_to_earnings_before_interest_and_taxes",
1616
- "last_total_enterprise_value_to_ebit",
1617
- "last_total_enterprise_value_to_earnings_before_interest_and_taxes",
1618
- "last_close_ev_to_ebit",
1619
- "last_close_enterprise_value_to_ebit",
1620
- "last_close_total_ev_to_ebit",
1621
- "last_close_enterprise_value_to_ebit",
1622
- "last_close_enterprise_value_to_earnings_before_interest_and_taxes",
1623
- "last_close_total_enterprise_value_to_ebit",
1624
- "last_close_total_enterprise_value_to_earnings_before_interest_and_taxes",
1625
- },
1626
- "dataitemid": 100062,
1627
- "spgi_name": "Last Close TEV / EBIT",
1628
- },
1629
- {
1630
- "name": "last_close_tev_to_ebitda",
1631
- "aliases": {
1632
- "ev_to_ebitda",
1633
- "enterprise_value_to_ebitda",
1634
- "enterprise_value_to_earnings_before_interest_taxes_depreciation_and_amortization",
1635
- "tev_to_ebitda",
1636
- "total_ev_to_ebitda",
1637
- "total_enterprise_value_to_ebitda",
1638
- "total_enterprise_value_to_earnings_before_interest_taxes_depreciation_and_amortization",
1639
- "last_tev_to_ebitda",
1640
- "last_total_ev_to_ebitda",
1641
- "last_enterprise_value_to_ebitda",
1642
- "last_enterprise_value_to_earnings_before_interest_taxes_depreciation_and_amortization",
1643
- "last_total_enterprise_value_to_ebitda",
1644
- "last_total_enterprise_value_to_earnings_before_interest_taxes_depreciation_and_amortization",
1645
- "last_close_total_ev_to_ebitda",
1646
- "last_close_enterprise_value_to_ebitda",
1647
- "last_close_enterprise_value_to_earnings_before_interest_taxes_depreciation_and_amortization",
1648
- "last_close_total_enterprise_value_to_ebitda",
1649
- "last_close_total_enterprise_value_to_earnings_before_interest_taxes_depreciation_and_amortization",
1650
- },
1651
- "dataitemid": 100063,
1652
- "spgi_name": "Last Close TEV / EBITDA",
1653
- },
1654
- {
1655
- "name": "ev_to_employees",
1656
- "aliases": {
1657
- "ev_to_employee_count",
1658
- "ev_to_headcount",
1659
- "enterprise_value_to_employees",
1660
- "enterprise_value_to_employee_count",
1661
- "enterprise_value_to_headcount",
1662
- "tev_to_employees",
1663
- "tev_to_employee_count",
1664
- "tev_to_headcount",
1665
- "total_ev_to_employees",
1666
- "total_ev_to_employee_count",
1667
- "total_ev_to_headcount",
1668
- "total_enterprise_value_to_employees",
1669
- "total_enterprise_value_to_employee_count",
1670
- "total_enterprise_value_to_headcount",
1671
- "last_ev_to_employees",
1672
- "last_ev_to_employee_count",
1673
- "last_ev_to_headcount",
1674
- "last_tev_to_employees",
1675
- "last_tev_to_employee_count",
1676
- "last_tev_to_headcount",
1677
- "last_total_ev_to_employees",
1678
- "last_total_ev_to_employee_count",
1679
- "last_total_ev_to_headcount",
1680
- "last_enterprise_value_to_employees",
1681
- "last_enterprise_value_to_employee_count",
1682
- "last_enterprise_value_to_headcount",
1683
- "last_total_enterprise_value_to_employees",
1684
- "last_total_enterprise_value_to_employee_count",
1685
- "last_total_enterprise_value_to_headcount",
1686
- "last_close_ev_to_employees",
1687
- "last_close_ev_to_employee_count",
1688
- "last_close_ev_to_headcount",
1689
- "last_close_tev_to_employees",
1690
- "last_close_tev_to_employee_count",
1691
- "last_close_tev_to_headcount",
1692
- "last_close_total_ev_to_employees",
1693
- "last_close_total_ev_to_employee_count",
1694
- "last_close_total_ev_to_headcount",
1695
- "last_close_enterprise_value_to_employees",
1696
- "last_close_enterprise_value_to_employee_count",
1697
- "last_close_enterprise_value_to_headcount",
1698
- "last_close_total_enterprise_value_to_employees",
1699
- "last_close_total_enterprise_value_to_employee_count",
1700
- "last_close_total_enterprise_value_to_headcount",
1701
- },
1702
- "dataitemid": 100070,
1703
- "spgi_name": "Last Close TEV / Employees",
1704
- },
1705
- {
1706
- "name": "ev_to_total_revenue",
1707
- "aliases": {
1708
- "tev_to_total_revenue",
1709
- "enterprise_value_to_total_revenue",
1710
- "total_enterprise_value_to_total_revenue",
1711
- "last_ev_to_total_revenue",
1712
- "last_tev_to_total_revenue",
1713
- "last_enterprise_value_to_total_revenue",
1714
- "last_enterprise_value_to_total_revenue",
1715
- "last_close_ev_to_total_revenue",
1716
- "last_close_tev_to_total_revenue",
1717
- "last_close_enterprise_value_to_total_revenue",
1718
- "last_close_enterprise_value_to_total_revenue",
1719
- },
1720
- "dataitemid": 100061,
1721
- "spgi_name": "Last Close TEV / Total Revenue",
1722
- },
1723
1602
  ]
1724
1603
  LINE_ITEM_NAMES_AND_ALIASES: list[str] = list(
1725
1604
  chain(*[[line_item["name"]] + list(line_item["aliases"]) for line_item in LINE_ITEMS])
@@ -44,6 +44,7 @@ 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).
47
48
 
48
49
  Example:
49
50
  Query: "What are the revenues of Lowe's and Home Depot?"
@@ -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.10'
32
- __version_tuple__ = version_tuple = (3, 2, 10)
31
+ __version__ = version = '3.2.12'
32
+ __version_tuple__ = version_tuple = (3, 2, 12)
33
33
 
34
- __commit_id__ = commit_id = 'g84992460d'
34
+ __commit_id__ = commit_id = 'gf57e257bc'