kensho-kfinance 2.0.1__py3-none-any.whl → 2.2.2__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.
- {kensho_kfinance-2.0.1.dist-info → kensho_kfinance-2.2.2.dist-info}/METADATA +9 -1
- kensho_kfinance-2.2.2.dist-info/RECORD +42 -0
- {kensho_kfinance-2.0.1.dist-info → kensho_kfinance-2.2.2.dist-info}/WHEEL +1 -1
- kfinance/CHANGELOG.md +21 -0
- kfinance/batch_request_handling.py +32 -27
- kfinance/constants.py +23 -7
- kfinance/fetch.py +106 -40
- kfinance/kfinance.py +164 -89
- kfinance/meta_classes.py +118 -9
- kfinance/tests/conftest.py +32 -0
- kfinance/tests/test_batch_requests.py +46 -8
- kfinance/tests/test_client.py +54 -0
- kfinance/tests/test_example_notebook.py +194 -0
- kfinance/tests/test_fetch.py +31 -2
- kfinance/tests/test_group_objects.py +32 -0
- kfinance/tests/test_objects.py +40 -0
- kfinance/tests/test_tools.py +13 -61
- kfinance/tool_calling/__init__.py +2 -6
- kfinance/tool_calling/get_business_relationship_from_identifier.py +2 -1
- kfinance/tool_calling/get_capitalization_from_identifier.py +2 -1
- kfinance/tool_calling/get_cusip_from_ticker.py +2 -0
- kfinance/tool_calling/get_earnings_call_datetimes_from_identifier.py +2 -0
- kfinance/tool_calling/get_financial_line_item_from_identifier.py +2 -1
- kfinance/tool_calling/get_financial_statement_from_identifier.py +2 -1
- kfinance/tool_calling/get_history_metadata_from_identifier.py +2 -1
- kfinance/tool_calling/get_info_from_identifier.py +3 -1
- kfinance/tool_calling/get_isin_from_ticker.py +2 -0
- kfinance/tool_calling/get_latest.py +2 -1
- kfinance/tool_calling/get_n_quarters_ago.py +2 -1
- kfinance/tool_calling/get_prices_from_identifier.py +2 -1
- kfinance/tool_calling/resolve_identifier.py +18 -0
- kfinance/tool_calling/shared_models.py +2 -0
- kfinance/version.py +2 -2
- kensho_kfinance-2.0.1.dist-info/RECORD +0 -40
- kfinance/tool_calling/get_company_id_from_identifier.py +0 -14
- kfinance/tool_calling/get_security_id_from_identifier.py +0 -14
- kfinance/tool_calling/get_trading_item_id_from_identifier.py +0 -14
- {kensho_kfinance-2.0.1.dist-info → kensho_kfinance-2.2.2.dist-info}/licenses/AUTHORS.md +0 -0
- {kensho_kfinance-2.0.1.dist-info → kensho_kfinance-2.2.2.dist-info}/licenses/LICENSE +0 -0
- {kensho_kfinance-2.0.1.dist-info → kensho_kfinance-2.2.2.dist-info}/top_level.txt +0 -0
|
@@ -2,13 +2,15 @@ from typing import Type
|
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel
|
|
4
4
|
|
|
5
|
+
from kfinance.constants import Permission
|
|
5
6
|
from kfinance.tool_calling.shared_models import KfinanceTool, ToolArgsWithIdentifier
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class GetInfoFromIdentifier(KfinanceTool):
|
|
9
10
|
name: str = "get_info_from_identifier"
|
|
10
|
-
description: str = "Get the information associated with an identifier. Info includes company name, status, type, simple industry, number of employees, founding date, webpage, HQ address, HQ city, HQ zip code, HQ state, HQ country, and HQ country iso code."
|
|
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."
|
|
11
12
|
args_schema: Type[BaseModel] = ToolArgsWithIdentifier
|
|
13
|
+
required_permission: Permission | None = None
|
|
12
14
|
|
|
13
15
|
def _run(self, identifier: str) -> str:
|
|
14
16
|
return str(self.kfinance_client.ticker(identifier).info)
|
|
@@ -2,6 +2,7 @@ from typing import Type
|
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, Field
|
|
4
4
|
|
|
5
|
+
from kfinance.constants import Permission
|
|
5
6
|
from kfinance.tool_calling.shared_models import KfinanceTool
|
|
6
7
|
|
|
7
8
|
|
|
@@ -13,6 +14,7 @@ class GetIsinFromTicker(KfinanceTool):
|
|
|
13
14
|
name: str = "get_isin_from_ticker"
|
|
14
15
|
description: str = "Get the ISIN associated with a ticker."
|
|
15
16
|
args_schema: Type[BaseModel] = GetIsinFromTickerArgs
|
|
17
|
+
required_permission: Permission | None = Permission.IDPermission
|
|
16
18
|
|
|
17
19
|
def _run(self, ticker_str: str) -> str:
|
|
18
20
|
return self.kfinance_client.ticker(ticker_str).isin
|
|
@@ -2,7 +2,7 @@ from typing import Type
|
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, Field
|
|
4
4
|
|
|
5
|
-
from kfinance.constants import LatestPeriods
|
|
5
|
+
from kfinance.constants import LatestPeriods, Permission
|
|
6
6
|
from kfinance.tool_calling.shared_models import KfinanceTool
|
|
7
7
|
|
|
8
8
|
|
|
@@ -16,6 +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
20
|
|
|
20
21
|
def _run(self, use_local_timezone: bool = True) -> LatestPeriods:
|
|
21
22
|
return self.kfinance_client.get_latest(use_local_timezone=use_local_timezone)
|
|
@@ -2,7 +2,7 @@ from typing import Type
|
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, Field
|
|
4
4
|
|
|
5
|
-
from kfinance.constants import YearAndQuarter
|
|
5
|
+
from kfinance.constants import Permission, YearAndQuarter
|
|
6
6
|
from kfinance.tool_calling.shared_models import KfinanceTool
|
|
7
7
|
|
|
8
8
|
|
|
@@ -16,6 +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
20
|
|
|
20
21
|
def _run(self, n: int) -> YearAndQuarter:
|
|
21
22
|
return self.kfinance_client.get_n_quarters_ago(n)
|
|
@@ -3,7 +3,7 @@ from typing import Type
|
|
|
3
3
|
|
|
4
4
|
from pydantic import BaseModel, Field
|
|
5
5
|
|
|
6
|
-
from kfinance.constants import Periodicity
|
|
6
|
+
from kfinance.constants import Periodicity, Permission
|
|
7
7
|
from kfinance.tool_calling.shared_models import KfinanceTool, ToolArgsWithIdentifier
|
|
8
8
|
|
|
9
9
|
|
|
@@ -26,6 +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
30
|
|
|
30
31
|
def _run(
|
|
31
32
|
self,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from typing import Type
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
5
|
+
from kfinance.constants import Permission
|
|
6
|
+
from kfinance.tool_calling.shared_models import KfinanceTool, ToolArgsWithIdentifier
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ResolveIdentifier(KfinanceTool):
|
|
10
|
+
name: str = "resolve_identifier"
|
|
11
|
+
description: str = (
|
|
12
|
+
"Get the company_id, security_id, and trading_item_id associated with an identifier."
|
|
13
|
+
)
|
|
14
|
+
args_schema: Type[BaseModel] = ToolArgsWithIdentifier
|
|
15
|
+
required_permission: Permission | None = None
|
|
16
|
+
|
|
17
|
+
def _run(self, identifier: str) -> dict[str, int]:
|
|
18
|
+
return self.kfinance_client.ticker(identifier).id_triple._asdict()
|
|
@@ -3,6 +3,7 @@ from typing import Any, Type
|
|
|
3
3
|
from langchain_core.tools import BaseTool
|
|
4
4
|
from pydantic import BaseModel, ConfigDict, Field
|
|
5
5
|
|
|
6
|
+
from kfinance.constants import Permission
|
|
6
7
|
from kfinance.kfinance import Client
|
|
7
8
|
|
|
8
9
|
|
|
@@ -15,6 +16,7 @@ class KfinanceTool(BaseTool):
|
|
|
15
16
|
|
|
16
17
|
kfinance_client: Client
|
|
17
18
|
args_schema: Type[BaseModel]
|
|
19
|
+
required_permission: Permission | None
|
|
18
20
|
|
|
19
21
|
model_config = ConfigDict(populate_by_name=True, extra="forbid")
|
|
20
22
|
|
kfinance/version.py
CHANGED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
kensho_kfinance-2.0.1.dist-info/licenses/AUTHORS.md,sha256=0h9ClbI0pu1oKj1M28ROUsaxrbZg-6ukQGl6X4y9noI,68
|
|
2
|
-
kensho_kfinance-2.0.1.dist-info/licenses/LICENSE,sha256=bsY4blvSgq6o0FMQ3RXa2NCgco--nHCCchLXzxr6kms,83
|
|
3
|
-
kfinance/CHANGELOG.md,sha256=I8bZTKar4ZBpKlexO86HTUV4jPKKlKzsCHpDv-UZB4Q,697
|
|
4
|
-
kfinance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
kfinance/batch_request_handling.py,sha256=s0uXRY4CC-GnShI0i8PLPgLddRdqLyQ8jnqDKdmaZzs,5531
|
|
6
|
-
kfinance/constants.py,sha256=HrTh2QuhbA70xxcJ6N8WfTOJs6YiM30P59GbSDu_3AY,48312
|
|
7
|
-
kfinance/fetch.py,sha256=ygvp8q1o8mqPYY4ctQwch37dmprO0UMDteDumk8A-Gw,20172
|
|
8
|
-
kfinance/kfinance.py,sha256=nw2SPkixFht3PkcH4tZ1FnLhVxmyZm1_gbOqnmC6PBQ,49219
|
|
9
|
-
kfinance/meta_classes.py,sha256=sNezG7uHAQOWj2Xdjao6qc3z_gHppgJat7O9J2k_yqI,15730
|
|
10
|
-
kfinance/prompt.py,sha256=PtVB8c_FcSlVdyGgByAnIFGzuUuBaEjciCqnBJl1hSQ,25133
|
|
11
|
-
kfinance/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
kfinance/server_thread.py,sha256=jUnt1YGoYDkqqz1MbCwd44zJs1T_Z2BCgvj75bdtLgA,2574
|
|
13
|
-
kfinance/version.py,sha256=0PAtIHDEagdGmwgz1nnz5zUKeyYjsxtV8Nbsv7dXl8w,511
|
|
14
|
-
kfinance/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
-
kfinance/tests/test_batch_requests.py,sha256=NsldoZqjjQpv0QKM2th80F1nru2tIF4LJeXU-RamQvA,9836
|
|
16
|
-
kfinance/tests/test_fetch.py,sha256=iJLOPBOb8xdAGF6Jel5jPhWb4iW6yPpt9f5tW4uZEyo,12189
|
|
17
|
-
kfinance/tests/test_objects.py,sha256=egXkhfoK2MepZdXtrBxzWxWni7f-zVCefUbnyDnWDOE,22554
|
|
18
|
-
kfinance/tests/test_tools.py,sha256=YG5UVWnR4EyHGsL4bBwUp2auSd55lcvUEEncXcMXw1Q,16941
|
|
19
|
-
kfinance/tool_calling/README.md,sha256=omJq7Us6r4U45QB7hRpLjRJ5BMalCkZkh4uXBjTbJXc,2022
|
|
20
|
-
kfinance/tool_calling/__init__.py,sha256=GDEeK2zM2tOfYam6ejwYACXecoRdlkRve_ZC5VTKugo,2038
|
|
21
|
-
kfinance/tool_calling/get_business_relationship_from_identifier.py,sha256=S_-nCsppi9tvwC81GMKvJd-eZSwRejT96PZhlOf5Wv4,1381
|
|
22
|
-
kfinance/tool_calling/get_capitalization_from_identifier.py,sha256=LmH5yEWSRJfAP4kRYHREdbMtrmxcZfgfbNB4dGQwyb4,1435
|
|
23
|
-
kfinance/tool_calling/get_company_id_from_identifier.py,sha256=18XAmWxTXRw1qaqw4WuA-yQ4d7kI2HnbMi32d-xNGzE,485
|
|
24
|
-
kfinance/tool_calling/get_cusip_from_ticker.py,sha256=uzVMbtcV4eKtWO4bYn-cicCo8tfAEGk-v95ZOON_cbA,533
|
|
25
|
-
kfinance/tool_calling/get_earnings_call_datetimes_from_identifier.py,sha256=3v73ZZz9n-Rdp5vp1RPmFD41nJ0Z3EgTjFSbnm30xdA,665
|
|
26
|
-
kfinance/tool_calling/get_financial_line_item_from_identifier.py,sha256=zJ-kcr_B9N3ZIXK1W-2TEUlF6tj4rhzmLSsW8EUhJn4,2064
|
|
27
|
-
kfinance/tool_calling/get_financial_statement_from_identifier.py,sha256=LyGmh81-_yljOhMVpsXa1M4u6hNJNP69Ms1M1NsxwPM,1817
|
|
28
|
-
kfinance/tool_calling/get_history_metadata_from_identifier.py,sha256=0h7xdhrIJg3pJJrrCgcsiZd3ft1GpConhNZe2pcOREA,666
|
|
29
|
-
kfinance/tool_calling/get_info_from_identifier.py,sha256=bv4lRhXWG9N7U8XEli9v44QEXNgf7-ZTuTDmE6XIeEg,659
|
|
30
|
-
kfinance/tool_calling/get_isin_from_ticker.py,sha256=yz7SOCFgwL03Zd8zG3pIfa3McB_tdRU-_oXYfSfqWoo,527
|
|
31
|
-
kfinance/tool_calling/get_latest.py,sha256=U_5SuGlD0G-u7YreiNkwEtx2zkUhZzUvwUwdL_tmqFk,724
|
|
32
|
-
kfinance/tool_calling/get_n_quarters_ago.py,sha256=VVKKyUNbmw7fS7e-vi4YXSdd_OO2bo8k50Grt5F_Mvo,651
|
|
33
|
-
kfinance/tool_calling/get_prices_from_identifier.py,sha256=b-cK9dWXbVBjppTORlC4HK9zd_qe8V0n98s823v0dCc,1796
|
|
34
|
-
kfinance/tool_calling/get_security_id_from_identifier.py,sha256=vPFYuFydUGxQ0b23CWkU3YxWVeoW-nzsrPbB9ZH8U_w,489
|
|
35
|
-
kfinance/tool_calling/get_trading_item_id_from_identifier.py,sha256=fB8QBFzhn-kgUL8dSF6w_rtO3zG5yLbm5s29Xz6U1AY,504
|
|
36
|
-
kfinance/tool_calling/shared_models.py,sha256=6y74yJCORHDVBxhhBJhTUOWCF9D11Lgg9eYQeDIT3aY,2047
|
|
37
|
-
kensho_kfinance-2.0.1.dist-info/METADATA,sha256=ZbBhphkOAf3Bk9yqaO42W5rPJYOW1jcO0HvjVGaYnSo,3051
|
|
38
|
-
kensho_kfinance-2.0.1.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
|
39
|
-
kensho_kfinance-2.0.1.dist-info/top_level.txt,sha256=kT_kNwVhfQoOAecY8W7uYah5xaHMoHoAdBIvXh6DaKM,9
|
|
40
|
-
kensho_kfinance-2.0.1.dist-info/RECORD,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from typing import Type
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
|
|
5
|
-
from kfinance.tool_calling.shared_models import KfinanceTool, ToolArgsWithIdentifier
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class GetCompanyIdFromIdentifier(KfinanceTool):
|
|
9
|
-
name: str = "get_company_id_from_identifier"
|
|
10
|
-
description: str = "Get the company id associated with an identifier."
|
|
11
|
-
args_schema: Type[BaseModel] = ToolArgsWithIdentifier
|
|
12
|
-
|
|
13
|
-
def _run(self, identifier: str) -> int:
|
|
14
|
-
return self.kfinance_client.ticker(identifier).company_id
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from typing import Type
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
|
|
5
|
-
from kfinance.tool_calling.shared_models import KfinanceTool, ToolArgsWithIdentifier
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class GetSecurityIdFromIdentifier(KfinanceTool):
|
|
9
|
-
name: str = "get_security_id_from_identifier"
|
|
10
|
-
description: str = "Get the security id associated with an identifier."
|
|
11
|
-
args_schema: Type[BaseModel] = ToolArgsWithIdentifier
|
|
12
|
-
|
|
13
|
-
def _run(self, identifier: str) -> int:
|
|
14
|
-
return self.kfinance_client.ticker(identifier).security_id
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from typing import Type
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
|
|
5
|
-
from kfinance.tool_calling.shared_models import KfinanceTool, ToolArgsWithIdentifier
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class GetTradingItemIdFromIdentifier(KfinanceTool):
|
|
9
|
-
name: str = "get_trading_item_id_from_identifier"
|
|
10
|
-
description: str = "Get the trading item id associated with an identifier."
|
|
11
|
-
args_schema: Type[BaseModel] = ToolArgsWithIdentifier
|
|
12
|
-
|
|
13
|
-
def _run(self, identifier: str) -> int:
|
|
14
|
-
return self.kfinance_client.ticker(identifier).trading_item_id
|
|
File without changes
|
|
File without changes
|
|
File without changes
|