Skill

Access Financial Data and News

Finance Agent Tool connects AI assistants to Polygon, Finnhub, Alpha Vantage, and NewsAPI to retrieve stock news, earnings data, and fundamental analysis.

Works with polygonfinnhubalphavantagenewsapiopenai

57
Spark score
out of 100
Updated 4 days ago
Version 0.14.22
Models

Add to Favorites

Why it matters

Integrate with leading financial APIs to gather real-time news, earnings data, and perform fundamental analysis on stocks.

Outcomes

What it gets done

01

Connect to Polygon.io, Finnhub, Alpha Vantage, and NewsAPI.

02

Retrieve stock news and earnings information.

03

Perform fundamental analysis on financial data.

04

Query historical stock performance.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-tool-tools-finance | bash

Capabilities

What this skill does

Scrape

Fetches and parses content from web pages.

Search the web

Searches the web and retrieves relevant sources.

Summarize

Condenses long documents or threads into key takeaways.

Query a database

Writes and executes SQL or NoSQL queries on databases.

Overview

Finance Agent Tool

What it does

A LlamaIndex tool spec that connects to Polygon, Finnhub, Alpha Vantage, and NewsAPI to gather financial news, earnings information, and fundamental analysis data for AI agents.

How it connects

Use this tool when building AI agents that need to access financial market data, stock information, earnings reports, and financial news from multiple open finance APIs through a unified interface.

Source README

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:

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?"
)

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.