Skip to content

SPDR ETFs

State Street SPDR ETF facts, current holdings and daily NAV history from the public SSGA feed

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/etf-spdr/index.md to help me query SPDR ETFs 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.

largest_etfs

Example output · captured
Connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
SELECT ticker, fund_name, net_assets
FROM spdr.main.products
ORDER BY net_assets DESC
LIMIT 5;
Result
ticker fund_name net_assets
SPY State Street® SPDR® S&P 500® ETF Trust 776,694,300,000
SPYM State Street® SPDR® Portfolio S&P 500® ETF 181,975,750,000
GLD SPDR® Gold Shares 120,072,650,000
XLK State Street® Technology Select Sector SPDR® ETF 108,672,780,000
XLF State Street® Financial Select Sector SPDR® ETF 53,687,160,000

Quick start

Choose where to run SPDR ETFs, 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 'spdr' AS spdr (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-etf-spdr'
);

3. Run a query

query.sql
SELECT ticker, fund_name, net_assets
FROM spdr.main.products
ORDER BY net_assets DESC
LIMIT 5;
More example queries →
Technical details
Verified connector release
v0.5.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 'spdr' AS spdr (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/[email protected]'
);

Overview

SPDR / State Street (SSGA) US ETF data as DuckDB tables: products (catalog) & holdings (ticker-partitioned) tables, plus nav_history — vgi-etf-spdr

Catalog

Everything spdr exposes once attached — read straight from the worker's released build.

spdr 1 schema
main 2 tables · 1 function

SPDR fund data: ETF catalog, detailed current holdings, and per-fund NAV history.

Schema examples (6)
Examples (6)

Ten largest SPDR ETFs by net assets

SELECT ticker, fund_name, net_assets
FROM spdr.main.products
ORDER BY net_assets DESC
LIMIT 10;

Top holdings of SPY

SELECT name, ticker, weight_percent
FROM spdr.main.holdings
WHERE fund_ticker = 'SPY'
ORDER BY weight_percent DESC
LIMIT 10;

Recent daily NAV history for SPY

SELECT as_of_date, nav
FROM spdr.main.nav_history('SPY', start_date := DATE '2026-01-01')
ORDER BY as_of_date DESC;

Largest single holding of each of the five biggest SPDR equity ETFs, with its weight and approximate dollar size (the catalog picks the funds; holding_rank = 1 is applied inside the holdings scan, which still reads every fund's file because the join key is not pushed down)

WITH biggest AS (SELECT ticker, net_assets FROM spdr.main.products WHERE asset_class = 'Equity' ORDER BY net_assets DESC LIMIT 5) SELECT b.ticker AS fund, h.name AS top_holding, h.weight_percent, round(b.net_assets * h.weight_percent / 100 / 1e9, 1) AS position_usd_billions
FROM biggest b
JOIN spdr.main.holdings h ON h.fund_ticker = b.ticker
WHERE h.holding_rank = 1
ORDER BY b.net_assets DESC;
2 more examples

Approximate dollar size of SPY's ten largest positions: each holding's weight applied to the fund's net assets from the products catalog (USD billions)

SELECT h.holding_rank, h.name, h.ticker, h.weight_percent,
  round(p.net_assets * h.weight_percent / 100 / 1e9, 1) AS position_usd_billions
FROM spdr.main.holdings h
JOIN spdr.main.products p ON p.ticker = h.fund_ticker
WHERE h.fund_ticker = 'SPY'
ORDER BY h.holding_rank
LIMIT 10;

SPY's price-only NAV change from the prior year-end NAV (base_nav_date) to SSGA's latest performance date, next to the YTD total return the catalog reports for that date (the gap reflects distributions, which a NAV-per-share series excludes)

WITH p AS (SELECT ticker, performance_as_of, ytd_return_percent FROM spdr.main.products WHERE ticker = 'SPY'), n AS (SELECT as_of_date, nav FROM spdr.main.nav_history('SPY', start_date := current_date - 500)) SELECT p.ticker, p.performance_as_of, max(n.as_of_date) FILTER (WHERE n.as_of_date < date_trunc('year', p.performance_as_of)) AS base_nav_date, round(100 * (arg_max(n.nav, n.as_of_date) / arg_max(n.nav, n.as_of_date) FILTER (WHERE n.as_of_date < date_trunc('year', p.performance_as_of)) - 1), 2) AS nav_change_percent, p.ytd_return_percent
FROM p
JOIN n ON n.as_of_date <= p.performance_as_of
GROUP BY p.ticker, p.performance_as_of, p.ytd_return_percent
ORDER BY p.ticker;
Tables
holdings 5 examples16 cols

Detailed current fund holdings, hive-partitioned by fund_ticker (filter WHERE fund_ticker = … for one fund, or scan unfiltered for all). SSGA publishes current holdings only (no historical dates).

Columns
fund_tickernot null VARCHAR
The fund's ticker (e.g. SPY) — the hive partition key; constant for every row of a fund. Filter on it to pick funds; omit to stream all.
holding_rank BIGINT
1-based position of this holding within the fund, ordered by descending weight as SSGA publishes it. With fund_ticker it uniquely identifies the row (the primary key); the largest holding is holding_rank = 1.
as_of_date DATE
Holdings as-of date (the published file's own date; current holdings only).
namenot null VARCHAR
Constituent / issue name.
ticker VARCHAR
Constituent ticker (equity funds; absent for bond/loan funds).
identifier VARCHAR
Constituent identifier — CUSIP for equities, ISIN for bonds.
sedol VARCHAR
Constituent SEDOL.
figi VARCHAR
Constituent FIGI (loan funds).
weight_percent DOUBLE
Percent of the fund, 0–100 (7.38 = 7.38%; weights sum to ~100).
sector VARCHAR
GICS-style sector (equity funds).
shares_held DOUBLE
Shares held (equity funds).
coupon_percent DOUBLE
Coupon rate, percent points (fixed income only).
par_value DOUBLE
Par value held (fixed income only).
market_value DOUBLE
Market value held, in the fund's currency (fixed income only).
maturity_date DATE
Maturity date (fixed income only).
local_currency VARCHAR
Local currency of the holding.
ConstraintsPRIMARY KEY (fund_ticker, holding_rank)
Examples (5)

Top 10 current holdings of SPY

SELECT name, ticker, weight_percent
FROM spdr.main.holdings
WHERE fund_ticker = 'SPY'
ORDER BY weight_percent DESC
LIMIT 10;

A bond fund fills coupon / maturity / par value

SELECT name, coupon_percent, maturity_date, par_value
FROM spdr.main.holdings
WHERE fund_ticker = 'BIL'
ORDER BY weight_percent DESC
LIMIT 10;

Two funds at once (partition fan-out)

SELECT fund_ticker, name, weight_percent
FROM spdr.main.holdings
WHERE fund_ticker IN ('SPY', 'BIL');
2 more examples

Approximate dollar size of SPY's ten largest positions: each holding's weight applied to the fund's net assets from the products catalog (USD billions)

SELECT h.holding_rank, h.name, h.ticker, h.weight_percent,
  round(p.net_assets * h.weight_percent / 100 / 1e9, 1) AS position_usd_billions
FROM spdr.main.holdings h
JOIN spdr.main.products p ON p.ticker = h.fund_ticker
WHERE h.fund_ticker = 'SPY'
ORDER BY h.holding_rank
LIMIT 10;
SELECT fund_ticker, count(*) AS positions,
  round(sum(weight_percent), 2) AS total_weight
FROM spdr.main.holdings
WHERE fund_ticker IN ('SPY', 'BIL')
GROUP BY fund_ticker
ORDER BY positions DESC;
Link
products 4 examples25 cols

Every SPDR / State Street US ETF with its key facts, one row per fund. Query directly (no arguments) and filter with WHERE; percent columns are in percent points.

Columns
ticker VARCHAR
Exchange ticker (e.g. SPY).
fund_name VARCHAR
Full fund name as marketed, e.g. 'State Street® SPDR® S&P 500® ETF Trust'.
asset_class VARCHAR
Asset class (Equity, Fixed Income, Alternative, Multi-Asset, Cash).
isin VARCHAR
ISIN identifier.
cusip VARCHAR
CUSIP identifier.
primary_exchange VARCHAR
Primary listing exchange.
domicile VARCHAR
Fund domicile (US).
inception_date DATE
Fund inception date.
as_of_date DATE
As-of date for the pricing fields (nav, close_price, aum).
nav DOUBLE
Net asset value per share, in USD.
net_assets DOUBLE
Total net assets (fund AUM) in USD.
close_price DOUBLE
Latest market closing price, per share in USD.
bid_ask_mid DOUBLE
Bid/ask midpoint price, per share in USD.
premium_discount_percent DOUBLE
Close vs NAV, percent points.
expense_ratio_percent DOUBLE
Gross expense ratio, percent points (0.09 = 0.09%).
performance_as_of DATE
As-of date for the return columns.
return_1m_percent DOUBLE
1-month cumulative return, percent points.
return_qtd_percent DOUBLE
Quarter-to-date cumulative return, percent points.
ytd_return_percent DOUBLE
Year-to-date cumulative return, percent points.
return_1y_percent DOUBLE
Annualized 1-year return, percent points.
return_3y_percent DOUBLE
Annualized 3-year return, percent points.
return_5y_percent DOUBLE
Annualized 5-year return, percent points.
return_10y_percent DOUBLE
Annualized 10-year return, percent points.
return_since_inception_percent DOUBLE
Annualized since-inception return, percent points.
product_page_url VARCHAR
Path to the fund page on ssga.com.
ConstraintsPRIMARY KEY (ticker)
Examples (4)

Ten largest SPDR ETFs by net assets

SELECT ticker, fund_name, net_assets
FROM spdr.main.products
ORDER BY net_assets DESC
LIMIT 10;

Cheapest equity ETFs by expense ratio

SELECT ticker, fund_name, expense_ratio_percent
FROM spdr.main.products
WHERE asset_class = 'Equity'
ORDER BY expense_ratio_percent
LIMIT 10;

Look up a single fund by ticker

SELECT ticker, fund_name, expense_ratio_percent
FROM spdr.main.products
WHERE ticker = 'SPY';
1 more example

Largest single holding of each of the five biggest SPDR equity ETFs, with its weight and approximate dollar size (the catalog picks the funds; holding_rank = 1 is applied inside the holdings scan, which still reads every fund's file because the join key is not pushed down)

WITH biggest AS (SELECT ticker, net_assets FROM spdr.main.products WHERE asset_class = 'Equity' ORDER BY net_assets DESC LIMIT 5) SELECT b.ticker AS fund, h.name AS top_holding, h.weight_percent, round(b.net_assets * h.weight_percent / 100 / 1e9, 1) AS position_usd_billions
FROM biggest b
JOIN spdr.main.holdings h ON h.fund_ticker = b.ticker
WHERE h.holding_rank = 1
ORDER BY b.net_assets DESC;
Link
Table functions
nav_history (fund VARCHAR, end_date := DATE, start_date := DATE) 3 examples

Daily net-asset-value history for a fund back to inception — one row per business day with NAV per share, shares outstanding, and total net assets. fund is a ticker; bound the range with start_date/end_date (recommended, as old funds return thousands of rows).

Positional arguments
fund VARCHAR
The fund to look up, given as an exchange ticker like 'SPY'. Required, first positional argument.
Named arguments
end_date := DATE
Optional inclusive upper bound on the day range — omit for no upper bound. Named end_date because END is a reserved SQL keyword. · default null
start_date := DATE
Optional inclusive lower bound on the day range — omit for no lower bound. Filters client-side. · default null
Returns columns
as_of_date DATE
Valuation date.
nav DOUBLE
Net asset value per share.
shares_outstanding DOUBLE
Shares outstanding.
total_net_assets DOUBLE
Total net assets (fund AUM) in the fund's currency.
Examples (3)

SPY NAV since the start of the year

SELECT as_of_date, nav
FROM spdr.main.nav_history('SPY', start_date := DATE '2026-01-01')
ORDER BY as_of_date DESC;

Recent daily total net assets for SPY

SELECT as_of_date, total_net_assets
FROM spdr.main.nav_history('SPY')
ORDER BY as_of_date DESC
LIMIT 5;

SPY's price-only NAV change from the prior year-end NAV (base_nav_date) to SSGA's latest performance date, next to the YTD total return the catalog reports for that date (the gap reflects distributions, which a NAV-per-share series excludes)

WITH p AS (SELECT ticker, performance_as_of, ytd_return_percent FROM spdr.main.products WHERE ticker = 'SPY'), n AS (SELECT as_of_date, nav FROM spdr.main.nav_history('SPY', start_date := current_date - 500)) SELECT p.ticker, p.performance_as_of, max(n.as_of_date) FILTER (WHERE n.as_of_date < date_trunc('year', p.performance_as_of)) AS base_nav_date, round(100 * (arg_max(n.nav, n.as_of_date) / arg_max(n.nav, n.as_of_date) FILTER (WHERE n.as_of_date < date_trunc('year', p.performance_as_of)) - 1), 2) AS nav_change_percent, p.ytd_return_percent
FROM p
JOIN n ON n.as_of_date <= p.performance_as_of
GROUP BY p.ticker, p.performance_as_of, p.ytd_return_percent
ORDER BY p.ticker;
Link

Try these queries

top_holdings — The top holdings of the SPDR S&P 500 ETF Trust

SELECT name, ticker, weight_percent
FROM spdr.main.holdings
WHERE fund_ticker = 'SPY'
ORDER BY weight_percent DESC
LIMIT 5;

Uses holdings

Ten largest SPDR ETFs by net assets

SELECT ticker, fund_name, net_assets
FROM spdr.main.products
ORDER BY net_assets DESC
LIMIT 10

Uses products

Top holdings of SPY

SELECT name, ticker, weight_percent
FROM spdr.main.holdings
WHERE fund_ticker = 'SPY'
ORDER BY weight_percent DESC
LIMIT 10

Uses holdings

Recent daily NAV history for SPY

SELECT as_of_date, nav
FROM spdr.main.nav_history('SPY', start_date := DATE '2026-01-01')
ORDER BY as_of_date DESC

Uses nav_history

Largest single holding of each of the five biggest SPDR equity ETFs, with its weight and approximate dollar size (the catalog picks the funds; holding_rank = 1 is applied inside the holdings scan, which still reads every fund's file because the join key is not pushed down)

WITH biggest AS (SELECT ticker, net_assets FROM spdr.main.products WHERE asset_class = 'Equity' ORDER BY net_assets DESC LIMIT 5) SELECT b.ticker AS fund, h.name AS top_holding, h.weight_percent, round(b.net_assets * h.weight_percent / 100 / 1e9, 1) AS position_usd_billions
FROM biggest b
JOIN spdr.main.holdings h ON h.fund_ticker = b.ticker
WHERE h.holding_rank = 1
ORDER BY b.net_assets DESC

Uses productsholdings

Approximate dollar size of SPY's ten largest positions: each holding's weight applied to the fund's net assets from the products catalog (USD billions)

SELECT h.holding_rank, h.name, h.ticker, h.weight_percent,
  round(p.net_assets * h.weight_percent / 100 / 1e9, 1) AS position_usd_billions
FROM spdr.main.holdings h
JOIN spdr.main.products p ON p.ticker = h.fund_ticker
WHERE h.fund_ticker = 'SPY'
ORDER BY h.holding_rank
LIMIT 10

Uses holdingsproducts

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

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • Does SPDR offer an ETF with the ticker SPY, and what is it called?
  • What is the expense ratio of the SPDR S&P 500 ETF Trust (SPY)?
  • What is the single largest holding of the SPDR S&P 500 ETF Trust (SPY) right now?
  • What was the SPDR S&P 500 ETF Trust's (SPY) net asset value on its most recent valuation date?

SPDR ETFs 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.