kensho-kfinance 2.7.0__py3-none-any.whl → 2.9.0__py3-none-any.whl

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 (58) hide show
  1. {kensho_kfinance-2.7.0.dist-info → kensho_kfinance-2.9.0.dist-info}/METADATA +2 -2
  2. kensho_kfinance-2.9.0.dist-info/RECORD +70 -0
  3. kfinance/CHANGELOG.md +6 -0
  4. kfinance/decimal_with_unit.py +78 -0
  5. kfinance/fetch.py +15 -16
  6. kfinance/kfinance.py +108 -122
  7. kfinance/meta_classes.py +28 -27
  8. kfinance/models/business_relationship_models.py +26 -0
  9. kfinance/models/capitalization_models.py +90 -0
  10. kfinance/models/competitor_models.py +13 -0
  11. kfinance/models/currency_models.py +345 -0
  12. kfinance/models/date_and_period_models.py +48 -0
  13. kfinance/models/id_models.py +7 -0
  14. kfinance/models/industry_models.py +12 -0
  15. kfinance/{constants.py → models/line_item_models.py} +1 -165
  16. kfinance/models/permission_models.py +15 -0
  17. kfinance/models/price_models.py +70 -0
  18. kfinance/models/segment_models.py +8 -0
  19. kfinance/models/statement_models.py +9 -0
  20. kfinance/tests/test_batch_requests.py +61 -31
  21. kfinance/tests/test_client.py +1 -1
  22. kfinance/tests/test_decimal_with_unit.py +60 -0
  23. kfinance/tests/test_example_notebook.py +1 -0
  24. kfinance/tests/test_fetch.py +23 -12
  25. kfinance/tests/test_models/__init__.py +0 -0
  26. kfinance/tests/test_models/test_capitalization_models.py +83 -0
  27. kfinance/tests/test_models/test_price_models.py +58 -0
  28. kfinance/tests/test_objects.py +107 -57
  29. kfinance/tests/test_tools.py +35 -11
  30. kfinance/tool_calling/get_advisors_for_company_in_transaction_from_identifier.py +10 -7
  31. kfinance/tool_calling/get_business_relationship_from_identifier.py +2 -1
  32. kfinance/tool_calling/get_capitalization_from_identifier.py +4 -5
  33. kfinance/tool_calling/get_competitors_from_identifier.py +2 -1
  34. kfinance/tool_calling/get_cusip_from_ticker.py +1 -1
  35. kfinance/tool_calling/get_earnings.py +1 -1
  36. kfinance/tool_calling/get_financial_line_item_from_identifier.py +3 -1
  37. kfinance/tool_calling/get_financial_statement_from_identifier.py +3 -1
  38. kfinance/tool_calling/get_history_metadata_from_identifier.py +2 -1
  39. kfinance/tool_calling/get_info_from_identifier.py +1 -1
  40. kfinance/tool_calling/get_isin_from_ticker.py +1 -1
  41. kfinance/tool_calling/get_latest.py +2 -1
  42. kfinance/tool_calling/get_latest_earnings.py +1 -1
  43. kfinance/tool_calling/get_merger_info_from_transaction_id.py +6 -5
  44. kfinance/tool_calling/get_mergers_from_identifier.py +4 -1
  45. kfinance/tool_calling/get_n_quarters_ago.py +2 -1
  46. kfinance/tool_calling/get_next_earnings.py +1 -1
  47. kfinance/tool_calling/get_prices_from_identifier.py +4 -3
  48. kfinance/tool_calling/get_segments_from_identifier.py +3 -1
  49. kfinance/tool_calling/get_transcript.py +1 -1
  50. kfinance/tool_calling/resolve_identifier.py +1 -1
  51. kfinance/tool_calling/shared_models.py +1 -1
  52. kfinance/version.py +2 -2
  53. kensho_kfinance-2.7.0.dist-info/RECORD +0 -54
  54. {kensho_kfinance-2.7.0.dist-info → kensho_kfinance-2.9.0.dist-info}/WHEEL +0 -0
  55. {kensho_kfinance-2.7.0.dist-info → kensho_kfinance-2.9.0.dist-info}/licenses/AUTHORS.md +0 -0
  56. {kensho_kfinance-2.7.0.dist-info → kensho_kfinance-2.9.0.dist-info}/licenses/LICENSE +0 -0
  57. {kensho_kfinance-2.7.0.dist-info → kensho_kfinance-2.9.0.dist-info}/top_level.txt +0 -0
  58. /kfinance/{tests/scratch.py → models/__init__.py} +0 -0
@@ -2,8 +2,8 @@ from typing import Type
2
2
 
3
3
  from pydantic import BaseModel, Field
4
4
 
5
- from kfinance.constants import Permission
6
5
  from kfinance.kfinance import MergerOrAcquisition
6
+ from kfinance.models.permission_models import Permission
7
7
  from kfinance.tool_calling.shared_models import KfinanceTool
8
8
 
9
9
 
@@ -22,6 +22,7 @@ class GetMergerInfoFromTransactionId(KfinanceTool):
22
22
  kfinance_api_client=self.kfinance_client.kfinance_api_client,
23
23
  transaction_id=transaction_id,
24
24
  merger_title=None,
25
+ closed_date=None,
25
26
  )
26
27
  merger_timeline = merger_or_acquisition.get_timeline
27
28
  merger_participants = merger_or_acquisition.get_participants
@@ -36,15 +37,15 @@ class GetMergerInfoFromTransactionId(KfinanceTool):
36
37
  else None,
37
38
  "participants": {
38
39
  "target": {
39
- "company_id": merger_participants["target"].company_id,
40
- "company_name": merger_participants["target"].name,
40
+ "company_id": merger_participants["target"].company.company_id,
41
+ "company_name": merger_participants["target"].company.name,
41
42
  },
42
43
  "buyers": [
43
- {"company_id": buyer.company_id, "company_name": buyer.name}
44
+ {"company_id": buyer.company.company_id, "company_name": buyer.company.name}
44
45
  for buyer in merger_participants["buyers"]
45
46
  ],
46
47
  "sellers": [
47
- {"company_id": seller.company_id, "company_name": seller.name}
48
+ {"company_id": seller.company.company_id, "company_name": seller.company.name}
48
49
  for seller in merger_participants["sellers"]
49
50
  ],
50
51
  }
@@ -2,7 +2,7 @@ from typing import Type
2
2
 
3
3
  from pydantic import BaseModel
4
4
 
5
- from kfinance.constants import Permission
5
+ from kfinance.models.permission_models import Permission
6
6
  from kfinance.tool_calling.shared_models import KfinanceTool, ToolArgsWithIdentifier
7
7
 
8
8
 
@@ -21,6 +21,7 @@ class GetMergersFromIdentifier(KfinanceTool):
21
21
  {
22
22
  "transaction_id": merger_or_acquisition.transaction_id,
23
23
  "merger_title": merger_or_acquisition.merger_title,
24
+ "closed_date": merger_or_acquisition.closed_date,
24
25
  }
25
26
  for merger_or_acquisition in mergers_and_acquisitions["target"]
26
27
  ],
@@ -28,6 +29,7 @@ class GetMergersFromIdentifier(KfinanceTool):
28
29
  {
29
30
  "transaction_id": merger_or_acquisition.transaction_id,
30
31
  "merger_title": merger_or_acquisition.merger_title,
32
+ "closed_date": merger_or_acquisition.closed_date,
31
33
  }
32
34
  for merger_or_acquisition in mergers_and_acquisitions["buyer"]
33
35
  ],
@@ -35,6 +37,7 @@ class GetMergersFromIdentifier(KfinanceTool):
35
37
  {
36
38
  "transaction_id": merger_or_acquisition.transaction_id,
37
39
  "merger_title": merger_or_acquisition.merger_title,
40
+ "closed_date": merger_or_acquisition.closed_date,
38
41
  }
39
42
  for merger_or_acquisition in mergers_and_acquisitions["seller"]
40
43
  ],
@@ -2,7 +2,8 @@ from typing import Type
2
2
 
3
3
  from pydantic import BaseModel, Field
4
4
 
5
- from kfinance.constants import Permission, YearAndQuarter
5
+ from kfinance.models.date_and_period_models import YearAndQuarter
6
+ from kfinance.models.permission_models import Permission
6
7
  from kfinance.tool_calling.shared_models import KfinanceTool
7
8
 
8
9
 
@@ -2,8 +2,8 @@ from typing import Type
2
2
 
3
3
  from pydantic import BaseModel
4
4
 
5
- from kfinance.constants import Permission
6
5
  from kfinance.kfinance import NoEarningsDataError
6
+ from kfinance.models.permission_models import Permission
7
7
  from kfinance.tool_calling.shared_models import KfinanceTool, ToolArgsWithIdentifier
8
8
 
9
9
 
@@ -3,7 +3,8 @@ from typing import Type
3
3
 
4
4
  from pydantic import BaseModel, Field
5
5
 
6
- from kfinance.constants import Periodicity, Permission
6
+ from kfinance.models.date_and_period_models import Periodicity
7
+ from kfinance.models.permission_models import Permission
7
8
  from kfinance.tool_calling.shared_models import KfinanceTool, ToolArgsWithIdentifier
8
9
 
9
10
 
@@ -35,11 +36,11 @@ class GetPricesFromIdentifier(KfinanceTool):
35
36
  end_date: date | None = None,
36
37
  periodicity: Periodicity = Periodicity.day,
37
38
  adjusted: bool = True,
38
- ) -> str:
39
+ ) -> dict:
39
40
  ticker = self.kfinance_client.ticker(identifier)
40
41
  return ticker.history(
41
42
  start_date=start_date.isoformat() if start_date else None,
42
43
  end_date=end_date.isoformat() if end_date else None,
43
44
  periodicity=periodicity,
44
45
  adjusted=adjusted,
45
- ).to_markdown()
46
+ ).model_dump(mode="json")
@@ -2,7 +2,9 @@ from typing import Literal, Type
2
2
 
3
3
  from pydantic import BaseModel, Field
4
4
 
5
- from kfinance.constants import PeriodType, Permission, SegmentType
5
+ from kfinance.models.date_and_period_models import PeriodType
6
+ from kfinance.models.permission_models import Permission
7
+ from kfinance.models.segment_models import SegmentType
6
8
  from kfinance.tool_calling.shared_models import KfinanceTool, ToolArgsWithIdentifier, ValidQuarter
7
9
 
8
10
 
@@ -2,7 +2,7 @@ from typing import Type
2
2
 
3
3
  from pydantic import BaseModel, Field
4
4
 
5
- from kfinance.constants import Permission
5
+ from kfinance.models.permission_models import Permission
6
6
  from kfinance.tool_calling.shared_models import KfinanceTool
7
7
 
8
8
 
@@ -2,7 +2,7 @@ from typing import Type
2
2
 
3
3
  from pydantic import BaseModel
4
4
 
5
- from kfinance.constants import Permission
5
+ from kfinance.models.permission_models import Permission
6
6
  from kfinance.tool_calling.shared_models import KfinanceTool, ToolArgsWithIdentifier
7
7
 
8
8
 
@@ -3,8 +3,8 @@ from typing import Annotated, Any, Literal, Type
3
3
  from langchain_core.tools import BaseTool
4
4
  from pydantic import BaseModel, BeforeValidator, ConfigDict, Field
5
5
 
6
- from kfinance.constants import Permission
7
6
  from kfinance.kfinance import Client
7
+ from kfinance.models.permission_models import Permission
8
8
 
9
9
 
10
10
  class KfinanceTool(BaseTool):
kfinance/version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '2.7.0'
21
- __version_tuple__ = version_tuple = (2, 7, 0)
20
+ __version__ = version = '2.9.0'
21
+ __version_tuple__ = version_tuple = (2, 9, 0)
@@ -1,54 +0,0 @@
1
- kensho_kfinance-2.7.0.dist-info/licenses/AUTHORS.md,sha256=0h9ClbI0pu1oKj1M28ROUsaxrbZg-6ukQGl6X4y9noI,68
2
- kensho_kfinance-2.7.0.dist-info/licenses/LICENSE,sha256=bsY4blvSgq6o0FMQ3RXa2NCgco--nHCCchLXzxr6kms,83
3
- kfinance/CHANGELOG.md,sha256=wNB99rvUBZsLmuCxq9ZtzvNpzeze8YmFz2HMdue3Di4,2175
4
- kfinance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- kfinance/batch_request_handling.py,sha256=G9rhpgQaCdb5C1dsfuJip8383iszibcOJ5k8gxld-tQ,5001
6
- kfinance/constants.py,sha256=Zh7ruf-gFR6twCy5CUjOCgT_cGX-rgFdmR84AkcztYw,49453
7
- kfinance/fetch.py,sha256=sDxO3loGNcn2aT8azXR6MlHHLyjYoWIKK1HpN2-fYu0,27682
8
- kfinance/kfinance.py,sha256=MvEgcSDSiws3beJefQbOh3n8DdC6Wf33wiwf3Jfu6Mg,73194
9
- kfinance/mcp.py,sha256=MbktclVfBOEwfe-eR7kPaTXopMJmn_8RMlf4Jx5CXKU,3689
10
- kfinance/meta_classes.py,sha256=ulRNnWZ4P0HURs8XPzCTsJ3SYbvnT4SXyG4dIuITxAo,21766
11
- kfinance/prompt.py,sha256=PtVB8c_FcSlVdyGgByAnIFGzuUuBaEjciCqnBJl1hSQ,25133
12
- kfinance/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- kfinance/pydantic_models.py,sha256=avpbPqwrAyLqsCbrmFpK_B8_fj1nPlBHrnPxRcBaSkE,774
14
- kfinance/server_thread.py,sha256=jUnt1YGoYDkqqz1MbCwd44zJs1T_Z2BCgvj75bdtLgA,2574
15
- kfinance/version.py,sha256=t0tYtjmuqfTGJQNs3pmrehzkGSiJlTwAuPRgzmcsAVU,511
16
- kfinance/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- kfinance/tests/conftest.py,sha256=dhL_RSc-af3j-2_UrAGRE9mxgcbjuIRtj08DTx79pQc,1123
18
- kfinance/tests/scratch.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- kfinance/tests/test_batch_requests.py,sha256=2A0XnDDDSPkq0-BuiRryZx8b9_jBDtjYd2kWxFVyRew,10140
20
- kfinance/tests/test_client.py,sha256=_OJ8fZ14aa7Oj2znheuRIRKz7FyQLqwkhWexEZetxmg,3855
21
- kfinance/tests/test_example_notebook.py,sha256=XHwDKw2avyMonTmi3snCcFWNfZhEJOkpBGOZNrMLrhk,6470
22
- kfinance/tests/test_fetch.py,sha256=mIj61dd843p3D1qtTAO60rZi6Rax0NgefOTTiBFrQcQ,17887
23
- kfinance/tests/test_group_objects.py,sha256=SoMEZmkG4RYdgWOAwxLHHtzIQho92KM01YbQXPUg578,1689
24
- kfinance/tests/test_objects.py,sha256=YlpxjlT1kJsDf4SgTZkhhthODwCnwNukJF_wvi11p3A,40805
25
- kfinance/tests/test_tools.py,sha256=nq6xfnUYBm4uF_iGe2iLv6SXFesbEy4QyBk4ldXyhPk,30097
26
- kfinance/tool_calling/README.md,sha256=omJq7Us6r4U45QB7hRpLjRJ5BMalCkZkh4uXBjTbJXc,2022
27
- kfinance/tool_calling/__init__.py,sha256=UmtbtG6PvQHB1fInEL-K5q0kPHL__zTY9wzaPRSp1wg,2174
28
- kfinance/tool_calling/get_advisors_for_company_in_transaction_from_identifier.py,sha256=rrUVesFG3EpdVnvML42o6apJyBfWOBk0iYydJgIZaig,1615
29
- kfinance/tool_calling/get_business_relationship_from_identifier.py,sha256=vILN4k2NGCIrpgWiT_p7CLwDv_uQf9qXwojmQwDRsJo,1480
30
- kfinance/tool_calling/get_capitalization_from_identifier.py,sha256=7n52UH0oug6KspPxCQsRinb6WPC4M5UNK1CFhQxKAaE,1529
31
- kfinance/tool_calling/get_competitors_from_identifier.py,sha256=RZ1ngeeZee12GOKUvw1rpzij9A55Zfs3MTt6O-DC98M,1096
32
- kfinance/tool_calling/get_cusip_from_ticker.py,sha256=P4J2JS0_jwmfBWD9k-URlJ0gPFsgTkglivN-d3fA9Ek,652
33
- kfinance/tool_calling/get_earnings.py,sha256=53mpdno7uaVMQVQXC_IXYEGvBh2kM7e41SFxI9LG--A,1230
34
- kfinance/tool_calling/get_financial_line_item_from_identifier.py,sha256=iQywFZzXQdvL3oSWPHZJ6v1kifR27tsHLcXa6089Wls,2161
35
- kfinance/tool_calling/get_financial_statement_from_identifier.py,sha256=4nJvQBaZZpD9-cKBONEimicUsQxIftFfdVj7rRqdUck,1914
36
- kfinance/tool_calling/get_history_metadata_from_identifier.py,sha256=N-ZXYMT0YGIcTmCEAKgs5IK134WKFeuVzrGyPYIliXM,734
37
- kfinance/tool_calling/get_info_from_identifier.py,sha256=XRan7nKa0FQuBF0i8UmoN2E0FOMEx34N8H-El4J51E0,772
38
- kfinance/tool_calling/get_isin_from_ticker.py,sha256=iy4p8dhOpkooPZP8BPQRijsZbDbuAf9WyV5t8zBGMi8,646
39
- kfinance/tool_calling/get_latest.py,sha256=CHtR8MvUdOxI63kWVWFONUaqlHPhSrE9qv96RRCJsiw,792
40
- kfinance/tool_calling/get_latest_earnings.py,sha256=lUahH0G-QbxxeN4ClF-ETrMACFesw5UXOl9pnssDgzM,1182
41
- kfinance/tool_calling/get_merger_info_from_transaction_id.py,sha256=uTtUFMtKrN53BxZ53s_HlTyyc4ToO1qIPFUts6IQFu8,3150
42
- kfinance/tool_calling/get_mergers_from_identifier.py,sha256=Av86oG4Rf4eUYG3aHIzIMwJEkrxKR1CqRYLPnCQN5po,1710
43
- kfinance/tool_calling/get_n_quarters_ago.py,sha256=R-_Wn-VUYABb7CPD2OQ_xauMAOZoYXW0FPw6ccvw6Ho,719
44
- kfinance/tool_calling/get_next_earnings.py,sha256=O7bIXqJmvxgBZZ9jjcvN2WGy2KIsBe6YegnymiYJy-E,1162
45
- kfinance/tool_calling/get_prices_from_identifier.py,sha256=4yTEPWTMqfUfU6JdsD_TQJLEFTNji0wic-8oXtdSqVY,1890
46
- kfinance/tool_calling/get_segments_from_identifier.py,sha256=-6I5pK_VSNxszUuQX6ne9zr7HFwaeWCFMddmJ3PYA_g,1873
47
- kfinance/tool_calling/get_transcript.py,sha256=2Vzab47kMw1288AubFXwhNGHtodmy_n2itITgk5szOg,767
48
- kfinance/tool_calling/prompts.py,sha256=Yw1DJIMh90cjL-8q6_RMRiSjCtFDXvJAy7QiV5_uAU8,911
49
- kfinance/tool_calling/resolve_identifier.py,sha256=_XEfGtDEB5tnAnseyQaugn4AuNsy6wZe5f-QOh8myko,632
50
- kfinance/tool_calling/shared_models.py,sha256=2KUY7PLFO-89Y6pYyDNbF8ub8KgWkay16683u8Wvf8Y,3731
51
- kensho_kfinance-2.7.0.dist-info/METADATA,sha256=MGykZUh-nhnOLxDtjsY_rgKZX73bGLOJ5vg54yO_pY0,6197
52
- kensho_kfinance-2.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
53
- kensho_kfinance-2.7.0.dist-info/top_level.txt,sha256=kT_kNwVhfQoOAecY8W7uYah5xaHMoHoAdBIvXh6DaKM,9
54
- kensho_kfinance-2.7.0.dist-info/RECORD,,
File without changes