Finance Agent Tool
This tool connects to various open finance apis and libraries to gather news, earnings information and doing fundamental analysis.
To use this tool, you'll need a few API keys:
- POLYGON_API_KEY -- https://polygon.io/
- FINNHUB_API_KEY -- https://finnhub.io/
- ALPHA_VANTAGE_API_KEY -- https://www.alphavantage.co/
- NEWSAPI_API_KEY -- https://newsapi.org/
Installation
pip install llama-index-tools-finance
Usage
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.finance import FinanceAgentToolSpec
POLYGON_API_KEY = ""
FINNHUB_API_KEY = ""
ALPHA_VANTAGE_API_KEY = ""
NEWSAPI_API_KEY = ""
OPENAI_API_KEY = ""
GPT_MODEL_NAME = "gpt-4-0613"
def create_agent(
polygon_api_key: str,
finnhub_api_key: str,
alpha_vantage_api_key: str,
newsapi_api_key: str,
openai_api_key: str,
) -> FunctionAgent:
tool_spec = FinanceAgentToolSpec(
polygon_api_key,
finnhub_api_key,
alpha_vantage_api_key,
newsapi_api_key,
)
llm = OpenAI(temperature=0, model=GPT_MODEL_NAME, api_key=openai_api_key)
return FunctionAgent(
tools=tool_spec.to_tool_list(),
llm=llm,
)
agent = create_agent(
POLYGON_API_KEY,
FINNHUB_API_KEY,
ALPHA_VANTAGE_API_KEY,
NEWSAPI_API_KEY,
OPENAI_API_KEY,
)
response = await agent.run(
"What happened to AAPL stock on February 19th, 2024?"
)
Metadata
Release files for llama-index-tools-finance 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llama_index_tools_finance-0.6.0.tar.gz | 8.5 kB | Without provenance | Details for llama_index_tools_finance-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_tools_finance-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for llama_index_tools_finance-0.6.0-py3-none-any.whl |
Total release size: 18.3 kB
Release files / llama_index_tools_finance-0.6.0.tar.gz
| Download URL | llama_index_tools_finance-0.6.0.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c7eeb702c2fcfb7cfe073c8535c8ce93f1535db26e1bb5b1f3972e97058d17c
|
|
BLAKE2b-256 checksum How to use checksums |
c5661ca83283d0faad0575a41cbc7d3b40208c0a037640bc597bdf11da959247
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / llama_index_tools_finance-0.6.0-py3-none-any.whl
| Download URL | llama_index_tools_finance-0.6.0-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6450831f14da6881793eea384358a4bfe2ec7cdcfeb68e6882c289bde57e49b5
|
|
BLAKE2b-256 checksum How to use checksums |
9b73615b3a697f756084c32f14bb8ba5f4057cf21d64768d65aefa6e72d73f2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for llama-index-tools-finance 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.