kensho-kfinance 2.4.3__py3-none-any.whl → 2.6.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.4.3.dist-info → kensho_kfinance-2.6.2.dist-info}/METADATA +38 -5
- {kensho_kfinance-2.4.3.dist-info → kensho_kfinance-2.6.2.dist-info}/RECORD +23 -20
- kfinance/CHANGELOG.md +18 -0
- kfinance/batch_request_handling.py +2 -16
- kfinance/constants.py +14 -0
- kfinance/fetch.py +56 -0
- kfinance/kfinance.py +409 -90
- kfinance/meta_classes.py +37 -12
- kfinance/tests/conftest.py +4 -0
- kfinance/tests/test_batch_requests.py +0 -32
- kfinance/tests/test_fetch.py +21 -0
- kfinance/tests/test_objects.py +239 -3
- kfinance/tests/test_tools.py +101 -23
- kfinance/tool_calling/__init__.py +2 -4
- kfinance/tool_calling/get_advisors_for_company_in_transaction_from_identifier.py +39 -0
- kfinance/tool_calling/get_competitors_from_identifier.py +24 -0
- kfinance/tool_calling/get_merger_info_from_transaction_id.py +68 -0
- kfinance/tool_calling/get_mergers_from_identifier.py +41 -0
- kfinance/version.py +2 -2
- kfinance/tool_calling/get_earnings_call_datetimes_from_identifier.py +0 -19
- {kensho_kfinance-2.4.3.dist-info → kensho_kfinance-2.6.2.dist-info}/WHEEL +0 -0
- {kensho_kfinance-2.4.3.dist-info → kensho_kfinance-2.6.2.dist-info}/licenses/AUTHORS.md +0 -0
- {kensho_kfinance-2.4.3.dist-info → kensho_kfinance-2.6.2.dist-info}/licenses/LICENSE +0 -0
- {kensho_kfinance-2.4.3.dist-info → kensho_kfinance-2.6.2.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kensho-kfinance
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.6.2
|
|
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
|
|
@@ -27,7 +27,7 @@ Requires-Dist: strenum>=0.4.15
|
|
|
27
27
|
Requires-Dist: tabulate>=0.9.0
|
|
28
28
|
Requires-Dist: types-requests<3,>=2.22.0
|
|
29
29
|
Requires-Dist: requests<3,>=2.22.0
|
|
30
|
-
Requires-Dist: urllib3>=
|
|
30
|
+
Requires-Dist: urllib3>=2.5
|
|
31
31
|
Provides-Extra: dev
|
|
32
32
|
Requires-Dist: coverage<8,>=7.6.10; extra == "dev"
|
|
33
33
|
Requires-Dist: ipykernel<7,>=6.29; extra == "dev"
|
|
@@ -67,11 +67,11 @@ Once access is obtained, get started using the [Authentication Guide](https://do
|
|
|
67
67
|
To get started, we provide some notebooks:
|
|
68
68
|
|
|
69
69
|
- The [LLM-ready API Basic Usage](example_notebooks%2Fbasic_usage.ipynb) notebook demonstrates how
|
|
70
|
-
fetch data with the kFinance client.
|
|
70
|
+
fetch data with the kFinance client.
|
|
71
71
|
- The [tool_calling notebooks](example_notebooks%2Ftool_calling) show how the kFinance library can
|
|
72
|
-
be used for tool calling. We provide notebooks for OpenAI (GPT), Anthropic (Claude), and Google
|
|
72
|
+
be used for tool calling. We provide notebooks for OpenAI (GPT), Anthropic (Claude), and Google
|
|
73
73
|
(Gemini). Each of these integrations comes in a langchain version, which uses langchain as a
|
|
74
|
-
wrapper to simplify the integration, and as a lower level non-langchain version.
|
|
74
|
+
wrapper to simplify the integration, and as a lower level non-langchain version.
|
|
75
75
|
|
|
76
76
|
We also provide an [interactive notebook](example_notebooks/basic_usage.ipynb) that demonstrates some usage examples.
|
|
77
77
|
|
|
@@ -88,15 +88,48 @@ The server's full signature is as follows:
|
|
|
88
88
|
`kfinance.mcp [--stdio,-s]/[--sse, ] --refresh-token <refresh-token> --client-id <client-id> --private-key <private-key>`
|
|
89
89
|
|
|
90
90
|
Authentication Methods (in order of precedence):
|
|
91
|
+
|
|
91
92
|
1. Refresh Token: Uses an existing refresh token for authentication. The `--refresh-token <refresh-token>` argument must be provided.
|
|
92
93
|
2. Key Pair: Uses client ID and private key for authentication. Both the `--client-id <client-id>` and `--private-key <private-key>` arguments must be provided.
|
|
93
94
|
3. Browser: Falls back to browser-based authentication flow. This occurs if no auth arguments are provided.
|
|
94
95
|
|
|
95
96
|
Transport Layers:
|
|
97
|
+
|
|
96
98
|
- stdio can be set by passing either `--stdio` or `-s`
|
|
97
99
|
- sse can be set by passing `--sse` or no other transport related flag
|
|
98
100
|
|
|
101
|
+
# Development
|
|
102
|
+
|
|
103
|
+
## Working with Local Package Version
|
|
104
|
+
|
|
105
|
+
If you need to develop using a local version of the kFinance package in another project that uses [poetry](https://python-poetry.org/) for package and dependency management, follow these steps:
|
|
106
|
+
|
|
107
|
+
1. In your dependent project's `pyproject.toml`, replace the kFinance package version specification:
|
|
108
|
+
|
|
109
|
+
```toml
|
|
110
|
+
# Replace this:
|
|
111
|
+
# kensho-kfinance = "~2.0.1"
|
|
112
|
+
# With this:
|
|
113
|
+
kensho-kfinance = { path = "/absolute/path/to/kfinance", develop = true }
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The `develop = true` flag ensures that the package always matches your local version without requiring reinstallation after changes.
|
|
117
|
+
|
|
118
|
+
2. Update your project's dependencies:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
poetry update # Update poetry.lock with new changes
|
|
122
|
+
poetry install # Install dependencies with updated configuration
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
If you encounter the error "your pyproject.toml file has significantly changed", run:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
poetry lock # Sync the changes to poetry.lock
|
|
129
|
+
```
|
|
130
|
+
|
|
99
131
|
# Versioning
|
|
132
|
+
|
|
100
133
|
The kFinance uses semantic versioning (major, minor, patch).
|
|
101
134
|
To bump the version, add a new entry in [CHANGELOG.md](kfinance%2FCHANGELOG.md).
|
|
102
135
|
This will generate a new version of the library as part of the release process.
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
kensho_kfinance-2.
|
|
2
|
-
kensho_kfinance-2.
|
|
3
|
-
kfinance/CHANGELOG.md,sha256=
|
|
1
|
+
kensho_kfinance-2.6.2.dist-info/licenses/AUTHORS.md,sha256=0h9ClbI0pu1oKj1M28ROUsaxrbZg-6ukQGl6X4y9noI,68
|
|
2
|
+
kensho_kfinance-2.6.2.dist-info/licenses/LICENSE,sha256=bsY4blvSgq6o0FMQ3RXa2NCgco--nHCCchLXzxr6kms,83
|
|
3
|
+
kfinance/CHANGELOG.md,sha256=ndCVbkomHlJ7kB7FoNB3N17A97hrPPtu02dxh-JBdJA,1927
|
|
4
4
|
kfinance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
kfinance/batch_request_handling.py,sha256=
|
|
6
|
-
kfinance/constants.py,sha256=
|
|
7
|
-
kfinance/fetch.py,sha256=
|
|
8
|
-
kfinance/kfinance.py,sha256=
|
|
5
|
+
kfinance/batch_request_handling.py,sha256=G9rhpgQaCdb5C1dsfuJip8383iszibcOJ5k8gxld-tQ,5001
|
|
6
|
+
kfinance/constants.py,sha256=jaHsTXEmGKLp55x1_ob_MA-GVn_hua5B6RZCbujKWz0,49401
|
|
7
|
+
kfinance/fetch.py,sha256=QyQjL2t9Z_tT1DD_Xzal59URH7QtnrpLQywcHSFtoWA,26691
|
|
8
|
+
kfinance/kfinance.py,sha256=WNw6hR7eIKVFM5iBtGrArJcOowange_ed5_PAc0aLzE,72768
|
|
9
9
|
kfinance/mcp.py,sha256=MbktclVfBOEwfe-eR7kPaTXopMJmn_8RMlf4Jx5CXKU,3689
|
|
10
|
-
kfinance/meta_classes.py,sha256=
|
|
10
|
+
kfinance/meta_classes.py,sha256=bUkksl5a9NkQQWmSM2XIWP3jsmmP4ZAfvSxPW5tRZg4,21492
|
|
11
11
|
kfinance/prompt.py,sha256=PtVB8c_FcSlVdyGgByAnIFGzuUuBaEjciCqnBJl1hSQ,25133
|
|
12
12
|
kfinance/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
kfinance/pydantic_models.py,sha256=avpbPqwrAyLqsCbrmFpK_B8_fj1nPlBHrnPxRcBaSkE,774
|
|
14
14
|
kfinance/server_thread.py,sha256=jUnt1YGoYDkqqz1MbCwd44zJs1T_Z2BCgvj75bdtLgA,2574
|
|
15
|
-
kfinance/version.py,sha256=
|
|
15
|
+
kfinance/version.py,sha256=0Bv8KyeMcw-iHj2UIKRw0oUzwjzKa7KzZIuWroBAK1A,511
|
|
16
16
|
kfinance/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
-
kfinance/tests/conftest.py,sha256=
|
|
17
|
+
kfinance/tests/conftest.py,sha256=dhL_RSc-af3j-2_UrAGRE9mxgcbjuIRtj08DTx79pQc,1123
|
|
18
18
|
kfinance/tests/scratch.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
kfinance/tests/test_batch_requests.py,sha256=
|
|
19
|
+
kfinance/tests/test_batch_requests.py,sha256=2A0XnDDDSPkq0-BuiRryZx8b9_jBDtjYd2kWxFVyRew,10140
|
|
20
20
|
kfinance/tests/test_client.py,sha256=O7icZCSDhlQ9WGhzoXlpiSvbuA-mQNJHBYVsilyP_dE,2209
|
|
21
21
|
kfinance/tests/test_example_notebook.py,sha256=XHwDKw2avyMonTmi3snCcFWNfZhEJOkpBGOZNrMLrhk,6470
|
|
22
|
-
kfinance/tests/test_fetch.py,sha256=
|
|
22
|
+
kfinance/tests/test_fetch.py,sha256=mIj61dd843p3D1qtTAO60rZi6Rax0NgefOTTiBFrQcQ,17887
|
|
23
23
|
kfinance/tests/test_group_objects.py,sha256=SoMEZmkG4RYdgWOAwxLHHtzIQho92KM01YbQXPUg578,1689
|
|
24
|
-
kfinance/tests/test_objects.py,sha256=
|
|
25
|
-
kfinance/tests/test_tools.py,sha256=
|
|
24
|
+
kfinance/tests/test_objects.py,sha256=YlpxjlT1kJsDf4SgTZkhhthODwCnwNukJF_wvi11p3A,40805
|
|
25
|
+
kfinance/tests/test_tools.py,sha256=OfyoS4LInkh8c6hlGj-qtTwaL0WqV-8H7od3uNYXnec,29086
|
|
26
26
|
kfinance/tool_calling/README.md,sha256=omJq7Us6r4U45QB7hRpLjRJ5BMalCkZkh4uXBjTbJXc,2022
|
|
27
|
-
kfinance/tool_calling/__init__.py,sha256=
|
|
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=u9FNRiNYiwsFXuWJNOsaW8msMrAYqGcMp-blPG-cIfg,1607
|
|
28
29
|
kfinance/tool_calling/get_business_relationship_from_identifier.py,sha256=CipXvyqEjPm6BXYP0CA9Kp1BIyiIEm7abp85x1zXRV4,1472
|
|
29
30
|
kfinance/tool_calling/get_capitalization_from_identifier.py,sha256=TdWdJDeI-jSL-1YfhnnwIA9D1SXobidvoHrjK42QmqQ,1521
|
|
31
|
+
kfinance/tool_calling/get_competitors_from_identifier.py,sha256=sCmimHZexWzvKE-13TOAErKKUoyBChxp9h_oa3W0Duo,1051
|
|
30
32
|
kfinance/tool_calling/get_cusip_from_ticker.py,sha256=houhGCYXoSzaaTtCvOBf3pPsYiSbcV1Ej5nAyGuMWcU,644
|
|
31
33
|
kfinance/tool_calling/get_earnings.py,sha256=7xavYvqwq4fO0vpks25eDM87bCYwZxEQSwgT0I8jAok,1165
|
|
32
|
-
kfinance/tool_calling/get_earnings_call_datetimes_from_identifier.py,sha256=Zp7gHP-z2ePu484wWx4xw89hl0z7NLcG3qliJT-6rUo,782
|
|
33
34
|
kfinance/tool_calling/get_financial_line_item_from_identifier.py,sha256=TgZCHOKwMVUc0c7k5RGN5FWfXEM9cmJXTrDWiGudad8,2153
|
|
34
35
|
kfinance/tool_calling/get_financial_statement_from_identifier.py,sha256=QM3DfctPq8gMJzRZl508Qc184MWq_o6gwGNZEwbYopg,1906
|
|
35
36
|
kfinance/tool_calling/get_history_metadata_from_identifier.py,sha256=kKIInfRC1Plf-Wnx9cmaJ46RRABm6zn3F5_8qAdqrBg,728
|
|
@@ -37,6 +38,8 @@ kfinance/tool_calling/get_info_from_identifier.py,sha256=PRhSYpYs_iUcIVFGYCMN_7Q
|
|
|
37
38
|
kfinance/tool_calling/get_isin_from_ticker.py,sha256=2fJBcA-rNGbVOQmQ7qJEYxqejQwJ6nyWOBSFlzxG7dY,638
|
|
38
39
|
kfinance/tool_calling/get_latest.py,sha256=btGeVBmvX5QJutzrKfE6spatGGejDuHxtq53NoAaGNk,786
|
|
39
40
|
kfinance/tool_calling/get_latest_earnings.py,sha256=pQdExGdztGY3pHcak0bd6ULNf_ROPc91bJ7zAVSKQkk,1117
|
|
41
|
+
kfinance/tool_calling/get_merger_info_from_transaction_id.py,sha256=8aMktxIs89czDRCn4o7LcUmoTO8ueUDI40nXHo6rNZY,3142
|
|
42
|
+
kfinance/tool_calling/get_mergers_from_identifier.py,sha256=9tCaSrJsK3-i0ZDNKAJRhE-nRdJvQxTbrZbvVY0YmQw,1702
|
|
40
43
|
kfinance/tool_calling/get_n_quarters_ago.py,sha256=A0ilwPKUqU0YYQSz3gNsVF0Jy4YttXrSaDhYj7y8GHA,713
|
|
41
44
|
kfinance/tool_calling/get_next_earnings.py,sha256=knzQw-m-hscCvTuDUXG9v_dObKJBGn5BbDZWGKHKQcw,1097
|
|
42
45
|
kfinance/tool_calling/get_prices_from_identifier.py,sha256=ViJkwLDvStB7grc8RuoKSDXQM399Wru4-OY3E8k1l_U,1882
|
|
@@ -45,7 +48,7 @@ kfinance/tool_calling/get_transcript.py,sha256=eB-IsRwD-mllsMOYRZbH35caQ1Y3teKft
|
|
|
45
48
|
kfinance/tool_calling/prompts.py,sha256=Yw1DJIMh90cjL-8q6_RMRiSjCtFDXvJAy7QiV5_uAU8,911
|
|
46
49
|
kfinance/tool_calling/resolve_identifier.py,sha256=npslr6bBCu0qEDV1-8d24F5OC3nQ1KBMphuMbHVC1AU,626
|
|
47
50
|
kfinance/tool_calling/shared_models.py,sha256=loNoVFVyQnnpHLUIjkR6P9flGNbzp6kkGpL5hT37Sdg,2666
|
|
48
|
-
kensho_kfinance-2.
|
|
49
|
-
kensho_kfinance-2.
|
|
50
|
-
kensho_kfinance-2.
|
|
51
|
-
kensho_kfinance-2.
|
|
51
|
+
kensho_kfinance-2.6.2.dist-info/METADATA,sha256=gmrV13LppEUpW6KMJKZftWQz1UlN165RC-G5Uwpxts8,6197
|
|
52
|
+
kensho_kfinance-2.6.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
53
|
+
kensho_kfinance-2.6.2.dist-info/top_level.txt,sha256=kT_kNwVhfQoOAecY8W7uYah5xaHMoHoAdBIvXh6DaKM,9
|
|
54
|
+
kensho_kfinance-2.6.2.dist-info/RECORD,,
|
kfinance/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# v2.6.3
|
|
4
|
+
- Bump urllib3 to 2.5 to address CVEs
|
|
5
|
+
|
|
6
|
+
## v2.6.2
|
|
7
|
+
- Safely check for incomplete merger information
|
|
8
|
+
|
|
9
|
+
## v2.6.1
|
|
10
|
+
- Remove get_earnings_call_datetimes_from_identifier tool
|
|
11
|
+
|
|
12
|
+
## v2.6.0
|
|
13
|
+
- Add mergers & acquisitions.
|
|
14
|
+
|
|
15
|
+
## v2.5.0
|
|
16
|
+
- Add competitors function and llm tools
|
|
17
|
+
|
|
18
|
+
## v2.4.4
|
|
19
|
+
- Replace `cached_property` with `property` to enable batching
|
|
20
|
+
|
|
3
21
|
## v2.4.3
|
|
4
22
|
- Improve MCP tool build process
|
|
5
23
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from concurrent.futures import Future
|
|
2
2
|
import functools
|
|
3
|
-
from functools import cached_property
|
|
4
3
|
import threading
|
|
5
4
|
from typing import Any, Callable, Iterable, Protocol, Sized, Type, TypeVar
|
|
6
5
|
|
|
@@ -17,7 +16,7 @@ throttle = threading.Semaphore(MAX_WORKERS_CAP)
|
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
def add_methods_of_singular_class_to_iterable_class(singular_cls: Type[T]) -> Callable:
|
|
20
|
-
"""Returns a decorator that
|
|
19
|
+
"""Returns a decorator that adds methods and properties from a singular to a plural class."""
|
|
21
20
|
"[singular_cls] as an attribute of the decorated class."
|
|
22
21
|
|
|
23
22
|
class IterableKfinanceClass(Protocol, Sized, Iterable[T]):
|
|
@@ -32,7 +31,7 @@ def add_methods_of_singular_class_to_iterable_class(singular_cls: Type[T]) -> Ca
|
|
|
32
31
|
"""Adds functions from a singular class to an iterable class.
|
|
33
32
|
|
|
34
33
|
This decorator modifies the [iterable_cls] so that when an attribute
|
|
35
|
-
(method
|
|
34
|
+
(method or property) added by the decorator is accessed,
|
|
36
35
|
it returns a dictionary. This dictionary maps each object in [iterable_cls]
|
|
37
36
|
to the result of invoking the attribute on that specific object.
|
|
38
37
|
|
|
@@ -109,19 +108,6 @@ def add_methods_of_singular_class_to_iterable_class(singular_cls: Type[T]) -> Ca
|
|
|
109
108
|
|
|
110
109
|
setattr(iterable_cls, method_name, property(create_prop_wrapper(method)))
|
|
111
110
|
|
|
112
|
-
elif isinstance(method, cached_property):
|
|
113
|
-
|
|
114
|
-
def create_cached_prop_wrapper(method: cached_property) -> cached_property:
|
|
115
|
-
@functools.wraps(method.func)
|
|
116
|
-
def cached_prop_wrapper(self: IterableKfinanceClass) -> Any:
|
|
117
|
-
return process_in_batch(method.func, self)
|
|
118
|
-
|
|
119
|
-
wrapped_cached_property = cached_property(cached_prop_wrapper)
|
|
120
|
-
wrapped_cached_property.__set_name__(iterable_cls, method_name)
|
|
121
|
-
return wrapped_cached_property
|
|
122
|
-
|
|
123
|
-
setattr(iterable_cls, method_name, create_cached_prop_wrapper(method))
|
|
124
|
-
|
|
125
111
|
return iterable_cls
|
|
126
112
|
|
|
127
113
|
return decorator
|
kfinance/constants.py
CHANGED
|
@@ -101,6 +101,20 @@ class Permission(StrEnum):
|
|
|
101
101
|
RelationshipPermission = "RelationshipPermission"
|
|
102
102
|
StatementsPermission = "StatementsPermission"
|
|
103
103
|
SegmentsPermission = "SegmentsPermission"
|
|
104
|
+
MergersPermission = "MergersPermission"
|
|
105
|
+
CompetitorsPermission = "CompetitorsPermission"
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class CompetitorSource(StrEnum):
|
|
109
|
+
"""The source type of the competitor information: 'filing' (from SEC filings), 'key_dev' (from key developments), 'contact' (from contact relationships), 'third_party' (from third-party sources), 'self_identified' (self-identified), 'named_by_competitor' (from competitor's perspective)."""
|
|
110
|
+
|
|
111
|
+
all = "all"
|
|
112
|
+
filing = "filing"
|
|
113
|
+
key_dev = "key_dev"
|
|
114
|
+
contact = "contact"
|
|
115
|
+
third_party = "third_party"
|
|
116
|
+
self_identified = "self_identified"
|
|
117
|
+
named_by_competitor = "named_by_competitor"
|
|
104
118
|
|
|
105
119
|
|
|
106
120
|
class YearAndQuarter(TypedDict):
|
kfinance/fetch.py
CHANGED
|
@@ -11,6 +11,7 @@ import requests
|
|
|
11
11
|
|
|
12
12
|
from .constants import (
|
|
13
13
|
BusinessRelationshipType,
|
|
14
|
+
CompetitorSource,
|
|
14
15
|
IdentificationTriple,
|
|
15
16
|
IndustryClassification,
|
|
16
17
|
Periodicity,
|
|
@@ -577,3 +578,58 @@ class KFinanceApiClient:
|
|
|
577
578
|
"""Get the transcript for an earnings item."""
|
|
578
579
|
url = f"{self.url_base}transcript/{key_dev_id}"
|
|
579
580
|
return self.fetch(url)
|
|
581
|
+
|
|
582
|
+
def fetch_competitors(self, company_id: int, competitor_source: CompetitorSource) -> dict:
|
|
583
|
+
"""Get the competitors for a company."""
|
|
584
|
+
url = f"{self.url_base}competitors/{company_id}"
|
|
585
|
+
if competitor_source is not CompetitorSource.all:
|
|
586
|
+
url = url + f"/{competitor_source}"
|
|
587
|
+
return self.fetch(url)
|
|
588
|
+
|
|
589
|
+
def fetch_mergers_for_company(
|
|
590
|
+
self,
|
|
591
|
+
company_id: int,
|
|
592
|
+
) -> dict[str, list[dict[str, int | str]]]:
|
|
593
|
+
"""Fetches the mergers and acquisitions the given company was involved in.
|
|
594
|
+
|
|
595
|
+
Returns a dictionary of shape {"target", [{"transaction_id": <transaction_id>, "merger_title": <merger short title>}], "buyer": [...], "seller": [...]}
|
|
596
|
+
:param company_id: The company ID to filter on.
|
|
597
|
+
:type company_id: int
|
|
598
|
+
:return: A dictionary containing transaction IDs and 'merger titles' for each of the three kinds of roles the given company could be party to.
|
|
599
|
+
:rtype: dict[str, list[dict[str, int | str]]]
|
|
600
|
+
"""
|
|
601
|
+
url = f"{self.url_base}mergers/{company_id}"
|
|
602
|
+
return self.fetch(url)
|
|
603
|
+
|
|
604
|
+
def fetch_merger_info(
|
|
605
|
+
self,
|
|
606
|
+
transaction_id: int,
|
|
607
|
+
) -> dict:
|
|
608
|
+
"""Fetches information about the given merger or acquisition, including the timeline, the participants, and the considerations.
|
|
609
|
+
|
|
610
|
+
Returns a complex dictionary.
|
|
611
|
+
:param transaction_id: The transaction ID to filter on.
|
|
612
|
+
:type transaction_id: int
|
|
613
|
+
:return: A dictionary containing the timeline, the participants, and the considerations (eith their details) of the transaction.
|
|
614
|
+
:rtype: dict
|
|
615
|
+
"""
|
|
616
|
+
url = f"{self.url_base}merger/info/{transaction_id}"
|
|
617
|
+
return self.fetch(url)
|
|
618
|
+
|
|
619
|
+
def fetch_advisors_for_company_in_merger(
|
|
620
|
+
self,
|
|
621
|
+
transaction_id: int,
|
|
622
|
+
advised_company_id: int,
|
|
623
|
+
) -> dict[str, list[dict[str, int | str]]]:
|
|
624
|
+
"""Fetch information about the advisors of a given company involved in a given merger or acquisition.
|
|
625
|
+
|
|
626
|
+
Returns a dictionary of shape {"advisors": [{"advisor_company_id": <advisor_company_id>, "advisor_company_name": <advisor_company_name>, "advisor_type_name": <advisor_type_name>},...]}
|
|
627
|
+
:param transaction_id: The transaction ID to filter on.
|
|
628
|
+
:type transaction_id: int
|
|
629
|
+
:param advised_company_id: The company ID involved with the transaction.
|
|
630
|
+
:type advised_company_id: int
|
|
631
|
+
:return: A dictionary containing the list of companies advising a company involved with a merger or acquisition, along with their advisor type.
|
|
632
|
+
:rtype: dict[str, list[dict[str, int | str]]]
|
|
633
|
+
"""
|
|
634
|
+
url = f"{self.url_base}merger/info/{transaction_id}/advisors/{advised_company_id}"
|
|
635
|
+
return self.fetch(url)
|