Name | llama-index-tools-finance JSON |
Version |
0.3.0
JSON |
| download |
home_page | None |
Summary | llama-index finance-tools integration |
upload_time | 2024-11-17 23:05:32 |
maintainer | None |
docs_url | None |
author | Your Name |
requires_python | <3.12,>=3.9 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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
```python
from llama_index.agent.openai import OpenAIAgent
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,
) -> OpenAIAgent:
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 OpenAIAgent.from_tools(
tool_spec.to_tool_list(), llm=llm, verbose=True
)
agent = create_agent(
POLYGON_API_KEY,
FINNHUB_API_KEY,
ALPHA_VANTAGE_API_KEY,
NEWSAPI_API_KEY,
OPENAI_API_KEY,
)
response = agent.chat("What happened to AAPL stock on February 19th, 2024?")
```
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-tools-finance",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.12,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/3f/88/fe150c814390a2e79598c364b89aeb23597ddf3528cf6de41b99c5b08ab0/llama_index_tools_finance-0.3.0.tar.gz",
"platform": null,
"description": "# Finance Agent Tool\n\nThis tool connects to various open finance apis and libraries to gather news, earnings information and doing fundamental analysis.\n\nTo use this tool, you'll need a few API keys:\n\n- POLYGON_API_KEY -- <https://polygon.io/>\n- FINNHUB_API_KEY -- <https://finnhub.io/>\n- ALPHA_VANTAGE_API_KEY -- <https://www.alphavantage.co/>\n- NEWSAPI_API_KEY -- <https://newsapi.org/>\n\n## Installation\n\n```\npip install llama-index-tools-finance\n```\n\n## Usage\n\n```python\nfrom llama_index.agent.openai import OpenAIAgent\nfrom llama_index.llms.openai import OpenAI\nfrom llama_index.tools.finance import FinanceAgentToolSpec\n\nPOLYGON_API_KEY = \"\"\nFINNHUB_API_KEY = \"\"\nALPHA_VANTAGE_API_KEY = \"\"\nNEWSAPI_API_KEY = \"\"\nOPENAI_API_KEY = \"\"\n\nGPT_MODEL_NAME = \"gpt-4-0613\"\n\n\ndef create_agent(\n polygon_api_key: str,\n finnhub_api_key: str,\n alpha_vantage_api_key: str,\n newsapi_api_key: str,\n openai_api_key: str,\n) -> OpenAIAgent:\n tool_spec = FinanceAgentToolSpec(\n polygon_api_key,\n finnhub_api_key,\n alpha_vantage_api_key,\n newsapi_api_key,\n )\n llm = OpenAI(temperature=0, model=GPT_MODEL_NAME, api_key=openai_api_key)\n return OpenAIAgent.from_tools(\n tool_spec.to_tool_list(), llm=llm, verbose=True\n )\n\n\nagent = create_agent(\n POLYGON_API_KEY,\n FINNHUB_API_KEY,\n ALPHA_VANTAGE_API_KEY,\n NEWSAPI_API_KEY,\n OPENAI_API_KEY,\n)\n\nresponse = agent.chat(\"What happened to AAPL stock on February 19th, 2024?\")\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index finance-tools integration",
"version": "0.3.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6be849faea9015692f19c652a425aa18c441d55928df5db73a6d7558f438bfef",
"md5": "eb926fe43923f69ea28ff60a4a2c1458",
"sha256": "5d944974f87989ec970ea1601e5551e5ab1f4d0c7b099da7f857f244b72025c6"
},
"downloads": -1,
"filename": "llama_index_tools_finance-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "eb926fe43923f69ea28ff60a4a2c1458",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.12,>=3.9",
"size": 9151,
"upload_time": "2024-11-17T23:05:30",
"upload_time_iso_8601": "2024-11-17T23:05:30.712640Z",
"url": "https://files.pythonhosted.org/packages/6b/e8/49faea9015692f19c652a425aa18c441d55928df5db73a6d7558f438bfef/llama_index_tools_finance-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3f88fe150c814390a2e79598c364b89aeb23597ddf3528cf6de41b99c5b08ab0",
"md5": "1c2b26b9a8619aa56f691fb6eece9cac",
"sha256": "cdb886f53f21d7ab96a28513a6550697771749410097a015b37a8b3d77b83d4d"
},
"downloads": -1,
"filename": "llama_index_tools_finance-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "1c2b26b9a8619aa56f691fb6eece9cac",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.12,>=3.9",
"size": 7690,
"upload_time": "2024-11-17T23:05:32",
"upload_time_iso_8601": "2024-11-17T23:05:32.223812Z",
"url": "https://files.pythonhosted.org/packages/3f/88/fe150c814390a2e79598c364b89aeb23597ddf3528cf6de41b99c5b08ab0/llama_index_tools_finance-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-17 23:05:32",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-tools-finance"
}