kensho-kfinance 3.2.11__py3-none-any.whl → 3.2.13__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kensho-kfinance
3
- Version: 3.2.11
3
+ Version: 3.2.13
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,11 +1,11 @@
1
- kensho_kfinance-3.2.11.dist-info/licenses/AUTHORS.md,sha256=0h9ClbI0pu1oKj1M28ROUsaxrbZg-6ukQGl6X4y9noI,68
2
- kensho_kfinance-3.2.11.dist-info/licenses/LICENSE,sha256=bsY4blvSgq6o0FMQ3RXa2NCgco--nHCCchLXzxr6kms,83
3
- kfinance/CHANGELOG.md,sha256=XjHlM5qhd9E4fuTYuhy6Ef2Ol44NM8v7zqtFz1Vujf0,3500
1
+ kensho_kfinance-3.2.13.dist-info/licenses/AUTHORS.md,sha256=0h9ClbI0pu1oKj1M28ROUsaxrbZg-6ukQGl6X4y9noI,68
2
+ kensho_kfinance-3.2.13.dist-info/licenses/LICENSE,sha256=bsY4blvSgq6o0FMQ3RXa2NCgco--nHCCchLXzxr6kms,83
3
+ kfinance/CHANGELOG.md,sha256=z81MP-CD4T8Alp1QRMxNfIrdKki4ljwQpLQlQc4a_mM,3611
4
4
  kfinance/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
5
5
  kfinance/conftest.py,sha256=PFflyOx08XgmEA0rdugud7QEA7KqARmd22SH2dLTqrE,4091
6
6
  kfinance/mcp.py,sha256=LTzCIlqsDKRD-0Xcpa_P99-JmJ8duAneO_-GzM43kjw,424
7
7
  kfinance/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- kfinance/version.py,sha256=MJhMUFQz6_dDcgDJMKAskHXLUlIHM1XXIUEwKPqT7dA,706
8
+ kfinance/version.py,sha256=J3pqLgy74OE8Fl2xQdOtnkegZoLi97vlblTAesq5P9s,706
9
9
  kfinance/client/README.md,sha256=DA5vg4uz1JmJNiqvYywrj46YNhOr584WO8L83Ysx_Mk,372
10
10
  kfinance/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  kfinance/client/batch_request_handling.py,sha256=0r9x3-vXdpyKhfsIa6VZ9hovN60t3HB7nE3v5hnrSyI,6617
@@ -35,7 +35,7 @@ kfinance/domains/business_relationships/business_relationship_tools.py,sha256=xK
35
35
  kfinance/domains/business_relationships/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  kfinance/domains/business_relationships/tests/test_business_relationship_tools.py,sha256=e_EGtM4i5Qw5J1Wi2kXahkyjDA4mhHcT0DFAKA5JQdI,2459
37
37
  kfinance/domains/capitalizations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
- kfinance/domains/capitalizations/capitalization_models.py,sha256=vTmISvJuagwr8n4yF66M9pty_iIdYKb6okoc2vAyac4,3788
38
+ kfinance/domains/capitalizations/capitalization_models.py,sha256=wKs9th3yoG84n3lC_9hF9QVeMQXKmmpFA-GaFTsCITY,3447
39
39
  kfinance/domains/capitalizations/capitalization_tools.py,sha256=3pG174VA-uLrbtk6xlER-xXZfz5PCePT_dE7dTCeNu0,5146
40
40
  kfinance/domains/capitalizations/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  kfinance/domains/capitalizations/tests/test_capitalization_models.py,sha256=SSFxEVnSLvuNjOK-gx4I3OCHso80OA37zOLmiHJhsro,3143
@@ -61,8 +61,8 @@ kfinance/domains/earnings/earning_tools.py,sha256=AmHZQKTGExPPxyDdjhrn5CVLvWr6xM
61
61
  kfinance/domains/earnings/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
62
  kfinance/domains/earnings/tests/test_earnings_tools.py,sha256=qGhdWI1s4uEjF6XtFC0f1nlAths1H6xfym-iJyBpwBo,6998
63
63
  kfinance/domains/line_items/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
- kfinance/domains/line_items/line_item_models.py,sha256=6J_9cko9nZ3OAGSC7OMGEMQW8dkXjRLWn4_2BjtHemU,50969
65
- kfinance/domains/line_items/line_item_tools.py,sha256=UTLY-_QD6LbHGXHwx1azoqzqbJGdct3R0iwNmvxhIS0,6144
64
+ kfinance/domains/line_items/line_item_models.py,sha256=bjSfXy0dxpUXr5MGU4FchSR2kz8J5TwyPHcW-TCDxb4,45537
65
+ kfinance/domains/line_items/line_item_tools.py,sha256=bP1lbWVGg32XG6i8uhg8xtc9ttlRpoSDDI5NPxm6g90,5347
66
66
  kfinance/domains/line_items/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
67
  kfinance/domains/line_items/tests/test_line_item_tools.py,sha256=vgxJsPbQG1msXZKTfpyHSzUfhw0GvfxZ041T7J-56hU,5499
68
68
  kfinance/domains/mergers_and_acquisitions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -71,7 +71,7 @@ kfinance/domains/mergers_and_acquisitions/merger_and_acquisition_tools.py,sha256
71
71
  kfinance/domains/mergers_and_acquisitions/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
72
72
  kfinance/domains/mergers_and_acquisitions/tests/test_merger_and_acquisition_tools.py,sha256=uN9LewN_k4yy5IPR0lbeyYxi8UF2mmebOF3gvXCSt6M,6383
73
73
  kfinance/domains/prices/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
- kfinance/domains/prices/price_models.py,sha256=6K2Yi8PQKJ92rf6ulcOSh9rBVOiPcUQD_WIRjpIRuSo,2156
74
+ kfinance/domains/prices/price_models.py,sha256=OMGrrT-jQ_4HXuouWih9g5bFnIj_ecw6waK3t0YQ9o0,2292
75
75
  kfinance/domains/prices/price_tools.py,sha256=gR83pFB0MymiyKczV8WBz6YHSbKJE5yd1_2Y2winJd8,7128
76
76
  kfinance/domains/prices/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
77
  kfinance/domains/prices/tests/test_price_models.py,sha256=PWGqbR9aCys2ldHZMF5anMXsSYEVOjgygfpxLcLVKL8,2400
@@ -108,7 +108,7 @@ kfinance/integrations/tool_calling/static_tools/tests/test_get_n_quarters_ago.py
108
108
  kfinance/integrations/tool_calling/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
109
109
  kfinance/integrations/tool_calling/tests/test_tool_calling_models.py,sha256=5L8TpSVJmrjNzGcnERorpfeyrgLND_DL46ld5hVlcNw,2933
110
110
  kfinance/models/permission_models.py,sha256=G0so8ZOsD1YDsCM4he0z5R9M_shUbSRwD3hUDJdqZl0,635
111
- kensho_kfinance-3.2.11.dist-info/METADATA,sha256=qj83T76FViI-obgUPGcYwDmLy6mrpB4ZbWpmPcz1Z3M,6198
112
- kensho_kfinance-3.2.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
113
- kensho_kfinance-3.2.11.dist-info/top_level.txt,sha256=kT_kNwVhfQoOAecY8W7uYah5xaHMoHoAdBIvXh6DaKM,9
114
- kensho_kfinance-3.2.11.dist-info/RECORD,,
111
+ kensho_kfinance-3.2.13.dist-info/METADATA,sha256=R6Z87HGlxlKkOoC16rP8MOVxp_G8GJ5ncFK5DWBfdQA,6198
112
+ kensho_kfinance-3.2.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
113
+ kensho_kfinance-3.2.13.dist-info/top_level.txt,sha256=kT_kNwVhfQoOAecY8W7uYah5xaHMoHoAdBIvXh6DaKM,9
114
+ kensho_kfinance-3.2.13.dist-info/RECORD,,
kfinance/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
1
  # Changelog
2
+ # 3.2.13
3
+ - Fix Prices validator to handle null OHLC price data
4
+
5
+ # 3.2.12
6
+ - Remove multiples line item support
7
+
2
8
  # 3.2.11
3
9
  - Add Handling of status code 400 for Capitalizations, Modify EV/TEV ratio to target quarterly or LTM
4
10
 
@@ -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,18 +28,9 @@ 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
- @model_validator(mode="before")
34
- @classmethod
35
- def handle_field_alias(cls, data: Any) -> Any:
36
- """Handle both 'capitalizations' and 'market_caps' field names"""
37
- if isinstance(data, dict):
38
- if "capitalizations" in data and "market_caps" not in data:
39
- data = deepcopy(data)
40
- data["market_caps"] = data["capitalizations"]
41
- return data
42
-
43
34
  @model_validator(mode="before")
44
35
  @classmethod
45
36
  def inject_currency_into_data(cls, data: Any) -> Any:
@@ -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])
@@ -45,12 +45,6 @@ class GetFinancialLineItemFromIdentifiers(KfinanceTool):
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
47
  - All aliases for a line item return identical data (e.g., "revenue", "normal_revenue", and "regular_revenue" all return the same financial data).
48
- - For the following Enterprise Value (EV) ratio line items, always specify period_type as either "quarterly" or "ltm" (Last Twelve Months) - do not rely on the default annual period:
49
- - last_close_tev_to_ebit (and its aliases: ev_to_ebit, enterprise_value_to_ebit, tev_to_ebit, etc.)
50
- - last_close_tev_to_ebitda (and its aliases: ev_to_ebitda, enterprise_value_to_ebitda, tev_to_ebitda, etc.)
51
- - ev_to_employees (and its aliases: ev_to_employee_count, tev_to_employees, enterprise_value_to_employees, etc.)
52
- - ev_to_total_revenue (and its aliases: tev_to_total_revenue, enterprise_value_to_total_revenue, etc.)
53
- - When requesting these EV ratios, explicitly set period_type="quarterly" or period_type="ltm" for optimal data availability.
54
48
 
55
49
  Example:
56
50
  Query: "What are the revenues of Lowe's and Home Depot?"
@@ -15,11 +15,11 @@ class Prices(BaseModel):
15
15
  """
16
16
 
17
17
  date: str
18
- open: Money
19
- high: Money
20
- low: Money
21
- close: Money
22
- volume: Shares
18
+ open: Money | None
19
+ high: Money | None
20
+ low: Money | None
21
+ close: Money | None # For Consistency with other OHLC dtype
22
+ volume: Shares | None
23
23
 
24
24
 
25
25
  class PriceHistory(BaseModel):
@@ -58,7 +58,8 @@ class PriceHistory(BaseModel):
58
58
  currency = data["currency"]
59
59
  for capitalization in data["prices"]:
60
60
  for key in ["open", "high", "low", "close"]:
61
- capitalization[key] = dict(unit=currency, value=capitalization[key])
61
+ if capitalization[key] is not None:
62
+ capitalization[key] = dict(unit=currency, value=capitalization[key])
62
63
  return data
63
64
 
64
65
 
kfinance/version.py CHANGED
@@ -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.11'
32
- __version_tuple__ = version_tuple = (3, 2, 11)
31
+ __version__ = version = '3.2.13'
32
+ __version_tuple__ = version_tuple = (3, 2, 13)
33
33
 
34
34
  __commit_id__ = commit_id = None