
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
yahoo-finance2
Advanced tools
Community API for Yahoo-Finance.
Copyright (c) 2021 by Gadi Cohen and Pilwon Huh. MIT licensed.
You are reading the latest Development docs. For the v2 docs, click here. The dev docs are in the process of being updated for the upcoming v3 - for more info see UPGRADING.
Live Demo on CodeSandbox (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 for the
git commands to update your local installation.
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.
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 }'
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,
fundamentalsTimeSeries,
historical,
insights,
options,
quote,
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,
screener,
search,
trendingSymbols.
Extras:
quoteCombine.
See the Explanatatory Documentation and Full API Documentation.
Particularly, make sure to read the notes there on 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).
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.
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.
📈 Ghostfolio - mature, open-source Wealth Management & longtime supporter.
🛠️ StockQuotes.MCP - AI MCP Server to fetch real time financial data
Want your project listed? Open a PR to add it here.
Pull Requests welcome! Read CONTRIBUTING.md and join our list of heroes:
Massive thanks to @pilwon for the original node-yahoo-finance and for all our prior collaborations on this and other projects 🙏
Special mention goes out to pudgereyem and PythonCreator27 who made significant contributions in the very early days of this project.
FAQs
JS API for Yahoo Finance
The npm package yahoo-finance2 receives a total of 111,594 weekly downloads. As such, yahoo-finance2 popularity was classified as popular.
We found that yahoo-finance2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.