yahoo-finance2
Unofficial API for Yahoo Finance with CLI, MCP and Agent Skill
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Check it deeper on your machine
It has changed since its scan on 11 Nov 2026.
As a Claude Code plugin, install it and then ask Claude Code:
/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/gadicc/yahoo-finance2 with scanskillsafety
Or from a terminal, clone it and run it:
git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/gadicc/yahoo-finance2'
It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.
Badge for your README
Markdown
[](/listings/gadicc--yahoo-finance2)HTML
<a href="/listings/gadicc--yahoo-finance2"><img src="/api/listings/gadicc--yahoo-finance2/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
**CLI** (Command line interface)
$ npx yahoo-finance2 --help
$ npx yahoo-finance2 search AMZN
$ npx yahoo-finance2 quoteSummary GOOGL
$ npx yahoo-finance2 quoteSummary NVDA '{"modules":["assetProfile", "secFilings"]}'
# or install it
$ npm install -g yahoo-finance2
$ yahoo-finance search MSFT '{ "someOption": true }'See the [CLI docs](./docs/cli.md) for stdout/stderr behavior and exit codes.
See the [MCP docs](./docs/mcp.md) to expose yahoo-finance2 tools to MCP clients such as Codex, Claude, Cursor, and VS Code.
**Importing**
// or: const YahooFinance = require("yahoo-finance2").default;
import YahooFinance from "yahoo-finance2";
const yahooFinance = new YahooFinance();
const results = await yahooFinance.search("Apple");
const quote = await yahooFinance.quote('AAPL');
const { regularMarketPrice as price, currency } = quote;Available modules: [`chart`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/chart), [`fundamentalsTimeSeries`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/fundamentalsTimeSeries), [`historical`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/historical), [`insights`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/insights), [`options`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/options), [`quote`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/quote), [`quoteSummary`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/quoteSummary) (submodules: assetProfile, balanceSheetHistory, balanceSheetHistoryQuarterly, calendarEvents, cashflowStatementHistory, cashflowStatementHistoryQuarterly, defaultKeyStatistics, earnings, earningsHistory, earningsTrend, financialData, fundOwnership, fundPerformance, fundProfile, incomeStatementHistory, incomeStatementHistoryQuarterly, indexTrend, industryTrend, insiderHolders, insiderTransactions, institutionOwnership, majorDirectHolders, majorHoldersBreakdown, netSharePurchaseActivity, price, quoteType, recommendationTrend, secFilings, sectorTrend, summaryDetail, summaryProfile, symbol, topHoldings, upgradeDowngradeHistory), [`recommendationsBySymbol`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/recommendationsBySymbol), [`screener`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/screener), [`search`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/search), [`trendingSymbols`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/trendingSymbols).
Extras: [`quoteCombine`](https://jsr.io/@gadicc/yahoo-finance2/doc/other/quoteCombine).
See the [Explanatatory Documentation](./docs/README.md) and [Full API Documentation](https://jsr.io/@gadicc/yahoo-finance2/doc/~/default).
Particularly, make sure to read the notes there on [ERROR HANDLING](./docs/README.md#error-handling). Be aware that if a stock gets delisted, Yahoo removes all related data, including historical (and chart) data from periods _before_ the delisting occurred (i.e. queries that worked before will start failing, and there is no way to retrieve this data again).
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
README.md · README · 181 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.
- # yahoo-finance2
- Unofficial API for Yahoo Finance with CLI, MCP and Agent Skill.
- Copyright (c) 2021 by Gadi Cohen and Pilwon Huh. [MIT licensed](./LICENSE).
- [](https://www.npmjs.com/package/yahoo-finance2)
- [](https://github.com/gadicc/yahoo-finance2/actions/workflows/tests.yaml)
- [](https://codecov.io/gh/gadicc/yahoo-finance2)
- [](https://github.com/semantic-release/semantic-release)
- [](http://www.typescriptlang.org/)
- [](./LICENSE)
- You are reading the docs for **v4**, the current major version published as
- `yahoo-finance2@latest`. For the older **v3 docs**, click
- [here](https://github.com/gadicc/yahoo-finance2/tree/3.x). Upgrading? See
- [UPGRADING](./docs/UPGRADING.md).
- [Live Demo on CodeSandbox](https://codesandbox.io/p/devbox/gxvftx) (Updated
- 2024-06-17; NextJS with both RSC and Hook-Relay examples)
- NB: Recently **the repo was renamed** from `node-yahoo-finance2` to
- `yahoo-finance2`, and the following **branches were named**, `master` to `main`,
- and `devel` to `dev`. See [UPGRADING.md#dev](./docs/UPGRADING.md#dev) for the
- git commands to update your local installation.
- ## Supported runtimes:
- - **Bun**: v1+.
- - **Cloudflare**: Modern releases, tested in CI via Workers Vitest under
- `nodejs_compat`.
- - **Deno**: v2+.
- - **Node**: v22+; v22 until 2027-04-30, v24 until 2028-04-30. Supported releases
- follow the [Node.js release schedule](https://endoflife.date/nodejs).
- ## Unofficial API
- This project is neither created nor endorsed by Yahoo Inc. Yahoo does not
- provide any official API to developers, nor makes any guarantees regarding
- service availability or API consistency. In practice however, the open source
- community has kept this project (and it's predecessor) working well since 2013.
- Nevertheless, we make no guarantees and you use this package at your own risk.
- The developers (and obviously Yahoo) cannot be held responsible for any losses
- you may incur as a result of using this service. Use of this package is
- considered acknowledgement and acceptance of these terms and of its license.
- ## Quickstart
- **CLI** (Command line interface)
- ```bash
- $ npx yahoo-finance2 --help
- $ npx yahoo-finance2 search AMZN
- $ npx yahoo-finance2 quoteSummary GOOGL
- $ npx yahoo-finance2 quoteSummary NVDA '{"modules":["assetProfile", "secFilings"]}'
- # or install it
- $ npm install -g yahoo-finance2
- $ yahoo-finance search MSFT '{ "someOption": true }'
- ```
- See the [CLI docs](./docs/cli.md) for stdout/stderr behavior and exit codes.
- See the [MCP docs](./docs/mcp.md) to expose yahoo-finance2 tools to MCP clients
- such as Codex, Claude, Cursor, and VS Code.
- **Importing**
- ```ts
- // or: const YahooFinance = require("yahoo-finance2").default;
- import YahooFinance from "yahoo-finance2";
- const yahooFinance = new YahooFinance();
- const results = await yahooFinance.search("Apple");
- const quote = await yahooFinance.quote('AAPL');
- const { regularMarketPrice as price, currency } = quote;
- ```
- Available modules:
- [`chart`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/chart),
- [`fundamentalsTimeSeries`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/fundamentalsTimeSeries),
- [`historical`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/historical),
- [`insights`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/insights),
- [`options`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/options),
- [`quote`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/quote),
- [`quoteSummary`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/quoteSummary)
- (submodules: assetProfile, balanceSheetHistory, balanceSheetHistoryQuarterly,
- calendarEvents, cashflowStatementHistory, cashflowStatementHistoryQuarterly,
- defaultKeyStatistics, earnings, earningsHistory, earningsTrend, financialData,
- fundOwnership, fundPerformance, fundProfile, incomeStatementHistory,
- incomeStatementHistoryQuarterly, indexTrend, industryTrend, insiderHolders,
- insiderTransactions, institutionOwnership, majorDirectHolders,
- majorHoldersBreakdown, netSharePurchaseActivity, price, quoteType,
- recommendationTrend, secFilings, sectorTrend, summaryDetail, summaryProfile,
- symbol, topHoldings, upgradeDowngradeHistory),
- [`recommendationsBySymbol`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/recommendationsBySymbol),
- [`screener`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/screener),
- [`search`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/search),
- [`trendingSymbols`](https://jsr.io/@gadicc/yahoo-finance2/doc/modules/trendingSymbols).
- Extras:
- [`quoteCombine`](https://jsr.io/@gadicc/yahoo-finance2/doc/other/quoteCombine).
- See the [Explanatatory Documentation](./docs/README.md) and
- [Full API Documentation](https://jsr.io/@gadicc/yahoo-finance2/doc/~/default).
- Particularly, make sure to read the notes there on
- [ERROR HANDLING](./docs/README.md#error-handling). Be aware that if a stock gets
- delisted, Yahoo removes all related data, including historical (and chart) data
- from periods _before_ the delisting occurred (i.e. queries that worked before
- will start failing, and there is no way to retrieve this data again).
- ## Agent Skill
- This repo ships an Agent Skills-compatible skill at
- [`skills/yahoo-finance2`](./skills/yahoo-finance2/SKILL.md). Install it for
- compatible agents with:
- ```bash
- npx skills add gadicc/yahoo-finance2
- ```
- The npm package also includes the skill under `skills/yahoo-finance2` for tools
- that sync skills from installed packages.
- ## (Optional) TypeScript Love
- Working with `yahoo-finance2` is a joy if you're using TypeScript (but you don't
- have to), with type checking and auto completion:
- 
- Try it yourself on our
- [Live CodeSandbox](https://codesandbox.io/s/yahoo-finance2-312x2?file=/src/index.ts).
- ## Using in the Browser
- It's not possible to run this in the browser, due to CORS and cookie issues. You
- should execute calls on a server or in a serverless or edge function, and pass
- this data to the browser as required. See the CodeSandbox above for examples.
- Use React Server Components, trpc, or other strategies to maintain types.
- ## Related Projects
- - 📈 [Ghostfolio](https://ghostfol.io/) - mature, open-source Wealth Management
- & longtime supporter.
- - 🛠️ [StockQuotes.MCP](https://github.com/lionelschiepers/StockQuotes.MCP) - AI
- MCP Server to fetch real time financial data.
- - ⚡ [live-quotes](https://github.com/mnsrulz/live-quotes) - Demo to showcase
- running yahoo-finance2 in cloudflare workers with live quotes.
- - 🦊 [Foliofox](https://www.foliofox.com/) - Open-source portfolio tracker with
- an AI financial advisor.
- Want your project listed? Open a PR to add it here.
- ## Contributing
- Pull Requests welcome! Read [CONTRIBUTING.md](./CONTRIBUTING.md) and join our
- list of heroes:
- <!--
- 
- -->
- 
- ## Credits
- - Massive thanks to [@pilwon](https://github.com/pilwon) for the original
- [node-yahoo-finance](https://www.npmjs.com/package/yahoo-finance) and for all
- our prior collaborations on this and other projects 🙏
- - Special mention goes out to [pudgereyem](https://github.com/pudgereyem) and
- [PythonCreator27](https://github.com/PythonCreator27) who made significant
- contributions in the very early days of this project.
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.