Python CLI for kFinance
Project description
kFinance
The kFinance Python library provides a simple interface for the LLM-ready API, streamlining API requests and response handling. It can be used on its own, with LLMs, or integrated into applications.
For a complete overview of the functions, usage, and features of the kFinance Python library, please refer to documentation here.
Any questions or suggestions can be sent to the kFinance Maintainers.
Setup
You can install kFinance on PyPI via
pip install kensho-kfinance
Getting started
To receive access, please email S&P Global Market Intelligence for information on free trials and pricing.
Once access is obtained, get started using the Authentication Guide and Usage Guide.
To get started, we provide some notebooks:
- The LLM-ready API Basic Usage notebook demonstrates how fetch data with the kFinance client.
- The tool_calling notebooks show how the kFinance library can be used for tool calling. We provide notebooks for OpenAI (GPT), Anthropic (Claude), and Google (Gemini). Each of these integrations comes in a langchain version, which uses langchain as a wrapper to simplify the integration, and as a lower level non-langchain version.
We also provide an interactive notebook that demonstrates some usage examples.
MCP (Model Context Protocol)
To run the kFinance MCP server use:
python -m kfinance.mcp
This function initializes and starts an MCP server that exposes the kFinance tools. The server supports multiple authentication methods and transport protocols to accommodate different deployment scenarios.
The server's full signature is as follows:
kfinance.mcp [--stdio,-s]/[--sse, ] --refresh-token <refresh-token> --client-id <client-id> --private-key <private-key>
Authentication Methods (in order of precedence):
- Refresh Token: Uses an existing refresh token for authentication. The
--refresh-token <refresh-token>argument must be provided. - 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. - Browser: Falls back to browser-based authentication flow. This occurs if no auth arguments are provided.
Transport Layers:
- stdio can be set by passing either
--stdioor-s - sse can be set by passing
--sseor no other transport related flag
Development
Working with Local Package Version
If you need to develop using a local version of the kFinance package in another project that uses poetry for package and dependency management, follow these steps:
-
In your dependent project's
pyproject.toml, replace the kFinance package version specification:# Replace this: # kensho-kfinance = "~2.0.1" # With this: kensho-kfinance = { path = "/absolute/path/to/kfinance", develop = true }
The
develop = trueflag ensures that the package always matches your local version without requiring reinstallation after changes. -
Update your project's dependencies:
poetry update # Update poetry.lock with new changes poetry install # Install dependencies with updated configuration
If you encounter the error "your pyproject.toml file has significantly changed", run:
poetry lock # Sync the changes to poetry.lock
Versioning
The kFinance uses semantic versioning (major, minor, patch). To bump the version, add a new entry in CHANGELOG.md. This will generate a new version of the library as part of the release process.
License
Use is solely in accordance with the signed agreement between your entity and S&P.
Copyright 2025-present Kensho Technologies, LLC. The present date is determined by the timestamp of the most recent commit in the repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kensho_kfinance-3.2.0.tar.gz.
File metadata
- Download URL: kensho_kfinance-3.2.0.tar.gz
- Upload date:
- Size: 113.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c18d47840902887ddb9e08466820ff6a3c0322363575e210257c00c1ee29610b
|
|
| MD5 |
d615538515d8520a971f8b452fc09ce1
|
|
| BLAKE2b-256 |
56ebca34afe843be3dcf50988e7cdc6ad2d86857615344274b265903dab97e63
|
Provenance
The following attestation bundles were made for kensho_kfinance-3.2.0.tar.gz:
Publisher:
python-publish.yml on kensho-technologies/kfinance
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kensho_kfinance-3.2.0.tar.gz -
Subject digest:
c18d47840902887ddb9e08466820ff6a3c0322363575e210257c00c1ee29610b - Sigstore transparency entry: 389672015
- Sigstore integration time:
-
Permalink:
kensho-technologies/kfinance@8eee3ba562b7917bad7397a2990ead99898e6f63 -
Branch / Tag:
refs/tags/v3.2.0 - Owner: https://github.com/kensho-technologies
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8eee3ba562b7917bad7397a2990ead99898e6f63 -
Trigger Event:
release
-
Statement type:
File details
Details for the file kensho_kfinance-3.2.0-py3-none-any.whl.
File metadata
- Download URL: kensho_kfinance-3.2.0-py3-none-any.whl
- Upload date:
- Size: 126.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd2e08da7cef5d92d880dbedfe11e3f034bd13d3432c8da4792c9a2725025eb4
|
|
| MD5 |
07628b83bc04f01f0e2720e92ca60f3b
|
|
| BLAKE2b-256 |
423b6524a25ac224e291adbc9f1750c30c448609b0e93f764595b7e3ffaa5de0
|
Provenance
The following attestation bundles were made for kensho_kfinance-3.2.0-py3-none-any.whl:
Publisher:
python-publish.yml on kensho-technologies/kfinance
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kensho_kfinance-3.2.0-py3-none-any.whl -
Subject digest:
bd2e08da7cef5d92d880dbedfe11e3f034bd13d3432c8da4792c9a2725025eb4 - Sigstore transparency entry: 389672098
- Sigstore integration time:
-
Permalink:
kensho-technologies/kfinance@8eee3ba562b7917bad7397a2990ead99898e6f63 -
Branch / Tag:
refs/tags/v3.2.0 - Owner: https://github.com/kensho-technologies
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8eee3ba562b7917bad7397a2990ead99898e6f63 -
Trigger Event:
release
-
Statement type: