kensho-kfinance 2.6.3__tar.gz → 2.6.5__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 (88) hide show
  1. {kensho_kfinance-2.6.3/kensho_kfinance.egg-info → kensho_kfinance-2.6.5}/PKG-INFO +1 -1
  2. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5/kensho_kfinance.egg-info}/PKG-INFO +1 -1
  3. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/CHANGELOG.md +7 -1
  4. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/constants.py +1 -0
  5. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/kfinance.py +5 -2
  6. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/meta_classes.py +12 -5
  7. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tests/test_client.py +35 -0
  8. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_advisors_for_company_in_transaction_from_identifier.py +1 -1
  9. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_business_relationship_from_identifier.py +1 -1
  10. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_capitalization_from_identifier.py +1 -1
  11. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_competitors_from_identifier.py +2 -2
  12. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_cusip_from_ticker.py +1 -1
  13. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_earnings.py +4 -1
  14. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_financial_line_item_from_identifier.py +1 -1
  15. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_financial_statement_from_identifier.py +1 -1
  16. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_history_metadata_from_identifier.py +1 -1
  17. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_info_from_identifier.py +1 -1
  18. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_isin_from_ticker.py +1 -1
  19. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_latest.py +1 -1
  20. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_latest_earnings.py +4 -1
  21. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_merger_info_from_transaction_id.py +1 -1
  22. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_mergers_from_identifier.py +1 -1
  23. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_n_quarters_ago.py +1 -1
  24. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_next_earnings.py +4 -1
  25. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_prices_from_identifier.py +1 -1
  26. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_segments_from_identifier.py +1 -1
  27. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/get_transcript.py +1 -1
  28. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/resolve_identifier.py +1 -1
  29. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/shared_models.py +3 -1
  30. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/version.py +2 -2
  31. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/.coveragerc +0 -0
  32. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/.github/workflows/ci-lint.yml +0 -0
  33. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/.github/workflows/ci-test.yml +0 -0
  34. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/.github/workflows/python-publish.yml +0 -0
  35. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/.gitignore +0 -0
  36. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/.readthedocs.yaml +0 -0
  37. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/AUTHORS.md +0 -0
  38. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/CODE_OF_CONDUCT.md +0 -0
  39. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/CONTRIBUTING.md +0 -0
  40. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/LICENSE +0 -0
  41. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/README.md +0 -0
  42. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/docs/build_tool_calling_documentation.py +0 -0
  43. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/docs/conf.py +0 -0
  44. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/docs/index.rst +0 -0
  45. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/docs/kfinance.rst +0 -0
  46. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/docs/requirements.txt +0 -0
  47. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/docs/templates/apidoc/package.rst_t +0 -0
  48. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/docs/templates/apidoc/toc.rst_t +0 -0
  49. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/docs/tool_calling.rst +0 -0
  50. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/example_notebooks/basic_usage.ipynb +0 -0
  51. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/example_notebooks/tool_calling/langchain/anthropic_langchain_tool_calling.ipynb +0 -0
  52. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/example_notebooks/tool_calling/langchain/google_gemini_langchain_tool_calling.ipynb +0 -0
  53. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/example_notebooks/tool_calling/langchain/openai_langchain_tool_calling.ipynb +0 -0
  54. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/example_notebooks/tool_calling/non-langchain/anthropic_tool_calling.ipynb +0 -0
  55. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/example_notebooks/tool_calling/non-langchain/google_gemini_tool_calling.ipynb +0 -0
  56. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/example_notebooks/tool_calling/non-langchain/openai_langchain_tool_calling.ipynb +0 -0
  57. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/images/colab_logo_32px.png +0 -0
  58. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/justfile +0 -0
  59. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kensho_kfinance.egg-info/SOURCES.txt +0 -0
  60. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kensho_kfinance.egg-info/dependency_links.txt +0 -0
  61. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kensho_kfinance.egg-info/requires.txt +0 -0
  62. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kensho_kfinance.egg-info/top_level.txt +0 -0
  63. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/__init__.py +0 -0
  64. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/batch_request_handling.py +0 -0
  65. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/fetch.py +0 -0
  66. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/mcp.py +0 -0
  67. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/prompt.py +0 -0
  68. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/py.typed +0 -0
  69. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/pydantic_models.py +0 -0
  70. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/server_thread.py +0 -0
  71. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tests/__init__.py +0 -0
  72. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tests/conftest.py +0 -0
  73. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tests/scratch.py +0 -0
  74. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tests/test_batch_requests.py +0 -0
  75. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tests/test_example_notebook.py +0 -0
  76. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tests/test_fetch.py +0 -0
  77. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tests/test_group_objects.py +0 -0
  78. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tests/test_objects.py +0 -0
  79. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tests/test_tools.py +0 -0
  80. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/README.md +0 -0
  81. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/__init__.py +0 -0
  82. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/kfinance/tool_calling/prompts.py +0 -0
  83. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/pyproject.toml +0 -0
  84. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/scripts/copyright_line_check.sh +0 -0
  85. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/scripts/lint.sh +0 -0
  86. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/scripts/test.sh +0 -0
  87. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/setup.cfg +0 -0
  88. {kensho_kfinance-2.6.3 → kensho_kfinance-2.6.5}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kensho-kfinance
3
- Version: 2.6.3
3
+ Version: 2.6.5
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: 2.6.3
3
+ Version: 2.6.5
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,12 @@
1
1
  # Changelog
2
2
 
3
- # v2.6.3
3
+ ## v2.6.5
4
+ - Add competitor company_name
5
+
6
+ ## v2.6.4
7
+ - Add transcript permission and update accepted_permissions type to set[Permission]
8
+
9
+ ## v2.6.3
4
10
  - Bump urllib3 to 2.5 to address CVEs
5
11
 
6
12
  ## v2.6.2
@@ -94,6 +94,7 @@ class BusinessRelationshipType(StrEnum):
94
94
 
95
95
  class Permission(StrEnum):
96
96
  EarningsPermission = "EarningsPermission"
97
+ TranscriptsPermission = "TranscriptsPermission"
97
98
  GICSPermission = "GICSPermission"
98
99
  IDPermission = "IDPermission"
99
100
  ISCRSPermission = "ISCRSPermission"
@@ -1644,8 +1644,11 @@ class Client:
1644
1644
  for tool_cls in ALL_TOOLS:
1645
1645
  tool = tool_cls(kfinance_client=self) # type: ignore[call-arg]
1646
1646
  if (
1647
- tool.required_permission is None
1648
- or tool.required_permission in self.kfinance_api_client.user_permissions
1647
+ tool.accepted_permissions is None
1648
+ # if one or more of the required permission for a tool is a permission the user has
1649
+ or tool.accepted_permissions.intersection(
1650
+ self.kfinance_api_client.user_permissions
1651
+ )
1649
1652
  ):
1650
1653
  self._tools.append(tool)
1651
1654
 
@@ -427,19 +427,26 @@ class CompanyFunctionsMetaClass:
427
427
  def competitors(
428
428
  self, competitor_source: CompetitorSource = CompetitorSource.all
429
429
  ) -> "Companies":
430
- """Get the list of companies that are competitors of company_id, optionally filtered by the competitor_source type.
430
+ """Get the list of company_id and company_name that are competitors of company_id, optionally filtered by the competitor_source type.
431
431
 
432
- :return: The list of companies that are competitors of company_id, optionally filtered by the competitor_source type
432
+ :return: The list of company_id and company_name that are competitors of company_id, optionally filtered by the competitor_source type
433
433
  :rtype: Companies
434
434
  """
435
- from .kfinance import Companies
435
+ from .kfinance import Companies, Company
436
436
 
437
437
  competitors_data = self.kfinance_api_client.fetch_competitors(
438
438
  company_id=self.company_id, competitor_source=competitor_source
439
- )["companies"]
439
+ )["competitors"]
440
440
  return Companies(
441
441
  kfinance_api_client=self.kfinance_api_client,
442
- company_ids=[company["company_id"] for company in competitors_data],
442
+ companies=[
443
+ Company(
444
+ kfinance_api_client=self.kfinance_api_client,
445
+ company_id=company["company_id"],
446
+ company_name=company["company_name"],
447
+ )
448
+ for company in competitors_data
449
+ ],
443
450
  )
444
451
 
445
452
 
@@ -6,9 +6,14 @@ from kfinance.constants import Permission
6
6
  from kfinance.kfinance import Client
7
7
  from kfinance.tool_calling import (
8
8
  GetBusinessRelationshipFromIdentifier,
9
+ GetEarnings,
9
10
  GetFinancialStatementFromIdentifier,
10
11
  GetLatest,
12
+ GetLatestEarnings,
13
+ GetNextEarnings,
14
+ GetTranscript,
11
15
  )
16
+ from kfinance.tool_calling.shared_models import KfinanceTool
12
17
 
13
18
 
14
19
  class TestLangchainTools:
@@ -52,3 +57,33 @@ class TestLangchainTools:
52
57
  assert GetLatest in tool_classes
53
58
  # User should not have access to functions that require statement permissions
54
59
  assert GetFinancialStatementFromIdentifier not in tool_classes
60
+
61
+ @pytest.mark.parametrize(
62
+ "user_permission, expected_tool",
63
+ [
64
+ pytest.param(
65
+ Permission.TranscriptsPermission, GetTranscript, id="Transcript Permissions"
66
+ ),
67
+ pytest.param(Permission.EarningsPermission, GetEarnings, id="Earnings Permissions"),
68
+ ],
69
+ )
70
+ def test_permission_set_handling(
71
+ self, user_permission: Permission, expected_tool: KfinanceTool, mock_client: Client
72
+ ):
73
+ """
74
+ GIVEN a user with a permission that is in a set of required permission for a tool
75
+ WHEN we filter tools by permissions
76
+ THEN we successfully return the correct tools that either don't require permissions or tools that the user
77
+ specifically has access to.
78
+ """
79
+ mock_client.kfinance_api_client._user_permissions = {user_permission} # noqa: SLF001
80
+ tool_classes = [type(t) for t in mock_client.langchain_tools]
81
+ # User should have access to GetEarnings, GetNextEarnings, GetLatestEarnings, GetTranscript
82
+ assert GetEarnings in tool_classes
83
+ assert GetNextEarnings in tool_classes
84
+ assert GetLatestEarnings in tool_classes
85
+ assert expected_tool in tool_classes
86
+ # User should have access to functions that don't require permissions
87
+ assert GetLatest in tool_classes
88
+ # User should not have access to functions that require statement permissions
89
+ assert GetFinancialStatementFromIdentifier not in tool_classes
@@ -15,7 +15,7 @@ class GetAdvisorsForCompanyInTransactionFromIdentifier(KfinanceTool):
15
15
  name: str = "get_advisors_for_company_in_transaction_from_identifier"
16
16
  description: str = 'Get the companies advising a company in a given transaction. For example, "Who advised S&P Global during their purchase of Kensho?"'
17
17
  args_schema: Type[BaseModel] = GetAdvisorsForCompanyInTransactionFromIdentifierArgs
18
- required_permission: Permission | None = Permission.MergersPermission
18
+ accepted_permissions: set[Permission] | None = {Permission.MergersPermission}
19
19
 
20
20
  def _run(self, identifier: str, transaction_id: int) -> list:
21
21
  ticker = self.kfinance_client.ticker(identifier)
@@ -16,7 +16,7 @@ class GetBusinessRelationshipFromIdentifier(KfinanceTool):
16
16
  name: str = "get_business_relationship_from_identifier"
17
17
  description: str = 'Get the current and previous company IDs that are relationship_type of a given identifier. For example, "What are the current distributors of SPGI?" or "What are the previous borrowers of JPM?"'
18
18
  args_schema: Type[BaseModel] = GetBusinessRelationshipFromIdentifierArgs
19
- required_permission: Permission | None = Permission.RelationshipPermission
19
+ accepted_permissions: set[Permission] | None = {Permission.RelationshipPermission}
20
20
 
21
21
  def _run(self, identifier: str, business_relationship: BusinessRelationshipType) -> dict:
22
22
  ticker = self.kfinance_client.ticker(identifier)
@@ -21,7 +21,7 @@ class GetCapitalizationFromIdentifier(KfinanceTool):
21
21
  name: str = "get_capitalization_from_identifier"
22
22
  description: str = "Get the historical market cap, tev (Total Enterprise Value), or shares outstanding of an identifier between inclusive start_date and inclusive end date. When requesting the most recent values, leave start_date and end_date empty."
23
23
  args_schema = GetCapitalizationFromIdentifierArgs
24
- required_permission: Permission | None = Permission.PricingPermission
24
+ accepted_permissions: set[Permission] | None = {Permission.PricingPermission}
25
25
 
26
26
  def _run(
27
27
  self,
@@ -9,9 +9,9 @@ class GetCompetitorsFromIdentifierArgs(ToolArgsWithIdentifier):
9
9
 
10
10
  class GetCompetitorsFromIdentifier(KfinanceTool):
11
11
  name: str = "get_competitors_from_identifier"
12
- description: str = "Retrieves a list of competitors for a given company, optionally filtered by the source of the competitor information."
12
+ description: str = "Retrieves a list of company_id and company_name that are competitors for a given company, optionally filtered by the source of the competitor information."
13
13
  args_schema = GetCompetitorsFromIdentifierArgs
14
- required_permission: Permission | None = Permission.CompetitorsPermission
14
+ accepted_permissions: set[Permission] | None = {Permission.CompetitorsPermission}
15
15
 
16
16
  def _run(
17
17
  self,
@@ -14,7 +14,7 @@ class GetCusipFromTicker(KfinanceTool):
14
14
  name: str = "get_cusip_from_ticker"
15
15
  description: str = "Get the CUSIP associated with a ticker."
16
16
  args_schema: Type[BaseModel] = GetCusipFromTickerArgs
17
- required_permission: Permission | None = Permission.IDPermission
17
+ accepted_permissions: set[Permission] | None = {Permission.IDPermission}
18
18
 
19
19
  def _run(self, ticker_str: str) -> str:
20
20
  return self.kfinance_client.ticker(ticker_str).cusip
@@ -11,7 +11,10 @@ class GetEarnings(KfinanceTool):
11
11
  name: str = "get_earnings"
12
12
  description: str = "Get all earnings for a given identifier. Returns a list of dictionaries, each with 'name' (str), 'key_dev_id' (int), and 'datetime' (str in ISO 8601 format with UTC timezone) attributes."
13
13
  args_schema: Type[BaseModel] = ToolArgsWithIdentifier
14
- required_permission: Permission | None = Permission.EarningsPermission
14
+ accepted_permissions: set[Permission] | None = {
15
+ Permission.EarningsPermission,
16
+ Permission.TranscriptsPermission,
17
+ }
15
18
 
16
19
  def _run(self, identifier: str) -> list[dict]:
17
20
  ticker = self.kfinance_client.ticker(identifier)
@@ -24,7 +24,7 @@ class GetFinancialLineItemFromIdentifier(KfinanceTool):
24
24
  name: str = "get_financial_line_item_from_identifier"
25
25
  description: str = "Get the financial line item associated with an identifier."
26
26
  args_schema: Type[BaseModel] = GetFinancialLineItemFromIdentifierArgs
27
- required_permission: Permission | None = Permission.StatementsPermission
27
+ accepted_permissions: set[Permission] | None = {Permission.StatementsPermission}
28
28
 
29
29
  def _run(
30
30
  self,
@@ -20,7 +20,7 @@ class GetFinancialStatementFromIdentifier(KfinanceTool):
20
20
  name: str = "get_financial_statement_from_identifier"
21
21
  description: str = "Get the financial statement associated with an identifier."
22
22
  args_schema: Type[BaseModel] = GetFinancialStatementFromIdentifierArgs
23
- required_permission: Permission | None = Permission.StatementsPermission
23
+ accepted_permissions: set[Permission] | None = {Permission.StatementsPermission}
24
24
 
25
25
  def _run(
26
26
  self,
@@ -10,7 +10,7 @@ class GetHistoryMetadataFromIdentifier(KfinanceTool):
10
10
  name: str = "get_history_metadata_from_identifier"
11
11
  description: str = "Get the history metadata associated with an identifier. History metadata includes currency, symbol, exchange name, instrument type, and first trade date."
12
12
  args_schema: Type[BaseModel] = ToolArgsWithIdentifier
13
- required_permission: Permission | None = None
13
+ accepted_permissions: set[Permission] | None = None
14
14
 
15
15
  def _run(self, identifier: str) -> HistoryMetadata:
16
16
  return self.kfinance_client.ticker(identifier).history_metadata
@@ -10,7 +10,7 @@ class GetInfoFromIdentifier(KfinanceTool):
10
10
  name: str = "get_info_from_identifier"
11
11
  description: str = "Get the information associated with an identifier. 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."
12
12
  args_schema: Type[BaseModel] = ToolArgsWithIdentifier
13
- required_permission: Permission | None = None
13
+ accepted_permissions: set[Permission] | None = None
14
14
 
15
15
  def _run(self, identifier: str) -> str:
16
16
  return str(self.kfinance_client.ticker(identifier).info)
@@ -14,7 +14,7 @@ class GetIsinFromTicker(KfinanceTool):
14
14
  name: str = "get_isin_from_ticker"
15
15
  description: str = "Get the ISIN associated with a ticker."
16
16
  args_schema: Type[BaseModel] = GetIsinFromTickerArgs
17
- required_permission: Permission | None = Permission.IDPermission
17
+ accepted_permissions: set[Permission] | None = {Permission.IDPermission}
18
18
 
19
19
  def _run(self, ticker_str: str) -> str:
20
20
  return self.kfinance_client.ticker(ticker_str).isin
@@ -16,7 +16,7 @@ class GetLatest(KfinanceTool):
16
16
  name: str = "get_latest"
17
17
  description: str = "Get the latest annual reporting year, latest quarterly reporting quarter and year, and current date."
18
18
  args_schema: Type[BaseModel] = GetLatestArgs
19
- required_permission: Permission | None = None
19
+ accepted_permissions: set[Permission] | None = None
20
20
 
21
21
  def _run(self, use_local_timezone: bool = True) -> LatestPeriods:
22
22
  return self.kfinance_client.get_latest(use_local_timezone=use_local_timezone)
@@ -11,7 +11,10 @@ class GetLatestEarnings(KfinanceTool):
11
11
  name: str = "get_latest_earnings"
12
12
  description: str = "Get the latest earnings for a given identifier. Returns a dictionary with 'name' (str), 'key_dev_id' (int), and 'datetime' (str in ISO 8601 format with UTC timezone) attributes."
13
13
  args_schema: Type[BaseModel] = ToolArgsWithIdentifier
14
- required_permission: Permission | None = Permission.EarningsPermission
14
+ accepted_permissions: set[Permission] | None = {
15
+ Permission.EarningsPermission,
16
+ Permission.TranscriptsPermission,
17
+ }
15
18
 
16
19
  def _run(self, identifier: str) -> dict:
17
20
  ticker = self.kfinance_client.ticker(identifier)
@@ -15,7 +15,7 @@ class GetMergerInfoFromTransactionId(KfinanceTool):
15
15
  name: str = "get_merger_info_from_transaction_id"
16
16
  description: str = 'Get the timeline, the participants, and the consideration of the merger or acquisition from the given transaction ID. For example, "How much was Ben & Jerrys purchased for?" or "What was the price per share for LinkedIn?" or "When did S&P purchase Kensho?"'
17
17
  args_schema: Type[BaseModel] = GetMergerInfoFromTransactionIdArgs
18
- required_permission: Permission | None = Permission.MergersPermission
18
+ accepted_permissions: set[Permission] | None = {Permission.MergersPermission}
19
19
 
20
20
  def _run(self, transaction_id: int) -> dict:
21
21
  merger_or_acquisition = MergerOrAcquisition(
@@ -10,7 +10,7 @@ class GetMergersFromIdentifier(KfinanceTool):
10
10
  name: str = "get_mergers_from_identifier"
11
11
  description: str = 'Get the transaction IDs that involve the given identifier. For example, "Which companies did Microsoft purchase?" or "Which company bought Ben & Jerrys?"'
12
12
  args_schema: Type[BaseModel] = ToolArgsWithIdentifier
13
- required_permission: Permission | None = Permission.MergersPermission
13
+ accepted_permissions: set[Permission] | None = {Permission.MergersPermission}
14
14
 
15
15
  def _run(self, identifier: str) -> dict:
16
16
  ticker = self.kfinance_client.ticker(identifier)
@@ -16,7 +16,7 @@ class GetNQuartersAgo(KfinanceTool):
16
16
  "Get the year and quarter corresponding to [n] quarters before the current quarter."
17
17
  )
18
18
  args_schema: Type[BaseModel] = GetNQuartersAgoArgs
19
- required_permission: Permission | None = None
19
+ accepted_permissions: set[Permission] | None = None
20
20
 
21
21
  def _run(self, n: int) -> YearAndQuarter:
22
22
  return self.kfinance_client.get_n_quarters_ago(n)
@@ -11,7 +11,10 @@ class GetNextEarnings(KfinanceTool):
11
11
  name: str = "get_next_earnings"
12
12
  description: str = "Get the next earnings for a given identifier. Returns a dictionary with 'name' (str), 'key_dev_id' (int), and 'datetime' (str in ISO 8601 format with UTC timezone) attributes."
13
13
  args_schema: Type[BaseModel] = ToolArgsWithIdentifier
14
- required_permission: Permission | None = Permission.EarningsPermission
14
+ accepted_permissions: set[Permission] | None = {
15
+ Permission.EarningsPermission,
16
+ Permission.TranscriptsPermission,
17
+ }
15
18
 
16
19
  def _run(self, identifier: str) -> dict:
17
20
  ticker = self.kfinance_client.ticker(identifier)
@@ -26,7 +26,7 @@ class GetPricesFromIdentifier(KfinanceTool):
26
26
  name: str = "get_prices_from_identifier"
27
27
  description: str = "Get the historical open, high, low, and close prices, and volume of an identifier between inclusive start_date and inclusive end date. When requesting the most recent values, leave start_date and end_date empty."
28
28
  args_schema: Type[BaseModel] = GetPricesFromIdentifierArgs
29
- required_permission: Permission | None = Permission.PricingPermission
29
+ accepted_permissions: set[Permission] | None = {Permission.PricingPermission}
30
30
 
31
31
  def _run(
32
32
  self,
@@ -20,7 +20,7 @@ class GetSegmentsFromIdentifier(KfinanceTool):
20
20
  name: str = "get_segments_from_identifier"
21
21
  description: str = "Get the templated segments associated with an identifier."
22
22
  args_schema: Type[BaseModel] = GetSegmentsFromIdentifierArgs
23
- required_permission: Permission | None = Permission.SegmentsPermission
23
+ accepted_permissions: set[Permission] | None = {Permission.SegmentsPermission}
24
24
 
25
25
  def _run(
26
26
  self,
@@ -16,7 +16,7 @@ class GetTranscript(KfinanceTool):
16
16
  name: str = "get_transcript"
17
17
  description: str = "Get the raw transcript text for an earnings call by key dev ID."
18
18
  args_schema: Type[BaseModel] = GetTranscriptArgs
19
- required_permission: Permission | None = Permission.EarningsPermission
19
+ accepted_permissions: set[Permission] | None = {Permission.TranscriptsPermission}
20
20
 
21
21
  def _run(self, key_dev_id: int) -> str:
22
22
  transcript = self.kfinance_client.transcript(key_dev_id)
@@ -12,7 +12,7 @@ class ResolveIdentifier(KfinanceTool):
12
12
  "Get the company_id, security_id, and trading_item_id associated with an identifier."
13
13
  )
14
14
  args_schema: Type[BaseModel] = ToolArgsWithIdentifier
15
- required_permission: Permission | None = None
15
+ accepted_permissions: set[Permission] | None = None
16
16
 
17
17
  def _run(self, identifier: str) -> dict[str, int]:
18
18
  return self.kfinance_client.ticker(identifier).id_triple._asdict()
@@ -16,7 +16,9 @@ class KfinanceTool(BaseTool):
16
16
 
17
17
  kfinance_client: Client
18
18
  args_schema: Type[BaseModel]
19
- required_permission: Permission | None
19
+ accepted_permissions: set[Permission] | None = Field(
20
+ description="The set of accepted permissions needed to access the tool. Only one of the permissions is required (or None)."
21
+ )
20
22
 
21
23
  model_config = ConfigDict(populate_by_name=True, extra="forbid")
22
24
 
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '2.6.3'
21
- __version_tuple__ = version_tuple = (2, 6, 3)
20
+ __version__ = version = '2.6.5'
21
+ __version_tuple__ = version_tuple = (2, 6, 5)
File without changes