Finance & Markets
Structured financials, ratios, and insider transactions.
financial_dataPulls 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.
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.
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.
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.
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();Real scenarios where agents put this tool to work.
Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/common/FinancialDataTool.java in the swarm-ai repository.