ETF Constituents API
getETFConstituentsThe 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
SPYOutputs
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": "NVDA",
"name": "NVIDIA CORP",
"holdingsPercent": 7.74,
"sharesHeld": 296077792,
"exchange": "NASDAQ"
},
{
"symbol": "AAPL",
"name": "APPLE INC",
"holdingsPercent": 6.85,
"sharesHeld": 180038934,
"exchange": "NASDAQ"
},
{
"symbol": "MSFT",
"name": "MICROSOFT CORP",
"holdingsPercent": 6.15,
"sharesHeld": 90558069,
"exchange": "NASDAQ"
},
{
"symbol": "AMZN",
"name": "AMAZON.COM INC",
"holdingsPercent": 3.84,
"sharesHeld": 118529806,
"exchange": "NASDAQ"
},
{
"symbol": "GOOGL",
"name": "ALPHABET INC CL A",
"holdingsPercent": 3.1,
"sharesHeld": 70893951,
"exchange": "NASDAQ"
},
{
"symbol": "AVGO",
"name": "BROADCOM INC",
"holdingsPercent": 2.81,
"sharesHeld": 57538656,
"exchange": "NASDAQ"
},
{
"symbol": "GOOG",
"name": "ALPHABET INC CL C",
"holdingsPercent": 2.48,
"sharesHeld": 56657141,
"exchange": "NASDAQ"
},
{
"symbol": "META",
"name": "META PLATFORMS INC CLASS A",
"holdingsPercent": 2.46,
"sharesHeld": 26536021,
"exchange": "NASDAQ"
},
{
"symbol": "TSLA",
"name": "TESLA INC",
"holdingsPercent": 2.17,
"sharesHeld": 34237015,
"exchange": "NASDAQ"
},
{
"symbol": "BRK.B",
"name": "BERKSHIRE HATHAWAY INC CL B",
"holdingsPercent": 1.57,
"sharesHeld": 22342839,
"exchange": "NYSE"
},
{
"symbol": "JPM",
"name": "JPMORGAN CHASE + CO",
"holdingsPercent": 1.5,
"sharesHeld": 33168765,
"exchange": "NYSE"
},
{
"symbol": "LLY",
"name": "ELI LILLY + CO",
"holdingsPercent": 1.46,
"sharesHeld": 9675697,
"exchange": "NYSE"
},
{
"symbol": "V",
"name": "VISA INC CLASS A SHARES",
"holdingsPercent": 1.01,
"sharesHeld": 20562573,
"exchange": "NYSE"
},
{
"symbol": "XOM",
"name": "EXXON MOBIL CORP",
"holdingsPercent": 0.87,
"sharesHeld": 51383087,
"exchange": "NYSE"
},
{
"symbol": "JNJ",
"name": "JOHNSON + JOHNSON",
"holdingsPercent": 0.85,
"sharesHeld": 29346023,
"exchange": "NYSE"
},
{
"symbol": "WMT",
"name": "WALMART INC",
"holdingsPercent": 0.83,
"sharesHeld": 53428794,
"exchange": "NASDAQ"
},
{
"symbol": "MA",
"name": "MASTERCARD INC A",
"holdingsPercent": 0.8,
"sharesHeld": 9990459,
"exchange": "NYSE"
},
{
"symbol": "PLTR",
"name": "PALANTIR TECHNOLOGIES INC A",
"holdingsPercent": 0.7,
"sharesHeld": 27832923,
"exchange": "NASDAQ"
},
{
"symbol": "ABBV",
"name": "ABBVIE INC",
"holdingsPercent": 0.69,
"sharesHeld": 21524615,
"exchange": "NYSE"
},
{
"symbol": "NFLX",
"name": "NETFLIX INC",
"holdingsPercent": 0.68,
"sharesHeld": 51628742,
"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>NVDA</symbol>
<name>NVIDIA CORP</name>
<holdingsPercent>7.74</holdingsPercent>
<sharesHeld>296077792</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>AAPL</symbol>
<name>APPLE INC</name>
<holdingsPercent>6.85</holdingsPercent>
<sharesHeld>180038934</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>MSFT</symbol>
<name>MICROSOFT CORP</name>
<holdingsPercent>6.15</holdingsPercent>
<sharesHeld>90558069</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>AMZN</symbol>
<name>AMAZON.COM INC</name>
<holdingsPercent>3.84</holdingsPercent>
<sharesHeld>118529806</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>GOOGL</symbol>
<name>ALPHABET INC CL A</name>
<holdingsPercent>3.1</holdingsPercent>
<sharesHeld>70893951</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>AVGO</symbol>
<name>BROADCOM INC</name>
<holdingsPercent>2.81</holdingsPercent>
<sharesHeld>57538656</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>GOOG</symbol>
<name>ALPHABET INC CL C</name>
<holdingsPercent>2.48</holdingsPercent>
<sharesHeld>56657141</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>META</symbol>
<name>META PLATFORMS INC CLASS A</name>
<holdingsPercent>2.46</holdingsPercent>
<sharesHeld>26536021</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>TSLA</symbol>
<name>TESLA INC</name>
<holdingsPercent>2.17</holdingsPercent>
<sharesHeld>34237015</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>BRK.B</symbol>
<name>BERKSHIRE HATHAWAY INC CL B</name>
<holdingsPercent>1.57</holdingsPercent>
<sharesHeld>22342839</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>JPM</symbol>
<name>JPMORGAN CHASE + CO</name>
<holdingsPercent>1.5</holdingsPercent>
<sharesHeld>33168765</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>LLY</symbol>
<name>ELI LILLY + CO</name>
<holdingsPercent>1.46</holdingsPercent>
<sharesHeld>9675697</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>V</symbol>
<name>VISA INC CLASS A SHARES</name>
<holdingsPercent>1.01</holdingsPercent>
<sharesHeld>20562573</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>XOM</symbol>
<name>EXXON MOBIL CORP</name>
<holdingsPercent>0.87</holdingsPercent>
<sharesHeld>51383087</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>JNJ</symbol>
<name>JOHNSON + JOHNSON</name>
<holdingsPercent>0.85</holdingsPercent>
<sharesHeld>29346023</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>WMT</symbol>
<name>WALMART INC</name>
<holdingsPercent>0.83</holdingsPercent>
<sharesHeld>53428794</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>MA</symbol>
<name>MASTERCARD INC A</name>
<holdingsPercent>0.8</holdingsPercent>
<sharesHeld>9990459</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>PLTR</symbol>
<name>PALANTIR TECHNOLOGIES INC A</name>
<holdingsPercent>0.7</holdingsPercent>
<sharesHeld>27832923</sharesHeld>
<exchange>NASDAQ</exchange>
</item>
<item>
<symbol>ABBV</symbol>
<name>ABBVIE INC</name>
<holdingsPercent>0.69</holdingsPercent>
<sharesHeld>21524615</sharesHeld>
<exchange>NYSE</exchange>
</item>
<item>
<symbol>NFLX</symbol>
<name>NETFLIX INC</name>
<holdingsPercent>0.68</holdingsPercent>
<sharesHeld>51628742</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
"NVDA","NVIDIA CORP","7.74","296077792","NASDAQ"
"AAPL","APPLE INC","6.85","180038934","NASDAQ"
"MSFT","MICROSOFT CORP","6.15","90558069","NASDAQ"
"AMZN","AMAZON.COM INC","3.84","118529806","NASDAQ"
"GOOGL","ALPHABET INC CL A","3.1","70893951","NASDAQ"
"AVGO","BROADCOM INC","2.81","57538656","NASDAQ"
"GOOG","ALPHABET INC CL C","2.48","56657141","NASDAQ"
"META","META PLATFORMS INC CLASS A","2.46","26536021","NASDAQ"
"TSLA","TESLA INC","2.17","34237015","NASDAQ"
"BRK.B","BERKSHIRE HATHAWAY INC CL B","1.57","22342839","NYSE"
"JPM","JPMORGAN CHASE + CO","1.5","33168765","NYSE"
"LLY","ELI LILLY + CO","1.46","9675697","NYSE"
"V","VISA INC CLASS A SHARES","1.01","20562573","NYSE"
"XOM","EXXON MOBIL CORP","0.87","51383087","NYSE"
"JNJ","JOHNSON + JOHNSON","0.85","29346023","NYSE"
"WMT","WALMART INC","0.83","53428794","NASDAQ"
"MA","MASTERCARD INC A","0.8","9990459","NYSE"
"PLTR","PALANTIR TECHNOLOGIES INC A","0.7","27832923","NASDAQ"
"ABBV","ABBVIE INC","0.69","21524615","NYSE"
"NFLX","NETFLIX INC","0.68","51628742","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