finnhub-stock-api
What it does
This skill explains how the AI agent can call the Finnhub stock data API. It is for developers building dashboards or tools that show stock prices and company details.
When to use it
- ✓When you want live stock quotes shown in an app or dashboard.
- ✓When you need a company profile such as its name, exchange and logo.
- ✓When you want historical price data for charts or analysis.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/finnhub-stock-api/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Add a live stock quote and company profile for AAPL to my dashboard, using the Finnhub API.”
5 new skills a week. 1 minute to read.
How it works
The agent calls the Finnhub endpoints with an API key in the query. It can get the current quote, the company profile, or historical candles, and it respects the free-tier rate limit of 60 requests per minute.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Finnhub Stock API Integration
Finnhub provides free stock market data (REST + WebSocket). API key required (free tier: 60 calls/min).
- Docs: https://finnhub.io/docs/api
- Base URL:
https://finnhub.io/api/v1 - Auth: Query param
token=YOUR_API_KEY - Rate limit: 60 requests/minute (free), 300/min (premium)
- CORS: Unknown (use server-side proxy)
Key Endpoints
1. Stock Quote (Real-Time)
GET /quote?symbol=AAPL&token=API_KEY
Response:
{
"c": 178.72, // Current price
"d": 2.38, // Change (absolute)
"dp": 1.35, // Change percent
"h": 179.60, // High price of the day
"l": 175.10, // Low price of the day
"o": 176.15, // Open price
"pc": 176.34, // Previous close
"t": 1702569600 // Timestamp
}
2. Company Profile
GET /stock/profile2?symbol=AAPL&token=API_KEY
Response:
{
"country": "US",
"currency": "USD",
"exchange": "NASDAQ NMS - GLOBAL MARKET",
"name": "Apple Inc",
"ticker": "AAPL",
"ipo": "1980-12-12",
"marketCapitalization": 2794000,
"logo": "https://static.finnhub.io/logo/..."
}
3. Stock Candles (Historical)
GET /stock/candle?symbol=AAPL&resolution=D&from=1609459200&to=1640995200&token=API_KEY
resolution: 1, 5, 15, 30, 60, D, W, Mfrom/to: UNIX timestamps
Response:
{
"c": [130.21, 131.96, ...], // Close prices
"h": [131.74, 132.63, ...], // Highs
"l": [128.50, 130.23, ...], // Lows
"o": [130.92, 130.87, ...], // Opens
"v": [143301900, ...], // Volumes
"t": [1609459200, ...], // Timestamps
"s": "ok" // Status
}
4. Market News
GET /news?category=general&token=API_KEY
Categories: general, forex, crypto, merger
Frontend Service Implementation
// src/services/stock-market.ts
import { createCircuitBreaker } from '@/utils/circuit-breaker';
export interface StockQuote {
symbol: string;
name: string;
price: number | null;
change: number | null;
changePercent: number | null;
high: number | null;
low: number | null;
sparkline?: number[];
}
const quoteBreaker = createCircuitBreaker<StockQuote[]>({
name: 'StockQuotes',
cacheTtlMs: 30_000,
});
const DEFAULT_SYMBOLS = ['AAPL', 'MSFT', 'GOOGL', 'AMZN', 'TSLA', 'NVDA', 'META'];
export async function fetchStockQuotes(symbols = DEFAULT_SYMBOLS): Promise<StockQuote[]> {
return quoteBreaker.execute(async () => {
const resp = await fetch(`/api/stocks?symbols=${symbols.join(',')}`);
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
const data = await resp.json();
return data.quotes.map((q: any) => ({
symbol: q.symbol,
name: q.name || q.symbol,
price: q.price ?? q.c ?? null,
change: q.change ?? q.d ?? null,
changePercent: q.changePercent ?? q.dp ?? null,
high: q.high ?? q.h ?? null,
low: q.low ?? q.l ?? null,
}));
}, []);
}
Alternative APIs (from public-apis)
If Finnhub rate limits are a concern, these alternatives are available:
| API | Free Tier | Notes |
|---|---|---|
| Alpha Vantage | 25 req/day (free) | https://www.alphavantage.co/ |
| Twelve Data | 800 req/day | https://twelvedata.com/ |
| Financial Modeling Prep | 250 req/day | https://financialmodelingprep.com/ |
| Yahoo Finance (via RapidAPI) | Varies | https://www.yahoofinanceapi.com/ |
| Polygon | 5 req/min (free) | https://polygon.io/ |
| IEX Cloud | 50k credits/month | https://iexcloud.io/ |
| Marketstack | 100 req/month | https://marketstack.com/ |
Server-Side Proxy
The frontend should never call Finnhub directly. Use the API proxy pattern (see api-proxy-endpoint skill) to:
- Hide the API key
- Batch multiple symbol requests
- Add edge caching (30s
Cache-Control) - Handle rate limit errors gracefully (return cached data)
FAQ
Does Finnhub need an API key?
Yes, the skill says an API key is required and is passed as a token in the request.
What is the free rate limit?
The skill lists 60 requests per minute on the free tier and 300 on premium.
Should the key be used in the browser?
The skill notes that CORS is unknown, so it suggests a server-side proxy.
Details
Original description by the author
Integrate with Finnhub Stock API for real-time and historical stock market data. Covers quote fetching, company profiles, and WebSocket streaming.
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #13054
- License
- MIT
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
agentpilot
7.8kHelps your agent improve a project step by step by preparing a task and running the AgentPilot loop that proposes, tests and scores changes.
openspace
7.8kHelps your agent set up OpenSpace, a tool that stores and fetches agent skills, and connect it to your AI app through MCP.
rsi-arena
7.8kHelps your agent set up and run standard AI benchmark tests, such as AIME and Terminal-Bench, to compare different improvement methods.
experiment-guide
7.8kHelps your agent plan small experiments, read their results and record findings while it investigates how to improve a program.
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.