Skip to content

Yahoo Finance

Try it in your browser

Yahoo Finance price history, quotes and symbol search

Connector software
Free and open source
Service credentials
Not needed
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/yfinance/index.md to help me query Yahoo Finance with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Try it in your browser Haybarn WASM Β· nothing to install

Try it in your browser

Run a live query with no installation or account. Your browser connects to the public Yahoo Finance demo hosted by Query Farm: live quotes for three tickers, newest trade first.

Example output Β· captured
Connector release
v0.7.0
Engine
2.0.1
VGI protocol
3.4.0
yfinance.sql
ATTACH 'yfinance' AS yfinance (TYPE vgi, LOCATION 'https://yfinance.vgi.query.farm');

SELECT symbol, regular_market_price AS price, regular_market_time AS as_of
FROM yfinance.main.quote('aapl,msft,goog')
ORDER BY as_of DESC;
Result
symbol price as_of
AAPL 354 2026-11-30T21:00:01+00:00
MSFT 487.2 2026-11-30T21:00:01+00:00
GOOG 291.78 2026-11-30T21:00:01+00:00

Runs in your browser and attaches the public demo Query.Farm hosts on Cloudflare (yfinance.vgi.query.farm). The first run downloads the engine; the SQL shell keeps the worker attached so you can write your own queries.

Quick start

Choose where to run Yahoo Finance, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach the release directly

Downloads the latest release for your platform and caches it locally.

ATTACH 'yfinance' AS yfinance (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-yfinance'
);

3. Run a query

query.sql
SELECT symbol, regular_market_price AS price, regular_market_time AS as_of
FROM yfinance.main.quote('aapl,msft,goog')
ORDER BY as_of DESC
More example queries β†’
Technical details
Verified connector release
v0.7.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach the release directly

Uses the verified release each time you attach the connector.

ATTACH 'yfinance' AS yfinance (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/[email protected]'
);

Overview

Yahoo Finance market data as DuckDB tables: history (OHLCV), quote (snapshot), search (symbol lookup) β€” vgi-yfinance

Catalog

Everything yfinance exposes once attached β€” read straight from the worker's released build.

yfinance 1 schema
main 1 view Β· 3 functions

Yahoo Finance market data: price history, current quotes, and symbol search.

Schema examples (9)
Examples (9)

Last month of daily candles for Apple, oldest first

SELECT timestamp, open, high, low, close, volume
FROM yfinance.main.history('AAPL')
ORDER BY timestamp;

Current price for several megacaps at once

SELECT symbol, regular_market_price
FROM yfinance.main.quote('AAPL,MSFT,GOOG')
ORDER BY symbol;

Find a ticker by company name, best matches first

SELECT symbol, long_name
FROM yfinance.main.search('vanguard')
ORDER BY score DESC, symbol;

Rank companies by three-month total return starting from their names: search resolves each name to its top-scoring EQUITY ticker, then history supplies dividend-adjusted closes (adjclose) to compute the return

WITH pick AS (SELECT c.name, s.symbol FROM (VALUES ('apple'), ('costco'), ('walmart')) c(name), LATERAL yfinance.main.search(c.name, count := 5) s WHERE s.quote_type = 'EQUITY' QUALIFY row_number() OVER (PARTITION BY c.name ORDER BY s.score DESC) = 1) SELECT p.name, p.symbol, round(100 * (arg_max(h.adjclose, h.timestamp) / arg_min(h.adjclose, h.timestamp) - 1), 2) AS total_return_3mo_pct
FROM pick p,
     LATERAL yfinance.main.history(p.symbol, range := '3mo') h
GROUP BY p.name, p.symbol
ORDER BY total_return_3mo_pct DESC, p.name;
5 more examples

Look up the live price of companies you only know by name: search resolves each name to its top-scoring EQUITY ticker, then quote returns that listing's exchange, currency, price and change versus the previous close

WITH pick AS (SELECT c.name, s.symbol FROM (VALUES ('netflix'), ('tesla'), ('toyota')) c(name), LATERAL yfinance.main.search(c.name, count := 5) s WHERE s.quote_type = 'EQUITY' QUALIFY row_number() OVER (PARTITION BY c.name ORDER BY s.score DESC) = 1) SELECT p.name, q.symbol, q.long_name, q.exchange, q.currency, q.regular_market_price, round(q.regular_market_change_percent, 2) AS change_pct
FROM pick p,
     LATERAL yfinance.main.quote(p.symbol) q
ORDER BY p.name;

Watchlist momentum check: compare each ticker's live quote price with the average of its daily closes over the past month from history, to see which names trade above or below their recent level

WITH q AS (SELECT symbol, regular_market_price FROM yfinance.main.quote('AAPL,MSFT,GOOG')), m AS (SELECT q.symbol, avg(h.close) AS avg_close_1mo FROM q, LATERAL yfinance.main.history(q.symbol, range := '1mo') h GROUP BY q.symbol) SELECT q.symbol, q.regular_market_price, round(m.avg_close_1mo, 2) AS avg_close_1mo, round(100 * (q.regular_market_price / m.avg_close_1mo - 1), 2) AS pct_vs_1mo_avg
FROM q
JOIN m USING (symbol)
ORDER BY pct_vs_1mo_avg DESC, q.symbol;

Price foreign listings in US dollars: quote each listing, then quote the FX pair named by its own currency column (EUR=X is euros per dollar; JPY=X, which Yahoo echoes back as USDJPY=X, is yen per dollar) and divide. London listings quote in pence (currency GBp) and would also need dividing by 100, so none is included

SELECT l.symbol, l.currency, l.regular_market_price AS local_price,
  fx.symbol AS fx_pair, fx.regular_market_price AS units_per_usd,
  round(l.regular_market_price / fx.regular_market_price, 2) AS price_usd
FROM yfinance.main.quote('ASML.AS,MC.PA,7203.T,NESN.SW') l,
     LATERAL yfinance.main.quote(l.currency || '=X') fx
ORDER BY price_usd DESC, l.symbol;

Where does each asset class sit in its 52-week range? Quote every symbol_reference ticker (equity, ETF, index, crypto, FX) and show its position in the range (0 = at the low, 100 = at the high) and its percent distance from the 52-week high

SELECT r.asset_type, r.symbol, q.regular_market_price,
  round(100 * (q.regular_market_price - q.fifty_two_week_low) / nullif(q.fifty_two_week_high - q.fifty_two_week_low, 0), 1) AS pct_of_52w_range,
  round(100 * (q.regular_market_price / q.fifty_two_week_high - 1), 1) AS pct_from_52w_high
FROM yfinance.main.symbol_reference r,
     LATERAL yfinance.main.quote(r.symbol) q
ORDER BY r.asset_type, pct_of_52w_range DESC, r.symbol;

How closely does each registry equity and ETF track the S&P 500? Pull six months of daily history for the symbol_reference equities, ETFs and the ^GSPC index, turn dividend-adjusted closes into daily returns, and correlate each ticker's returns with the index's on matching trading days

WITH px AS (SELECT r.symbol, h.timestamp, h.adjclose / lag(h.adjclose) OVER (PARTITION BY r.symbol ORDER BY h.timestamp) - 1 AS ret FROM yfinance.main.symbol_reference r, LATERAL yfinance.main.history(r.symbol, range := '6mo') h WHERE r.asset_type IN ('EQUITY', 'ETF', 'INDEX')) SELECT a.symbol, round(corr(a.ret, b.ret), 3) AS corr_with_sp500
FROM px a
JOIN px b ON a.timestamp = b.timestamp AND b.symbol = '^GSPC'
WHERE a.symbol <> '^GSPC'
GROUP BY a.symbol
ORDER BY corr_with_sp500 DESC, a.symbol;
Views
symbol_reference 4 examples5 cols

A curated, credential-free registry of well-known tickers that demonstrates each Yahoo symbol convention accepted by history, quote, and search. Browsable without any network call.

Columns
symbol VARCHAR
The ticker exactly as Yahoo lists it β€” feed this into history, quote, or search.
name VARCHAR
The human-readable instrument name.
asset_type VARCHAR
The instrument class: EQUITY, ETF, INDEX, CRYPTOCURRENCY, or CURRENCY.
exchange VARCHAR
The listing exchange (or pricing source) code.
notes VARCHAR
Which symbol-format convention this row illustrates.
Examples (4)

List the reference tickers for a given asset type

SELECT symbol, name, exchange
FROM yfinance.main.symbol_reference
WHERE asset_type = 'ETF'
ORDER BY symbol;

Count the reference symbols grouped by asset type

SELECT asset_type, count(*) AS n
FROM yfinance.main.symbol_reference
GROUP BY asset_type
ORDER BY n DESC, asset_type;

Where does each asset class sit in its 52-week range? Quote every symbol_reference ticker (equity, ETF, index, crypto, FX) and show its position in the range (0 = at the low, 100 = at the high) and its percent distance from the 52-week high

SELECT r.asset_type, r.symbol, q.regular_market_price,
  round(100 * (q.regular_market_price - q.fifty_two_week_low) / nullif(q.fifty_two_week_high - q.fifty_two_week_low, 0), 1) AS pct_of_52w_range,
  round(100 * (q.regular_market_price / q.fifty_two_week_high - 1), 1) AS pct_from_52w_high
FROM yfinance.main.symbol_reference r,
     LATERAL yfinance.main.quote(r.symbol) q
ORDER BY r.asset_type, pct_of_52w_range DESC, r.symbol;
1 more example

How closely does each registry equity and ETF track the S&P 500? Pull six months of daily history for the symbol_reference equities, ETFs and the ^GSPC index, turn dividend-adjusted closes into daily returns, and correlate each ticker's returns with the index's on matching trading days

WITH px AS (SELECT r.symbol, h.timestamp, h.adjclose / lag(h.adjclose) OVER (PARTITION BY r.symbol ORDER BY h.timestamp) - 1 AS ret FROM yfinance.main.symbol_reference r, LATERAL yfinance.main.history(r.symbol, range := '6mo') h WHERE r.asset_type IN ('EQUITY', 'ETF', 'INDEX')) SELECT a.symbol, round(corr(a.ret, b.ret), 3) AS corr_with_sp500
FROM px a
JOIN px b ON a.timestamp = b.timestamp AND b.symbol = '^GSPC'
WHERE a.symbol <> '^GSPC'
GROUP BY a.symbol
ORDER BY corr_with_sp500 DESC, a.symbol;
Link
Table functions
history (symbol VARCHAR, bar := VARCHAR, end_date := VARCHAR, prepost := BOOLEAN, range := VARCHAR, start_date := VARCHAR) 4 examples

Historical OHLCV candles for one symbol from Yahoo Finance (v8 chart API). Pick a named window (range := '1y') plus a candle width (bar := '1wk'), or an explicit start_date/end_date range. The symbol may be a column, so LATERAL history(t.sym) fetches candles for every row. Returns columns symbol, timestamp (UTC), open, high, low, close, adjclose, and volume.

Positional arguments
symbol VARCHAR
The ticker to fetch, written the way Yahoo lists it β€” equities, class shares, crypto pairs, and caret-prefixed indices are all accepted. Passed as the first positional argument (not symbol := ...); a literal or a column (LATERAL history(t.sym)). A NULL or empty symbol yields no rows.
Named arguments
bar := VARCHAR
Candle width β€” how much time each bar spans. Intraday widths only work on recent ranges. Default '1d'. Β· default "1d"
end_date := VARCHAR
Exclusive end date 'YYYY-MM-DD', after start_date. Defaults to now when start_date is set; setting it without start_date fails the bind. Β· default ""
prepost := BOOLEAN
Include pre-market and post-market candles. Default false. Β· default false
range := VARCHAR
Named lookback window over which to fetch candles. Ignored when start_date is set. Default '1mo'. Β· default "1mo"
start_date := VARCHAR
Inclusive start date 'YYYY-MM-DD'. When set, [start_date, end_date) overrides range. Empty = use range. A malformed date fails the bind. Β· default ""
Returns columns
symbol VARCHAR
The ticker, echoed from Yahoo's chart metadata.
timestamp TIMESTAMP WITH TIME ZONE
Candle open time, in UTC.
open DOUBLE
Opening price for the candle.
high DOUBLE
Highest traded price during the candle.
low DOUBLE
Lowest traded price during the candle.
close DOUBLE
Closing price for the candle.
adjclose DOUBLE
Split/dividend-adjusted close; falls back to close when Yahoo omits it.
volume BIGINT
Shares or contracts traded during the candle.
Examples (4)

The five most recent daily closes and volumes for Apple

SELECT timestamp, close, volume
FROM yfinance.main.history('AAPL', range := '1mo')
ORDER BY timestamp DESC
LIMIT 5;

One year of weekly closes for Microsoft

SELECT timestamp, close, volume
FROM yfinance.main.history('MSFT', range := '1y', bar := '1wk')
ORDER BY timestamp;

The 52-week high and low for SPY, aggregated from daily candles

SELECT max(high) AS high_52w, min(low) AS low_52w
FROM yfinance.main.history('SPY', range := '1y');
1 more example

Highest close over the last month for every ticker in a table, via LATERAL

SELECT w.sym, max(h.close) AS high_close
FROM (VALUES ('AAPL'), ('MSFT')) w(sym),
     LATERAL yfinance.main.history(w.sym, range := '1mo') h
GROUP BY w.sym
ORDER BY w.sym;
Link
quote (symbols VARCHAR) 5 examples

Current market snapshot for one or more symbols (keyless, from the chart meta plane): price, change vs previous close, day range, 52-week range, volume. Pass a comma-separated symbol list, or a column (LATERAL quote(t.sym)) for one quote per row.

Arguments
symbols VARCHAR
One ticker or a comma/space-separated list (e.g. 'AAPL' or 'AAPL,MSFT,GOOG'). One request is made per distinct symbol; an unresolvable ticker is dropped rather than failing the batch. Passed as the first positional argument (not symbols := ...); a literal or a column (LATERAL quote(t.sym)). A NULL or empty value yields no rows.
Returns columns
symbol VARCHAR
The ticker the row describes.
short_name VARCHAR
Short display name (e.g. 'Apple Inc.').
long_name VARCHAR
Full/long display name, when Yahoo provides one.
currency VARCHAR
Currency the price is quoted in (e.g. 'USD'); London listings use 'GBp' (pence).
exchange VARCHAR
Listing exchange name (e.g. 'NasdaqGS', 'XETRA').
quote_type VARCHAR
Instrument type: EQUITY, ETF, INDEX, CRYPTOCURRENCY, …
regular_market_price DOUBLE
Last regular-session price.
regular_market_change DOUBLE
Absolute price change versus the previous close.
regular_market_change_percent DOUBLE
Percentage price change versus the previous close.
regular_market_volume BIGINT
Regular-session traded volume.
regular_market_day_high DOUBLE
Highest price in the current session.
regular_market_day_low DOUBLE
Lowest price in the current session.
regular_market_previous_close DOUBLE
Prior regular-session closing price.
fifty_two_week_high DOUBLE
Highest price over the trailing 52 weeks.
fifty_two_week_low DOUBLE
Lowest price over the trailing 52 weeks.
regular_market_time TIMESTAMP WITH TIME ZONE
Time of the last regular-session price, in UTC.
Examples (5)

Snapshot quote for Apple

SELECT symbol, regular_market_price, regular_market_change_percent
FROM yfinance.main.quote('AAPL');

Latest price for several symbols at once

SELECT symbol, regular_market_price
FROM yfinance.main.quote('AAPL,MSFT,GOOG')
ORDER BY symbol;

Latest price for every ticker in a table, via LATERAL

SELECT w.sym, q.regular_market_price
FROM (VALUES ('AAPL'), ('MSFT')) w(sym),
     LATERAL yfinance.main.quote(w.sym) q
ORDER BY w.sym;
2 more examples

Watchlist momentum check: compare each ticker's live quote price with the average of its daily closes over the past month from history, to see which names trade above or below their recent level

WITH q AS (SELECT symbol, regular_market_price FROM yfinance.main.quote('AAPL,MSFT,GOOG')), m AS (SELECT q.symbol, avg(h.close) AS avg_close_1mo FROM q, LATERAL yfinance.main.history(q.symbol, range := '1mo') h GROUP BY q.symbol) SELECT q.symbol, q.regular_market_price, round(m.avg_close_1mo, 2) AS avg_close_1mo, round(100 * (q.regular_market_price / m.avg_close_1mo - 1), 2) AS pct_vs_1mo_avg
FROM q
JOIN m USING (symbol)
ORDER BY pct_vs_1mo_avg DESC, q.symbol;

Price foreign listings in US dollars: quote each listing, then quote the FX pair named by its own currency column (EUR=X is euros per dollar; JPY=X, which Yahoo echoes back as USDJPY=X, is yen per dollar) and divide. London listings quote in pence (currency GBp) and would also need dividing by 100, so none is included

SELECT l.symbol, l.currency, l.regular_market_price AS local_price,
  fx.symbol AS fx_pair, fx.regular_market_price AS units_per_usd,
  round(l.regular_market_price / fx.regular_market_price, 2) AS price_usd
FROM yfinance.main.quote('ASML.AS,MC.PA,7203.T,NESN.SW') l,
     LATERAL yfinance.main.quote(l.currency || '=X') fx
ORDER BY price_usd DESC, l.symbol;
Link

Try these queries

search_symbol β€” Resolve a company name to candidate tickers

SELECT symbol, short_name
FROM yfinance.main.search('apple')
ORDER BY score DESC, symbol
LIMIT 3;

Uses search

recent_history β€” Fetch the last few daily candles for a ticker

SELECT timestamp, close
FROM yfinance.main.history('AAPL', range := '5d')
ORDER BY timestamp;

Uses history

Last month of daily candles for Apple, oldest first

SELECT timestamp, open, high, low, close, volume
FROM yfinance.main.history('AAPL')
ORDER BY timestamp

Uses history

Current price for several megacaps at once

SELECT symbol, regular_market_price
FROM yfinance.main.quote('AAPL,MSFT,GOOG')
ORDER BY symbol

Uses quote

Find a ticker by company name, best matches first

SELECT symbol, long_name
FROM yfinance.main.search('vanguard')
ORDER BY score DESC, symbol

Uses search

Where does each asset class sit in its 52-week range? Quote every symbol_reference ticker (equity, ETF, index, crypto, FX) and show its position in the range (0 = at the low, 100 = at the high) and its percent distance from the 52-week high

SELECT r.asset_type, r.symbol, q.regular_market_price,
  round(100 * (q.regular_market_price - q.fifty_two_week_low) / nullif(q.fifty_two_week_high - q.fifty_two_week_low, 0), 1) AS pct_of_52w_range,
  round(100 * (q.regular_market_price / q.fifty_two_week_high - 1), 1) AS pct_from_52w_high
FROM yfinance.main.symbol_reference r,
     LATERAL yfinance.main.quote(r.symbol) q
ORDER BY r.asset_type, pct_of_52w_range DESC, r.symbol

Uses symbol_referencequote

16 more examples in the Catalog, each listed under the table or function it uses.

Yahoo Finance is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.