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": 7.63,
"sharesHeld": 184285585,
"exchange": "NASDAQ"
},
{
"symbol": "MSFT",
"name": "MICROSOFT CORP",
"holdingsPercent": 6.52,
"sharesHeld": 90093568,
"exchange": "NASDAQ"
},
{
"symbol": "NVDA",
"name": "NVIDIA CORP",
"holdingsPercent": 6.46,
"sharesHeld": 298170415,
"exchange": "NASDAQ"
},
{
"symbol": "AMZN",
"name": "AMAZON.COM INC",
"holdingsPercent": 4.19,
"sharesHeld": 113217550,
"exchange": "NASDAQ"
},
{
"symbol": "META",
"name": "META PLATFORMS INC CLASS A",
"holdingsPercent": 2.61,
"sharesHeld": 26479184,
"exchange": "NASDAQ"
},
{
"symbol": "TSLA",
"name": "TESLA INC",
"holdingsPercent": 2.43,
"sharesHeld": 33627847,
"exchange": "NASDAQ"
},
{
"symbol": "GOOGL",
"name": "ALPHABET INC CL A",
"holdingsPercent": 2.22,
"sharesHeld": 71010080,
"exchange": "NASDAQ"
},
{
"symbol": "AVGO",
"name": "BROADCOM INC",
"holdingsPercent": 2.04,
"sharesHeld": 56414855,
"exchange": "NASDAQ"
},
{
"symbol": "GOOG",
"name": "ALPHABET INC CL C",
"holdingsPercent": 1.83,
"sharesHeld": 58211687,
"exchange": "NASDAQ"
},
{
"symbol": "BRK.B",
"name": "BERKSHIRE HATHAWAY INC CL B",
"holdingsPercent": 1.65,
"sharesHeld": 22200782,
"exchange": "NYSE"
},
{
"symbol": "JPM",
"name": "JPMORGAN CHASE + CO",
"holdingsPercent": 1.33,
"sharesHeld": 34481474,
"exchange": "NYSE"
},
{
"symbol": "LLY",
"name": "ELI LILLY + CO",
"holdingsPercent": 1.2,
"sharesHeld": 9560278,
"exchange": "NYSE"
},
{
"symbol": "V",
"name": "VISA INC CLASS A SHARES",
"holdingsPercent": 1.06,
"sharesHeld": 20243777,
"exchange": "NYSE"
},
{
"symbol": "XOM",
"name": "EXXON MOBIL CORP",
"holdingsPercent": 0.94,
"sharesHeld": 53841924,
"exchange": "NYSE"
},
{
"symbol": "UNH",
"name": "UNITEDHEALTH GROUP INC",
"holdingsPercent": 0.91,
"sharesHeld": 11190612,
"exchange": "NYSE"
},
{
"symbol": "MA",
"name": "MASTERCARD INC A",
"holdingsPercent": 0.87,
"sharesHeld": 9997857,
"exchange": "NYSE"
},
{
"symbol": "COST",
"name": "COSTCO WHOLESALE CORP",
"holdingsPercent": 0.85,
"sharesHeld": 5372438,
"exchange": "NASDAQ"
},
{
"symbol": "WMT",
"name": "WALMART INC",
"holdingsPercent": 0.81,
"sharesHeld": 52634445,
"exchange": "NYSE"
},
{
"symbol": "PG",
"name": "PROCTER + GAMBLE CO\/THE",
"holdingsPercent": 0.8,
"sharesHeld": 28526603,
"exchange": "NYSE"
},
{
"symbol": "NFLX",
"name": "NETFLIX INC",
"holdingsPercent": 0.78,
"sharesHeld": 5200389,
"exchange": "NASDAQ"
}
]
}
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>7.63</holdingsPercent>
<sharesHeld>184285585</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>MSFT</symbol>
<name>MICROSOFT CORP</name>
<holdingsPercent>6.52</holdingsPercent>
<sharesHeld>90093568</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>NVDA</symbol>
<name>NVIDIA CORP</name>
<holdingsPercent>6.46</holdingsPercent>
<sharesHeld>298170415</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>AMZN</symbol>
<name>AMAZON.COM INC</name>
<holdingsPercent>4.19</holdingsPercent>
<sharesHeld>113217550</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>META</symbol>
<name>META PLATFORMS INC CLASS A</name>
<holdingsPercent>2.61</holdingsPercent>
<sharesHeld>26479184</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>TSLA</symbol>
<name>TESLA INC</name>
<holdingsPercent>2.43</holdingsPercent>
<sharesHeld>33627847</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>GOOGL</symbol>
<name>ALPHABET INC CL A</name>
<holdingsPercent>2.22</holdingsPercent>
<sharesHeld>71010080</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>AVGO</symbol>
<name>BROADCOM INC</name>
<holdingsPercent>2.04</holdingsPercent>
<sharesHeld>56414855</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>GOOG</symbol>
<name>ALPHABET INC CL C</name>
<holdingsPercent>1.83</holdingsPercent>
<sharesHeld>58211687</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>BRK.B</symbol>
<name>BERKSHIRE HATHAWAY INC CL B</name>
<holdingsPercent>1.65</holdingsPercent>
<sharesHeld>22200782</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>JPM</symbol>
<name>JPMORGAN CHASE + CO</name>
<holdingsPercent>1.33</holdingsPercent>
<sharesHeld>34481474</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>LLY</symbol>
<name>ELI LILLY + CO</name>
<holdingsPercent>1.2</holdingsPercent>
<sharesHeld>9560278</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>V</symbol>
<name>VISA INC CLASS A SHARES</name>
<holdingsPercent>1.06</holdingsPercent>
<sharesHeld>20243777</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>XOM</symbol>
<name>EXXON MOBIL CORP</name>
<holdingsPercent>0.94</holdingsPercent>
<sharesHeld>53841924</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>UNH</symbol>
<name>UNITEDHEALTH GROUP INC</name>
<holdingsPercent>0.91</holdingsPercent>
<sharesHeld>11190612</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>MA</symbol>
<name>MASTERCARD INC A</name>
<holdingsPercent>0.87</holdingsPercent>
<sharesHeld>9997857</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>COST</symbol>
<name>COSTCO WHOLESALE CORP</name>
<holdingsPercent>0.85</holdingsPercent>
<sharesHeld>5372438</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>WMT</symbol>
<name>WALMART INC</name>
<holdingsPercent>0.81</holdingsPercent>
<sharesHeld>52634445</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>PG</symbol>
<name>PROCTER + GAMBLE CO/THE</name>
<holdingsPercent>0.8</holdingsPercent>
<sharesHeld>28526603</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>NFLX</symbol>
<name>NETFLIX INC</name>
<holdingsPercent>0.78</holdingsPercent>
<sharesHeld>5200389</sharesHeld>
<exchange>NASDAQ</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","7.63","184285585","NASDAQ"
"MSFT","MICROSOFT CORP","6.52","90093568","NASDAQ"
"NVDA","NVIDIA CORP","6.46","298170415","NASDAQ"
"AMZN","AMAZON.COM INC","4.19","113217550","NASDAQ"
"META","META PLATFORMS INC CLASS A","2.61","26479184","NASDAQ"
"TSLA","TESLA INC","2.43","33627847","NASDAQ"
"GOOGL","ALPHABET INC CL A","2.22","71010080","NASDAQ"
"AVGO","BROADCOM INC","2.04","56414855","NASDAQ"
"GOOG","ALPHABET INC CL C","1.83","58211687","NASDAQ"
"BRK.B","BERKSHIRE HATHAWAY INC CL B","1.65","22200782","NYSE"
"JPM","JPMORGAN CHASE + CO","1.33","34481474","NYSE"
"LLY","ELI LILLY + CO","1.2","9560278","NYSE"
"V","VISA INC CLASS A SHARES","1.06","20243777","NYSE"
"XOM","EXXON MOBIL CORP","0.94","53841924","NYSE"
"UNH","UNITEDHEALTH GROUP INC","0.91","11190612","NYSE"
"MA","MASTERCARD INC A","0.87","9997857","NYSE"
"COST","COSTCO WHOLESALE CORP","0.85","5372438","NASDAQ"
"WMT","WALMART INC","0.81","52634445","NYSE"
"PG","PROCTER + GAMBLE CO/THE","0.8","28526603","NYSE"
"NFLX","NETFLIX INC","0.78","5200389","NASDAQ"
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