ETF Constituents API
getETFConstituents
The getETFConstituents API from Barchart OnDemand provides the complete list of constituents for a given ETF and includes symbol, name, % holding, and shares.
View All APIsContact Us to Get Access
Inputs
symbolrequired
A valid ETF symbol.
Type
string (A sequence of characters. (example: GOOG))
Example
SPY
Outputs
symbol
always returned
always returned
The symbol of the constituent instrument.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
name
always returned
always returned
The name of the constituent instrument.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
holdingsPercent
always returned
always returned
The percent of holdings.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
sharesHeld
always returned
always returned
Number of shares held.
int
A numeric type defining a whole number. (example: 2)
A numeric type defining a whole number. (example: 2)
exchange
always returned
always returned
Exchange code for the marketplace where the financial instruments are listed.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
Status Code Responses
200
OK
Success
400
Bad Request
The request was invalid, please see the message for more information.
500
Internal Server Error
Something is not working correctly, please contact support.
JSON
GET
GET https://ondemand.websol.barchart.com/getETFConstituents.json?apikey=YOUR_API_KEY&symbol=SPY
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getETFConstituents.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbol=SPY
Response
{
"status": {
"code": 200,
"message": "Success."
},
"results": [
{
"symbol": "AAPL",
"name": "APPLE INC",
"holdingsPercent": 6.95,
"sharesHeld": 190466074,
"exchange": "NASDAQ"
},
{
"symbol": "NVDA",
"name": "NVIDIA CORP",
"holdingsPercent": 6.91,
"sharesHeld": 308170593,
"exchange": "NASDAQ"
},
{
"symbol": "MSFT",
"name": "MICROSOFT CORP",
"holdingsPercent": 6.19,
"sharesHeld": 93114972,
"exchange": "NASDAQ"
},
{
"symbol": "AMZN",
"name": "AMAZON.COM INC",
"holdingsPercent": 3.77,
"sharesHeld": 117023946,
"exchange": "NASDAQ"
},
{
"symbol": "META",
"name": "META PLATFORMS INC CLASS A",
"holdingsPercent": 2.43,
"sharesHeld": 27369638,
"exchange": "NASDAQ"
},
{
"symbol": "GOOGL",
"name": "ALPHABET INC CL A",
"holdingsPercent": 2.06,
"sharesHeld": 73397986,
"exchange": "NASDAQ"
},
{
"symbol": "TSLA",
"name": "TESLA INC",
"holdingsPercent": 1.88,
"sharesHeld": 34757079,
"exchange": "NASDAQ"
},
{
"symbol": "BRK.B",
"name": "BERKSHIRE HATHAWAY INC CL B",
"holdingsPercent": 1.73,
"sharesHeld": 22947144,
"exchange": "NYSE"
},
{
"symbol": "GOOG",
"name": "ALPHABET INC CL C",
"holdingsPercent": 1.7,
"sharesHeld": 60169021,
"exchange": "NASDAQ"
},
{
"symbol": "AVGO",
"name": "BROADCOM INC",
"holdingsPercent": 1.54,
"sharesHeld": 58312595,
"exchange": "NASDAQ"
},
{
"symbol": "JPM",
"name": "JPMORGAN CHASE + CO",
"holdingsPercent": 1.4,
"sharesHeld": 35640614,
"exchange": "NYSE"
},
{
"symbol": "LLY",
"name": "ELI LILLY + CO",
"holdingsPercent": 1.15,
"sharesHeld": 9882104,
"exchange": "NYSE"
},
{
"symbol": "UNH",
"name": "UNITEDHEALTH GROUP INC",
"holdingsPercent": 1.09,
"sharesHeld": 11567068,
"exchange": "NYSE"
},
{
"symbol": "XOM",
"name": "EXXON MOBIL CORP",
"holdingsPercent": 1.07,
"sharesHeld": 55652214,
"exchange": "NYSE"
},
{
"symbol": "V",
"name": "VISA INC CLASS A SHARES",
"holdingsPercent": 1.04,
"sharesHeld": 20924109,
"exchange": "NYSE"
},
{
"symbol": "MA",
"name": "MASTERCARD INC A",
"holdingsPercent": 0.86,
"sharesHeld": 10334221,
"exchange": "NYSE"
},
{
"symbol": "COST",
"name": "COSTCO WHOLESALE CORP",
"holdingsPercent": 0.82,
"sharesHeld": 5552952,
"exchange": "NASDAQ"
},
{
"symbol": "HD",
"name": "HOME DEPOT INC",
"holdingsPercent": 0.82,
"sharesHeld": 12420494,
"exchange": "NYSE"
},
{
"symbol": "PG",
"name": "PROCTER + GAMBLE CO\/THE",
"holdingsPercent": 0.81,
"sharesHeld": 29486057,
"exchange": "NYSE"
},
{
"symbol": "JNJ",
"name": "JOHNSON + JOHNSON",
"holdingsPercent": 0.75,
"sharesHeld": 30151987,
"exchange": "NYSE"
}
]
}
XML
GET
GET https://ondemand.websol.barchart.com/getETFConstituents.xml?apikey=YOUR_API_KEY&symbol=SPY
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getETFConstituents.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbol=SPY
Response
<?xml version="1.0" encoding="utf-8"?>
<getETFConstituents>
<status>
<code>200</code>
<message>Success.</message>
</status>
<item>
<symbol>AAPL</symbol>
<name>APPLE INC</name>
<holdingsPercent>6.95</holdingsPercent>
<sharesHeld>190466074</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>NVDA</symbol>
<name>NVIDIA CORP</name>
<holdingsPercent>6.91</holdingsPercent>
<sharesHeld>308170593</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>MSFT</symbol>
<name>MICROSOFT CORP</name>
<holdingsPercent>6.19</holdingsPercent>
<sharesHeld>93114972</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>AMZN</symbol>
<name>AMAZON.COM INC</name>
<holdingsPercent>3.77</holdingsPercent>
<sharesHeld>117023946</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>META</symbol>
<name>META PLATFORMS INC CLASS A</name>
<holdingsPercent>2.43</holdingsPercent>
<sharesHeld>27369638</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>GOOGL</symbol>
<name>ALPHABET INC CL A</name>
<holdingsPercent>2.06</holdingsPercent>
<sharesHeld>73397986</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>TSLA</symbol>
<name>TESLA INC</name>
<holdingsPercent>1.88</holdingsPercent>
<sharesHeld>34757079</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>BRK.B</symbol>
<name>BERKSHIRE HATHAWAY INC CL B</name>
<holdingsPercent>1.73</holdingsPercent>
<sharesHeld>22947144</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>GOOG</symbol>
<name>ALPHABET INC CL C</name>
<holdingsPercent>1.7</holdingsPercent>
<sharesHeld>60169021</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>AVGO</symbol>
<name>BROADCOM INC</name>
<holdingsPercent>1.54</holdingsPercent>
<sharesHeld>58312595</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>JPM</symbol>
<name>JPMORGAN CHASE + CO</name>
<holdingsPercent>1.4</holdingsPercent>
<sharesHeld>35640614</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>LLY</symbol>
<name>ELI LILLY + CO</name>
<holdingsPercent>1.15</holdingsPercent>
<sharesHeld>9882104</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>UNH</symbol>
<name>UNITEDHEALTH GROUP INC</name>
<holdingsPercent>1.09</holdingsPercent>
<sharesHeld>11567068</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>XOM</symbol>
<name>EXXON MOBIL CORP</name>
<holdingsPercent>1.07</holdingsPercent>
<sharesHeld>55652214</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>V</symbol>
<name>VISA INC CLASS A SHARES</name>
<holdingsPercent>1.04</holdingsPercent>
<sharesHeld>20924109</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>MA</symbol>
<name>MASTERCARD INC A</name>
<holdingsPercent>0.86</holdingsPercent>
<sharesHeld>10334221</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>COST</symbol>
<name>COSTCO WHOLESALE CORP</name>
<holdingsPercent>0.82</holdingsPercent>
<sharesHeld>5552952</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>HD</symbol>
<name>HOME DEPOT INC</name>
<holdingsPercent>0.82</holdingsPercent>
<sharesHeld>12420494</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>PG</symbol>
<name>PROCTER + GAMBLE CO/THE</name>
<holdingsPercent>0.81</holdingsPercent>
<sharesHeld>29486057</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>JNJ</symbol>
<name>JOHNSON + JOHNSON</name>
<holdingsPercent>0.75</holdingsPercent>
<sharesHeld>30151987</sharesHeld>
<exchange>NYSE</exchange>
</item>
</getETFConstituents>
CSV
GET
GET https://ondemand.websol.barchart.com/getETFConstituents.csv?apikey=YOUR_API_KEY&symbol=SPY
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getETFConstituents.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbol=SPY
Response
symbol,name,holdingsPercent,sharesHeld,exchange
"AAPL","APPLE INC","6.95","190466074","NASDAQ"
"NVDA","NVIDIA CORP","6.91","308170593","NASDAQ"
"MSFT","MICROSOFT CORP","6.19","93114972","NASDAQ"
"AMZN","AMAZON.COM INC","3.77","117023946","NASDAQ"
"META","META PLATFORMS INC CLASS A","2.43","27369638","NASDAQ"
"GOOGL","ALPHABET INC CL A","2.06","73397986","NASDAQ"
"TSLA","TESLA INC","1.88","34757079","NASDAQ"
"BRK.B","BERKSHIRE HATHAWAY INC CL B","1.73","22947144","NYSE"
"GOOG","ALPHABET INC CL C","1.7","60169021","NASDAQ"
"AVGO","BROADCOM INC","1.54","58312595","NASDAQ"
"JPM","JPMORGAN CHASE + CO","1.4","35640614","NYSE"
"LLY","ELI LILLY + CO","1.15","9882104","NYSE"
"UNH","UNITEDHEALTH GROUP INC","1.09","11567068","NYSE"
"XOM","EXXON MOBIL CORP","1.07","55652214","NYSE"
"V","VISA INC CLASS A SHARES","1.04","20924109","NYSE"
"MA","MASTERCARD INC A","0.86","10334221","NYSE"
"COST","COSTCO WHOLESALE CORP","0.82","5552952","NASDAQ"
"HD","HOME DEPOT INC","0.82","12420494","NYSE"
"PG","PROCTER + GAMBLE CO/THE","0.81","29486057","NYSE"
"JNJ","JOHNSON + JOHNSON","0.75","30151987","NYSE"
PHP
<?php
$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'symbol' => 'SPY',
];
$result = $ondemand->getETFConstituents($params);
var_dump($result);
Classic ASP
Dim ondemand
Dim result
Set ondemand = Server.CreateObject("MSSOAP.SoapClient30")
ondemand.ClientProperty("ServerHTTPRequest") = True
ondemand.MSSoapInit("https://ondemand.websol.barchart.com/service?wsdl")
Set result = ondemand.getETFConstituents("YOUR_API_KEY", "SPY")
Perl
use SOAP::Lite;
use SOAP::WSDL;
my $ondemand = SOAP::Lite
-> service('https://ondemand.websol.barchart.com/service?wsdl');
my $result = $ondemand->getETFConstituents('YOUR_API_KEY', 'SPY');
print $result;
Python
from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')
result = ondemand.service.getETFConstituents('YOUR_API_KEY', 'SPY')
print(result)
Ruby
require 'savon'
ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')
response = ondemand.call(
:getETFConstituents,
message: {
apikey: 'YOUR_API_KEY',
symbol: 'SPY',
}
)
response.body