Use when building with the yahoo-finance2 TypeScript/Deno/npm library, using its Yahoo Finance data modules, CLI, or MCP server, or contributing to the yahoo-finance2 repository including modules, validation schemas, cached fixtures, and npm/JSR build output.
npx skills add https://github.com/gadicc/yahoo-finance2 --skill yahoo-finance2
Use this skill when a task involves yahoo-finance2, including:
quote, chart, historical, quoteSummary,fundamentalsTimeSeries, screener, options, or other modules.
npm output build.
This is an unofficial Yahoo Finance client. Do not describe it as a supported
Yahoo API, and do not assume Yahoo data availability, freshness, or shape is
guaranteed.
Prefer the v3 class API:
import YahooFinance from "yahoo-finance2";
const yahooFinance = new YahooFinance();
const quote = await yahooFinance.quote("AAPL");
console.log(quote?.regularMarketPrice, quote?.currency);
Do not use old v1/v2 singleton patterns such as
yahooFinance.setGlobalConfig(). In v3, instantiate with
new YahooFinance(options).
This package is for server-side runtimes. Do not put direct Yahoo Finance calls
in browser/client bundles; Yahoo's CORS and cookie behavior require a server,
serverless, edge, Deno, Bun, or Node context.
search(query) first when a symbol is uncertain.quote(symbolOrSymbols) for current or near real-time quote fields. Itaccepts one symbol or an array. Use fields to limit payloads; for keyed
access, request object or map returns.
quoteCombine(symbol) when many independent code paths need quote data;it debounces many single-symbol calls into fewer quote() requests.
chart(symbol, { period1, period2, interval }) for chart-ready historicaldata with events such as dividends and splits. return: "array" is easier to
iterate; return: "object" mirrors Yahoo's native shape.
historical() for a simpler OHLCV history interface.quoteSummary(symbol, { modules }) for profile, price, summary detail,filings, ownership, recommendations, and other quote-summary modules. Request
only the modules needed.
fundamentalsTimeSeries() for financial statements. Since late 2024,quote-summary financial-statement modules such as incomeStatementHistory,
balanceSheetHistory, and cashflowStatementHistory provide little data.
options(symbol) for options chains.screener() instead of removed/deprecated daily gainers or losersmodules. Common predefined screeners include day_gainers, day_losers, and
most_actives.
trendingSymbols(region), recommendationsBySymbol(), and insights()for their specialized Yahoo Finance endpoints.
Wrap module calls in try/catch. Network errors, Yahoo API errors, delisted
symbols, missing data, and validation failures are expected operating
conditions.
By default, returned data is validated and coerced so known dates become Date
objects and known result shapes are safe to consume. If validation fails, fixing
the typed interface and regenerated schema is usually better than turning
validation off.
Only use { validateResult: false } when the caller accepts unknown output
and performs its own checks. Use { validateOptions: false } only when
experimenting with Yahoo query parameters that the library does not yet model.
The default client queue limits concurrent Yahoo requests. Use constructor or
per-call queue options when you need stricter rate behavior:
const yahooFinance = new YahooFinance({
queue: { concurrency: 2, interval: 250 },
});
For quick shell use:
npx yahoo-finance2 search AMZN
npx yahoo-finance2 quote AAPL
npx yahoo-finance2 quoteSummary NVDA '{"modules":["assetProfile","secFilings"]}'
JSON-looking positional arguments are parsed as JSON. Successful piped output is
JSON-safe.
For MCP clients, the package includes a read-only Yahoo Finance MCP server:
npx -y -p yahoo-finance2 yahoo-finance-mcp
See docs/mcp.md for stdio, HTTP, embedded handler, and client registration
details.
Read AGENTS.md and CONTRIBUTING.md first. This repo is Deno-first
TypeScript; npm output is generated.
Edit source files under src/, not generated files under npm/, unless the
task explicitly asks for generated output. Preserve local .ts import
extensions.
Public module files usually follow this pattern:
@yf-schema import their generated .schema.json.this._moduleExec() with query defaults, runtimeparams, optional transforms, result transforms, schema keys, and module
options.
{ validateResult: false },which returns unknown.
When changing an exported interface in a file marked @yf-schema, run:
deno task schema
If adding a module, wire it through src/modules/index.ts, deno.json exports,
docs/README links, README module lists when relevant, tests, and any CLI/MCP
exposure only when the module should be user-facing there.
Run all tests with:
deno task test
Run focused tests with:
deno task test src/modules/quote.test.ts
Use deno task test:serial src/modules/quote.test.ts when debugging or limiting
live Yahoo request concurrency.
Tests that touch Yahoo HTTP responses should call setupCache() from
tests/common.ts. Prefer the existing pattern:
const YahooFinance = createTestYahooFinance({ modules: { quote } });
const yf = new YahooFinance();
describe("quote", () => {
setupCache();
it("passes validation", async (t, onFinish) => {
await yf.quote("AAPL", {}, {
devel: { id: "quote-AAPL", t, onFinish },
});
});
});
Use fixture ids that match the module and scenario. FETCH_DEVEL=nocache forces
live network calls. FETCH_DEVEL=recache refreshes cache files for failing
tests. Do not recache fixtures ending in .static.json or .fake.json; they
are intentionally stable or synthetic.
When fixing validation failures, inspect the validation error path and cached
Yahoo response, update the TypeScript interface first, run schema generation,
then run the focused test.
Use these checks as appropriate:
deno fmt
deno lint
deno task test
deno task build:npm
scripts/build_npm.ts controls the generated npm package metadata, binaries,
dependencies, copied files, and package keywords. Keep npm-package changes there
unless explicitly regenerating npm/.
Commit messages should use Conventional Commits with a scope, such as
fix(quote): handle missing extended market fields.
The canonical skill lives at skills/yahoo-finance2/SKILL.md. To install it
through the Skills CLI and make it visible to skills.sh telemetry, use:
npx skills add gadicc/yahoo-finance2
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Take gadicc/yahoo-finance2 from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npx.
Without those the skill loads but fails at the first command.