kensho-kfinance 2.7.0__tar.gz → 2.9.0__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 (104) hide show
  1. {kensho_kfinance-2.7.0/kensho_kfinance.egg-info → kensho_kfinance-2.9.0}/PKG-INFO +2 -2
  2. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/example_notebooks/basic_usage.ipynb +2 -2
  3. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0/kensho_kfinance.egg-info}/PKG-INFO +2 -2
  4. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kensho_kfinance.egg-info/SOURCES.txt +18 -2
  5. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kensho_kfinance.egg-info/requires.txt +1 -1
  6. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/CHANGELOG.md +6 -0
  7. kensho_kfinance-2.9.0/kfinance/decimal_with_unit.py +78 -0
  8. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/fetch.py +15 -16
  9. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/kfinance.py +108 -122
  10. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/meta_classes.py +28 -27
  11. kensho_kfinance-2.9.0/kfinance/models/business_relationship_models.py +26 -0
  12. kensho_kfinance-2.9.0/kfinance/models/capitalization_models.py +90 -0
  13. kensho_kfinance-2.9.0/kfinance/models/competitor_models.py +13 -0
  14. kensho_kfinance-2.9.0/kfinance/models/currency_models.py +345 -0
  15. kensho_kfinance-2.9.0/kfinance/models/date_and_period_models.py +48 -0
  16. kensho_kfinance-2.9.0/kfinance/models/id_models.py +7 -0
  17. kensho_kfinance-2.9.0/kfinance/models/industry_models.py +12 -0
  18. kensho_kfinance-2.7.0/kfinance/constants.py → kensho_kfinance-2.9.0/kfinance/models/line_item_models.py +1 -165
  19. kensho_kfinance-2.9.0/kfinance/models/permission_models.py +15 -0
  20. kensho_kfinance-2.9.0/kfinance/models/price_models.py +70 -0
  21. kensho_kfinance-2.9.0/kfinance/models/segment_models.py +8 -0
  22. kensho_kfinance-2.9.0/kfinance/models/statement_models.py +9 -0
  23. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tests/test_batch_requests.py +61 -31
  24. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tests/test_client.py +1 -1
  25. kensho_kfinance-2.9.0/kfinance/tests/test_decimal_with_unit.py +60 -0
  26. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tests/test_example_notebook.py +1 -0
  27. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tests/test_fetch.py +23 -12
  28. kensho_kfinance-2.9.0/kfinance/tests/test_models/__init__.py +0 -0
  29. kensho_kfinance-2.9.0/kfinance/tests/test_models/test_capitalization_models.py +83 -0
  30. kensho_kfinance-2.9.0/kfinance/tests/test_models/test_price_models.py +58 -0
  31. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tests/test_objects.py +107 -57
  32. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tests/test_tools.py +35 -11
  33. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_advisors_for_company_in_transaction_from_identifier.py +10 -7
  34. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_business_relationship_from_identifier.py +2 -1
  35. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_capitalization_from_identifier.py +4 -5
  36. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_competitors_from_identifier.py +2 -1
  37. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_cusip_from_ticker.py +1 -1
  38. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_earnings.py +1 -1
  39. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_financial_line_item_from_identifier.py +3 -1
  40. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_financial_statement_from_identifier.py +3 -1
  41. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_history_metadata_from_identifier.py +2 -1
  42. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_info_from_identifier.py +1 -1
  43. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_isin_from_ticker.py +1 -1
  44. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_latest.py +2 -1
  45. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_latest_earnings.py +1 -1
  46. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_merger_info_from_transaction_id.py +6 -5
  47. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_mergers_from_identifier.py +4 -1
  48. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_n_quarters_ago.py +2 -1
  49. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_next_earnings.py +1 -1
  50. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_prices_from_identifier.py +4 -3
  51. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_segments_from_identifier.py +3 -1
  52. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/get_transcript.py +1 -1
  53. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/resolve_identifier.py +1 -1
  54. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/shared_models.py +1 -1
  55. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/version.py +2 -2
  56. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/pyproject.toml +1 -1
  57. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/.coveragerc +0 -0
  58. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/.github/workflows/ci-lint.yml +0 -0
  59. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/.github/workflows/ci-test.yml +0 -0
  60. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/.github/workflows/python-publish.yml +0 -0
  61. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/.gitignore +0 -0
  62. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/.readthedocs.yaml +0 -0
  63. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/AUTHORS.md +0 -0
  64. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/CODE_OF_CONDUCT.md +0 -0
  65. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/CONTRIBUTING.md +0 -0
  66. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/LICENSE +0 -0
  67. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/README.md +0 -0
  68. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/docs/build_tool_calling_documentation.py +0 -0
  69. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/docs/conf.py +0 -0
  70. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/docs/index.rst +0 -0
  71. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/docs/kfinance.rst +0 -0
  72. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/docs/requirements.txt +0 -0
  73. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/docs/templates/apidoc/package.rst_t +0 -0
  74. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/docs/templates/apidoc/toc.rst_t +0 -0
  75. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/docs/tool_calling.rst +0 -0
  76. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/example_notebooks/tool_calling/langchain/anthropic_langchain_tool_calling.ipynb +0 -0
  77. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/example_notebooks/tool_calling/langchain/google_gemini_langchain_tool_calling.ipynb +0 -0
  78. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/example_notebooks/tool_calling/langchain/openai_langchain_tool_calling.ipynb +0 -0
  79. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/example_notebooks/tool_calling/non-langchain/anthropic_tool_calling.ipynb +0 -0
  80. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/example_notebooks/tool_calling/non-langchain/google_gemini_tool_calling.ipynb +0 -0
  81. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/example_notebooks/tool_calling/non-langchain/openai_langchain_tool_calling.ipynb +0 -0
  82. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/images/colab_logo_32px.png +0 -0
  83. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/justfile +0 -0
  84. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kensho_kfinance.egg-info/dependency_links.txt +0 -0
  85. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kensho_kfinance.egg-info/top_level.txt +0 -0
  86. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/__init__.py +0 -0
  87. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/batch_request_handling.py +0 -0
  88. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/mcp.py +0 -0
  89. {kensho_kfinance-2.7.0/kfinance/tests → kensho_kfinance-2.9.0/kfinance/models}/__init__.py +0 -0
  90. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/prompt.py +0 -0
  91. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/py.typed +0 -0
  92. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/pydantic_models.py +0 -0
  93. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/server_thread.py +0 -0
  94. /kensho_kfinance-2.7.0/kfinance/tests/scratch.py → /kensho_kfinance-2.9.0/kfinance/tests/__init__.py +0 -0
  95. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tests/conftest.py +0 -0
  96. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tests/test_group_objects.py +0 -0
  97. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/README.md +0 -0
  98. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/__init__.py +0 -0
  99. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/kfinance/tool_calling/prompts.py +0 -0
  100. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/scripts/copyright_line_check.sh +0 -0
  101. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/scripts/lint.sh +0 -0
  102. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/scripts/test.sh +0 -0
  103. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/setup.cfg +0 -0
  104. {kensho_kfinance-2.7.0 → kensho_kfinance-2.9.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kensho-kfinance
3
- Version: 2.7.0
3
+ Version: 2.9.0
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
@@ -14,7 +14,7 @@ License-File: LICENSE
14
14
  License-File: AUTHORS.md
15
15
  Requires-Dist: cachetools<6,>=5.5
16
16
  Requires-Dist: click<=9,>=8.2.1
17
- Requires-Dist: fastmcp<3,>=2
17
+ Requires-Dist: fastmcp<2.10,>=2.9
18
18
  Requires-Dist: langchain-core>=0.3.15
19
19
  Requires-Dist: langchain-google-genai<3,>=2.1.5
20
20
  Requires-Dist: numpy>=1.22.4
@@ -98,7 +98,7 @@
98
98
  "metadata": {},
99
99
  "outputs": [],
100
100
  "source": [
101
- "from kfinance.constants import PeriodType\n",
101
+ "from kfinance.models.date_and_period_models import PeriodType\n",
102
102
  "\n",
103
103
  "# You can create a Ticker object with client.ticker.\n",
104
104
  "# A Ticker has access to a wide variety of attributes, including prices, \n",
@@ -220,7 +220,7 @@
220
220
  "execution_count": null,
221
221
  "outputs": [],
222
222
  "source": [
223
- "from kfinance.constants import Periodicity\n",
223
+ "from kfinance.models.date_and_period_models import Periodicity\n",
224
224
  "\n",
225
225
  "# To fetch recent spgi prices, you can use the `history` function.\n",
226
226
  "# Without any further configuration `history()` will return adjusted\n",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kensho-kfinance
3
- Version: 2.7.0
3
+ Version: 2.9.0
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
@@ -14,7 +14,7 @@ License-File: LICENSE
14
14
  License-File: AUTHORS.md
15
15
  Requires-Dist: cachetools<6,>=5.5
16
16
  Requires-Dist: click<=9,>=8.2.1
17
- Requires-Dist: fastmcp<3,>=2
17
+ Requires-Dist: fastmcp<2.10,>=2.9
18
18
  Requires-Dist: langchain-core>=0.3.15
19
19
  Requires-Dist: langchain-google-genai<3,>=2.1.5
20
20
  Requires-Dist: numpy>=1.22.4
@@ -36,7 +36,7 @@ kensho_kfinance.egg-info/top_level.txt
36
36
  kfinance/CHANGELOG.md
37
37
  kfinance/__init__.py
38
38
  kfinance/batch_request_handling.py
39
- kfinance/constants.py
39
+ kfinance/decimal_with_unit.py
40
40
  kfinance/fetch.py
41
41
  kfinance/kfinance.py
42
42
  kfinance/mcp.py
@@ -46,16 +46,32 @@ kfinance/py.typed
46
46
  kfinance/pydantic_models.py
47
47
  kfinance/server_thread.py
48
48
  kfinance/version.py
49
+ kfinance/models/__init__.py
50
+ kfinance/models/business_relationship_models.py
51
+ kfinance/models/capitalization_models.py
52
+ kfinance/models/competitor_models.py
53
+ kfinance/models/currency_models.py
54
+ kfinance/models/date_and_period_models.py
55
+ kfinance/models/id_models.py
56
+ kfinance/models/industry_models.py
57
+ kfinance/models/line_item_models.py
58
+ kfinance/models/permission_models.py
59
+ kfinance/models/price_models.py
60
+ kfinance/models/segment_models.py
61
+ kfinance/models/statement_models.py
49
62
  kfinance/tests/__init__.py
50
63
  kfinance/tests/conftest.py
51
- kfinance/tests/scratch.py
52
64
  kfinance/tests/test_batch_requests.py
53
65
  kfinance/tests/test_client.py
66
+ kfinance/tests/test_decimal_with_unit.py
54
67
  kfinance/tests/test_example_notebook.py
55
68
  kfinance/tests/test_fetch.py
56
69
  kfinance/tests/test_group_objects.py
57
70
  kfinance/tests/test_objects.py
58
71
  kfinance/tests/test_tools.py
72
+ kfinance/tests/test_models/__init__.py
73
+ kfinance/tests/test_models/test_capitalization_models.py
74
+ kfinance/tests/test_models/test_price_models.py
59
75
  kfinance/tool_calling/README.md
60
76
  kfinance/tool_calling/__init__.py
61
77
  kfinance/tool_calling/get_advisors_for_company_in_transaction_from_identifier.py
@@ -1,6 +1,6 @@
1
1
  cachetools<6,>=5.5
2
2
  click<=9,>=8.2.1
3
- fastmcp<3,>=2
3
+ fastmcp<2.10,>=2.9
4
4
  langchain-core>=0.3.15
5
5
  langchain-google-genai<3,>=2.1.5
6
6
  numpy>=1.22.4
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v2.9.0
4
+ - Limit FastMCP version
5
+
6
+ ## v2.8.0
7
+ - Add currency to get_capitalization and get_prices tools.
8
+
3
9
  ## v2.7.0
4
10
  - Expose a new list of LLM tools `grounding_tools` that return a list of all endpoint urls called
5
11
 
@@ -0,0 +1,78 @@
1
+ from copy import deepcopy
2
+ from decimal import Decimal
3
+ from typing import Any
4
+
5
+ from pydantic import BaseModel, Field, model_validator
6
+ from typing_extensions import Self
7
+
8
+ from kfinance.models.currency_models import ISO_CODE_TO_CURRENCY
9
+
10
+
11
+ class DecimalWithUnit(BaseModel):
12
+ """DecimalWithUnit (DWU) represents a decimal with a corresponding unit like $100 or 20 shares.
13
+
14
+ In addition to a value and unit, each DWU has a `conventional_decimals` attribute,
15
+ which indicates the number of decimals that should be represented.
16
+ For example, for USD, conventional_decimals is 2, which will display as "1.00".
17
+ For shares, conventional_decimals is 0, which will display as "1"
18
+
19
+ Usually, rather than initializing a DWU directly, you'll likely want to use an
20
+ existing subclass like `Money` or `Shares` or create a new one.
21
+ """
22
+
23
+ value: Decimal
24
+ unit: str
25
+ # exclude conventional_decimals from serialization
26
+ conventional_decimals: int = Field(exclude=True)
27
+
28
+ @model_validator(mode="after")
29
+ def quantize_value(self) -> Self:
30
+ """Quantize the value at the end of the deserialization.
31
+
32
+ The value gets adjusted so that it always has the expected number of decimals defined in
33
+ conventional_decimals.
34
+ For USD with conventional_decimals=2, it will show values like "1.00"
35
+ For Shares with conventional_decimals=0, it will show values like "1"
36
+ """
37
+ exponent = Decimal("10") ** Decimal(-self.conventional_decimals)
38
+ self.value = self.value.quantize(exp=exponent)
39
+ return self
40
+
41
+
42
+ class Money(DecimalWithUnit):
43
+ @model_validator(mode="before")
44
+ @classmethod
45
+ def inject_conventional_decimals_into_data(cls, data: Any) -> Any:
46
+ """Inject conventional_decimals into data dict.
47
+
48
+ Each currency has an associated conventional_decimals defined in the
49
+ CURRENCIES list. This validator fetches that number and injects it into the
50
+ data dict.
51
+ """
52
+
53
+ if isinstance(data, dict) and "conventional_decimals" not in data:
54
+ data = deepcopy(data)
55
+ currency = ISO_CODE_TO_CURRENCY[data["unit"]]
56
+ data["conventional_decimals"] = currency.conventional_decimals
57
+
58
+ return data
59
+
60
+
61
+ class Shares(DecimalWithUnit):
62
+ unit: str = "Shares"
63
+ conventional_decimals: int = Field(exclude=True, default=0)
64
+
65
+ @model_validator(mode="before")
66
+ @classmethod
67
+ def convert_numbers_to_dicts(cls, data: Any) -> Any:
68
+ """Convert numbers into dicts.
69
+
70
+ The shares class can be built from a single number because unit and
71
+ conventional_decimals are always the same. However, the parser expects a
72
+ dict instead of a number, so we have to convert any number ("10") into a
73
+ dict {"value": "10"}.
74
+ """
75
+
76
+ if isinstance(data, (str, int, float, Decimal)):
77
+ data = {"value": data}
78
+ return data
@@ -10,23 +10,22 @@ import jwt
10
10
  from pydantic import ValidationError
11
11
  import requests
12
12
 
13
- from .constants import (
14
- BusinessRelationshipType,
15
- CompetitorSource,
16
- IdentificationTriple,
17
- IndustryClassification,
18
- Periodicity,
19
- PeriodType,
20
- Permission,
21
- SegmentType,
22
- )
23
- from .pydantic_models import RelationshipResponse, RelationshipResponseNoName
13
+ from kfinance.models.business_relationship_models import BusinessRelationshipType
14
+ from kfinance.models.capitalization_models import Capitalizations
15
+ from kfinance.models.competitor_models import CompetitorSource
16
+ from kfinance.models.date_and_period_models import Periodicity, PeriodType
17
+ from kfinance.models.id_models import IdentificationTriple
18
+ from kfinance.models.industry_models import IndustryClassification
19
+ from kfinance.models.permission_models import Permission
20
+ from kfinance.models.price_models import PriceHistory
21
+ from kfinance.models.segment_models import SegmentType
22
+ from kfinance.pydantic_models import RelationshipResponse, RelationshipResponseNoName
24
23
 
25
24
 
26
25
  # version.py gets autogenerated by setuptools-scm and is not available
27
26
  # during local development.
28
27
  try:
29
- from .version import __version__ as kfinance_version
28
+ from kfinance.version import __version__ as kfinance_version
30
29
  except ImportError:
31
30
  kfinance_version = "dev"
32
31
 
@@ -300,7 +299,7 @@ class KFinanceApiClient:
300
299
  start_date: Optional[str] = None,
301
300
  end_date: Optional[str] = None,
302
301
  periodicity: Optional[Periodicity] = None,
303
- ) -> dict:
302
+ ) -> PriceHistory:
304
303
  """Get the pricing history."""
305
304
  url = (
306
305
  f"{self.url_base}pricing/{trading_item_id}/"
@@ -309,7 +308,7 @@ class KFinanceApiClient:
309
308
  f"{periodicity if periodicity else 'none'}/"
310
309
  f"{'adjusted' if is_adjusted else 'unadjusted'}"
311
310
  )
312
- return self.fetch(url)
311
+ return PriceHistory.model_validate(self.fetch(url))
313
312
 
314
313
  def fetch_history_metadata(self, trading_item_id: int) -> dict[str, str]:
315
314
  """Get the pricing history metadata."""
@@ -321,14 +320,14 @@ class KFinanceApiClient:
321
320
  company_id: int,
322
321
  start_date: Optional[str] = None,
323
322
  end_date: Optional[str] = None,
324
- ) -> dict:
323
+ ) -> Capitalizations:
325
324
  """Get the market cap, TEV, and shares outstanding for a company."""
326
325
  url = (
327
326
  f"{self.url_base}market_cap/{company_id}/"
328
327
  f"{start_date if start_date is not None else 'none'}/"
329
328
  f"{end_date if end_date is not None else 'none'}"
330
329
  )
331
- return self.fetch(url)
330
+ return Capitalizations.model_validate(self.fetch(url))
332
331
 
333
332
  def fetch_segments(
334
333
  self,