Equity Index Members API
getIndexMembers
The getIndexMembers API from Barchart OnDemand returns the constituents comprising an index.
View All APIsContact Us to Get Access
Inputs
symbolrequired
A symbol or code that identifies an index.
Type
enum (A type which includes a list of valid possible values.)
Example
$SPX
Valid Values
$ONE, $IDX, $SPX, $IQY, $RUI, $IUX, $RUA, $IUXX, $DOWC, $DOWT, $DOWU, $DOWI, $TXCX, $JX, $TXSX, $TTCS, $TOOC, $TXTW, $TTCD, $TTCS, $TTEN, $TTFS, $TTIN, $TTTK, $TTMT, $TTHC, $TTRE, $TTTS, $TTUT, $RTCM, $RTRE
fieldsoptional
The fields requested.
Type
list (A comma or semi-colon delimited string.)
Example
exchange
Outputs
index
always returned
always returned
The index that the symbol belongs to.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
symbol
always returned
always returned
A symbol or code that identifies a financial instrument.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
name
always returned
always returned
The name for the financial instrument.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
exchange
as requested
as requested
The exchange code on which the financial instrument trades.
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/getIndexMembers.json?apikey=YOUR_API_KEY&symbol=%24SPX&fields=exchange
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getIndexMembers.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbol=%24SPX&fields=exchange
Response
{
"status": {
"code": 200,
"message": "Success."
},
"results": [
{
"index": "$SPX",
"symbol": "A",
"name": "Agilent Technologies",
"exchange": "NYSE"
},
{
"index": "$SPX",
"symbol": "AAPL",
"name": "Apple Inc",
"exchange": "NASDAQ"
},
{
"index": "$SPX",
"symbol": "ABBV",
"name": "Abbvie Inc",
"exchange": "NYSE"
},
{
"index": "$SPX",
"symbol": "ABNB",
"name": "Airbnb Inc Cl A",
"exchange": "NASDAQ"
},
{
"index": "$SPX",
"symbol": "ABT",
"name": "Abbott Laboratories",
"exchange": "NYSE"
},
{
"index": "$SPX",
"symbol": "ACGL",
"name": "Arch Capital Grp Ltd",
"exchange": "NASDAQ"
},
{
"index": "$SPX",
"symbol": "ACN",
"name": "Accenture Plc",
"exchange": "NYSE"
},
{
"index": "$SPX",
"symbol": "ADBE",
"name": "Adobe Systems Inc",
"exchange": "NASDAQ"
},
{
"index": "$SPX",
"symbol": "ADI",
"name": "Analog Devices",
"exchange": "NASDAQ"
},
{
"index": "$SPX",
"symbol": "ADM",
"name": "Archer Daniels Midland",
"exchange": "NYSE"
},
{
"index": "$SPX",
"symbol": "ADP",
"name": "Automatic Data Procs",
"exchange": "NASDAQ"
},
{
"index": "$SPX",
"symbol": "ADSK",
"name": "Autodesk Inc",
"exchange": "NASDAQ"
},
{
"index": "$SPX",
"symbol": "AEE",
"name": "Ameren Corp",
"exchange": "NYSE"
},
{
"index": "$SPX",
"symbol": "AEP",
"name": "American Electric Power Company",
"exchange": "NASDAQ"
},
{
"index": "$SPX",
"symbol": "AES",
"name": "The Aes Corp",
"exchange": "NYSE"
},
{
"index": "$SPX",
"symbol": "AFL",
"name": "Aflac Inc",
"exchange": "NYSE"
},
{
"index": "$SPX",
"symbol": "AIG",
"name": "American International Group",
"exchange": "NYSE"
},
{
"index": "$SPX",
"symbol": "AIZ",
"name": "Assurant Inc",
"exchange": "NYSE"
},
{
"index": "$SPX",
"symbol": "AJG",
"name": "Arthur J. Gallagher & Company",
"exchange": "NYSE"
},
{
"index": "$SPX",
"symbol": "AKAM",
"name": "Akamai Technologies",
"exchange": "NASDAQ"
}
]
}
XML
GET
GET https://ondemand.websol.barchart.com/getIndexMembers.xml?apikey=YOUR_API_KEY&symbol=%24SPX&fields=exchange
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getIndexMembers.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbol=%24SPX&fields=exchange
Response
<?xml version="1.0" encoding="utf-8"?>
<getIndexMembers>
<status>
<code>200</code>
<message>Success.</message>
</status>
<item>
<index>$SPX</index>
<symbol>A</symbol>
<name>Agilent Technologies</name>
<exchange>NYSE</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>AAPL</symbol>
<name>Apple Inc</name>
<exchange>NASDAQ</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>ABBV</symbol>
<name>Abbvie Inc</name>
<exchange>NYSE</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>ABNB</symbol>
<name>Airbnb Inc Cl A</name>
<exchange>NASDAQ</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>ABT</symbol>
<name>Abbott Laboratories</name>
<exchange>NYSE</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>ACGL</symbol>
<name>Arch Capital Grp Ltd</name>
<exchange>NASDAQ</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>ACN</symbol>
<name>Accenture Plc</name>
<exchange>NYSE</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>ADBE</symbol>
<name>Adobe Systems Inc</name>
<exchange>NASDAQ</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>ADI</symbol>
<name>Analog Devices</name>
<exchange>NASDAQ</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>ADM</symbol>
<name>Archer Daniels Midland</name>
<exchange>NYSE</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>ADP</symbol>
<name>Automatic Data Procs</name>
<exchange>NASDAQ</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>ADSK</symbol>
<name>Autodesk Inc</name>
<exchange>NASDAQ</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>AEE</symbol>
<name>Ameren Corp</name>
<exchange>NYSE</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>AEP</symbol>
<name>American Electric Power Company</name>
<exchange>NASDAQ</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>AES</symbol>
<name>The Aes Corp</name>
<exchange>NYSE</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>AFL</symbol>
<name>Aflac Inc</name>
<exchange>NYSE</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>AIG</symbol>
<name>American International Group</name>
<exchange>NYSE</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>AIZ</symbol>
<name>Assurant Inc</name>
<exchange>NYSE</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>AJG</symbol>
<name>Arthur J. Gallagher & Company</name>
<exchange>NYSE</exchange>
</item>
<item>
<index>$SPX</index>
<symbol>AKAM</symbol>
<name>Akamai Technologies</name>
<exchange>NASDAQ</exchange>
</item>
</getIndexMembers>
CSV
GET
GET https://ondemand.websol.barchart.com/getIndexMembers.csv?apikey=YOUR_API_KEY&symbol=%24SPX&fields=exchange
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getIndexMembers.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbol=%24SPX&fields=exchange
Response
index,symbol,name,exchange
"$SPX","A","Agilent Technologies","NYSE"
"$SPX","AAPL","Apple Inc","NASDAQ"
"$SPX","ABBV","Abbvie Inc","NYSE"
"$SPX","ABNB","Airbnb Inc Cl A","NASDAQ"
"$SPX","ABT","Abbott Laboratories","NYSE"
"$SPX","ACGL","Arch Capital Grp Ltd","NASDAQ"
"$SPX","ACN","Accenture Plc","NYSE"
"$SPX","ADBE","Adobe Systems Inc","NASDAQ"
"$SPX","ADI","Analog Devices","NASDAQ"
"$SPX","ADM","Archer Daniels Midland","NYSE"
"$SPX","ADP","Automatic Data Procs","NASDAQ"
"$SPX","ADSK","Autodesk Inc","NASDAQ"
"$SPX","AEE","Ameren Corp","NYSE"
"$SPX","AEP","American Electric Power Company","NASDAQ"
"$SPX","AES","The Aes Corp","NYSE"
"$SPX","AFL","Aflac Inc","NYSE"
"$SPX","AIG","American International Group","NYSE"
"$SPX","AIZ","Assurant Inc","NYSE"
"$SPX","AJG","Arthur J. Gallagher & Company","NYSE"
"$SPX","AKAM","Akamai Technologies","NASDAQ"
PHP
<?php
$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'symbol' => '$SPX',
'fields' => 'exchange',
];
$result = $ondemand->getIndexMembers($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.getIndexMembers("YOUR_API_KEY", "$SPX", "exchange")
Perl
use SOAP::Lite;
use SOAP::WSDL;
my $ondemand = SOAP::Lite
-> service('https://ondemand.websol.barchart.com/service?wsdl');
my $result = $ondemand->getIndexMembers('YOUR_API_KEY', '$SPX', 'exchange');
print $result;
Python
from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')
result = ondemand.service.getIndexMembers('YOUR_API_KEY', '$SPX', 'exchange')
print(result)
Ruby
require 'savon'
ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')
response = ondemand.call(
:getIndexMembers,
message: {
apikey: 'YOUR_API_KEY',
symbol: '$SPX',
fields: 'exchange',
}
)
response.body