yahoo_finance 0.4.1
yahoo_finance: ^0.4.1 copied to clipboard
A Yahoo Finance client for Flutter — the Dart equivalent of Python's yfinance. Quotes, history, financials, holders, estimates, ESG, search, funds, calendars.
yahoo_finance #
A Yahoo Finance client for Flutter — the Dart equivalent of Python's yfinance. Same API shape, same endpoints, same battle-tested workarounds for Yahoo's bot protection.
import 'package:yahoo_finance/yahoo_finance.dart';
final ticker = Ticker('AAPL');
final quote = await ticker.quote();
print(quote.regularMarketPrice);
final bars = await ticker.history(
period: Period.threeMonths,
interval: Interval.oneDay,
);
final info = await ticker.info();
print('${info.longName} — analyst target ${info.targetMeanPrice}');
final income = await ticker.incomeStatement();
print('Revenue: ${income.latest('TotalRevenue')}');
// Market-wide calendars (not symbol-scoped)
final earnings = await Calendars().earningsCalendar(limit: 50);
Features #
| Area | API |
|---|---|
| Snapshot quote | quote() |
| Company info, key stats, analyst targets | info() · fastInfo() |
| Historical OHLCV bars | history(period, interval, start, end) |
| Dividends, splits, capital gains | actions() |
| Financial statements (annual/quarterly/TTM) | incomeStatement() · balanceSheet() · cashFlow() |
| Options expirations & chains | options() · optionChain() |
| News | news() |
| Earnings & dividend dates | calendar() |
| Analyst recommendations & rating changes | recommendations() · upgradesDowngrades() |
| Holders & insiders | majorHolders() · institutionalHolders() · mutualFundHolders() · insiderTransactions() · insiderRosterHolders() · insiderPurchases() |
| Analyst estimates, price targets & ESG | earningsEstimate() · revenueEstimate() · epsTrend() · epsRevisions() · growthEstimates() · earningsHistory() · analystPriceTargets() · sustainability() |
| Symbol & news search | Search().search(query) |
| SEC filings | secFilings() |
| Shares outstanding history | sharesFull() |
| Valuation measures over time | valuationMeasures() |
| ETF/mutual-fund data | fundsData() |
| Earnings dates with EPS surprise | earningsDates() ⚠️ |
| Ticker → ISIN lookup | isin() ⚠️ |
| Multi-symbol batch quotes | Tickers.parse('aapl msft').quotes() |
| Market-wide calendars (earnings, IPOs, economic events, splits) | Calendars().earningsCalendar() etc. |
| Sector / industry lookups | Sector('technology').fetch() · Industry('semiconductors').fetch() |
| Market open/close status & index summary | Market(MarketRegion.us).status() · .summary() |
| ISIN → ticker lookup | Lookup('US0378331005').ticker() |
Feature-parity with yfinance's Ticker, Sector, Industry, Market,
Search and Lookup APIs is complete. ⚠️ marks the
two features that scrape HTML/third-party endpoints (Yahoo deprecated
the JSON APIs behind them) — they're as fragile here as they are in
yfinance: earningsDates parses Yahoo's earnings-calendar page,
isin() queries markets.businessinsider.com. ISIN → ticker works via
Lookup('…').ticker().
Why it needs its own HTTP stack #
Yahoo rate-limits and blocks plain HTTP clients (401/429) and
fingerprints TLS handshakes. Like yfinance (which uses curl_cffi's
browser impersonation), this package routes traffic through real
browser network stacks:
- iOS / macOS → URLSession (
cupertino_http, Safari TLS fingerprint) - Android → Cronet (
cronet_http, Chrome TLS fingerprint) - Linux / Windows →
dart:iofallback with realistic browser headers
On top of that, a shared YahooHttpClient manages the cookie + crumb
session, retries once on auth failures, and rotates the session
periodically. Disable impersonation with the
YAHOOFIN_DISABLE_IMPERSONATION env var (mirrors yfinance's
YF_DISABLE_CURL_CFFI).
Flutter Web is not supported — Yahoo blocks cross-origin browser requests (CORS).
Install #
flutter pub add yahoo_finance
Example app #
example/ is a runnable feature tester: pick a symbol and
tap through every API (history with period/interval pickers, financials
with statement/frequency pickers, options chains, market calendars…).
cd example
flutter run -d macos # or an iOS/Android device
Development #
flutter pub get # root AND example/
dart analyze # covers both
flutter test # package tests (offline, fixture-based)
cd example && flutter test
Tests never hit the network — they parse recorded Yahoo responses from
test/fixtures/.
Disclaimer #
Unofficial library, not affiliated with Yahoo. Data is provided by Yahoo Finance for personal, non-commercial use — review Yahoo's terms of service before using it in a product.