← All tools

Finance & Markets

Financial Data (Finnhub)

Structured financials, ratios, and insider transactions.

financial_data

Overview

Pulls the numbers behind a public company — revenue, profits, balance-sheet items, key ratios, insider trading — from the Finnhub data service. Give it a ticker like AAPL and it hands the agent a ready-to-read financial summary.

How it works

Queries Finnhub by ticker and aggregates the income statement, balance sheet, cash flow, derived ratios (P/E, P/B, ROE, net and gross margin), and the most recent insider transactions into a single markdown report. Each fact is tagged with its source so downstream report generation can cite them.

Example

When a user asks:

Show me Apple's latest income statement and key ratios.

the agent calls the tool:

financial_data(ticker="AAPL")

and gets back: a citation-tagged markdown report with revenue, margins, P/E, ROE, and insider activity.

Configuration

Set these before calling the tool. Values marked required must be present or the tool call will fail.

FINNHUB_API_KEY required

Finnhub API key used for income statement, balance sheet, cash flow, metrics, and insider feeds.

finnhub.api-key optional

Spring property alternative to FINNHUB_API_KEY.

Use it in a workflow

Wire this tool into a SwarmAI crew. Use the YAML DSL for declarative workflows, or the Java builder API when you want full programmatic control.

YAML DSL

# equity-research.yaml
name: equity-research-crew
process: SEQUENTIAL

agents:
  - id: analyst
    role: Equity Analyst
    goal: Build fundamentals profiles for public companies
    tools:
      - financial_data

tasks:
  - id: equity-research-task
    agent: analyst
    description: Pull the most recent income statement, balance sheet, and key ratios for AAPL.

Java

import ai.intelliswarm.swarmai.agent.Agent;
import ai.intelliswarm.swarmai.task.Task;
import ai.intelliswarm.swarmai.swarm.Swarm;
import ai.intelliswarm.swarmai.swarm.SwarmOutput;
import ai.intelliswarm.swarmai.process.ProcessType;
import ai.intelliswarm.swarmai.tool.common.FinancialDataTool;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;

@Autowired ChatClient chatClient;
@Autowired FinancialDataTool financialDataTool;

Agent analyst = Agent.builder()
    .role("Equity Analyst")
    .goal("Build fundamentals profiles for public companies")
    .chatClient(chatClient)
    .tool(financialDataTool)
    .build();

Task analystTask = Task.builder()
    .description("Pull the most recent income statement, balance sheet, and key ratios for AAPL.")
    .agent(analyst)
    .build();

SwarmOutput result = Swarm.builder()
    .agent(analyst)
    .task(analystTask)
    .process(ProcessType.SEQUENTIAL)
    .build()
    .kickoff();

What it's good for

Real scenarios where agents put this tool to work.

Equity research crews producing citation-tagged reports
Foreign-issuer analysis where SEC XBRL is sparse
Insider-transaction monitoring
Quarterly revenue/margin trend summaries

Source

Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/common/FinancialDataTool.java in the swarm-ai repository.

Open financial_data on GitHub →