getEquitiesByExchange API

Receive all real-time or delayed stock and/or index price data by exchange through a single onDemand query.

All APIs

Contact Us to Get Access

Inputs

exchange required

A valid exchange code.

Type
enum (A type which includes a list of valid possible values.) 
Example
NYSE 

Valid Values:
INDEX, INDEX-NY, INDEX-NQ, SPECIAL, INDEX-DOW, INDEX-CBOE, INDEX-SP, INDEX-RL, INDEX-TSX, NYSE, BATS, OTHER OTC, NASDAQ, AMEX, LSE, TSX, TSX-V, ASX, CNSX

fields optional

The fields requested.

Type
list (A comma or semi-colon delimited string.) 
Example
settlement 

Outputs

Name / Requirement
Description
Type
symbol
always returned
The instrument symbol.
string
A sequence of characters. (example: GOOG)
name
always returned
The name of the instrument.
string
A sequence of characters. (example: GOOG)
open
always returned
The open price for the instrument.
double
A numeric type defining a number with fractional parts. (example: 2.14)
high
always returned
The high price for the day.
double
A numeric type defining a number with fractional parts. (example: 2.14)
low
always returned
The low price for the day.
double
A numeric type defining a number with fractional parts. (example: 2.14)
last
always returned
The last/close price for the instrument.
double
A numeric type defining a number with fractional parts. (example: 2.14)
netChange
always returned
The difference between the last traded price and the previous close.
double
A numeric type defining a number with fractional parts. (example: 2.14)
percentChange
always returned
The percent difference between the last traded price and the previous close.
double
A numeric type defining a number with fractional parts. (example: 2.14)
volume
always returned
The volume of the instrument.
int
A numeric type defining a whole number. (example: 2)
tradeTime
always returned
The trade time of the last trade for the instrument.
time
A time in the format of HH:MI:SS<TIMEZONE_OFFSET>.
tradeDate
always returned
The trade date of the last trade for the instrument.
date
A date in the format of YYYY-MM-DD.
exchange
always returned
The exchange code on which the instrument trades.
string
A sequence of characters. (example: GOOG)
settlement
as requested
Flag to indicate if the prices are settled.
string
A sequence of characters. (example: GOOG)
previousClose
as requested
Previous day's closing price.
double
A numeric type defining a number with fractional parts. (example: 2.14)

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/getEquitiesByExchange.json?apikey=<YOUR API KEY>&exchange=NYSE&fields=settlement
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getEquitiesByExchange.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&exchange=NYSE&fields=settlement

Response

{
    "status": {
        "code": 204,
        "message": "Success, but no content to return."
    },
    "results": null
}

XML

GET

GET https://ondemand.websol.barchart.com/getEquitiesByExchange.xml?apikey=<YOUR API KEY>&exchange=NYSE&fields=settlement
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getEquitiesByExchange.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&exchange=NYSE&fields=settlement

Response


<?xml version="1.0" encoding="utf-8"?>
 <getEquitiesByExchange>
  <status>
   <code>204</code>
   <message>Success, but no content to return.</message>
  </status>
 </getEquitiesByExchange>

CSV

GET

GET https://ondemand.websol.barchart.com/getEquitiesByExchange.csv?apikey=<YOUR API KEY>&exchange=NYSE&fields=settlement
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getEquitiesByExchange.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&exchange=NYSE&fields=settlement

Response




PHP

<?php

$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');

$params = [
    'exchange' => 'NYSE',
    'fields' => 'settlement',
];

$result = $ondemand->getEquitiesByExchange($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.getEquitiesByExchange("NYSE", "settlement")

Perl

use SOAP::Lite;
use SOAP::WSDL;

my $ondemand = SOAP::Lite
    -> service('https://ondemand.websol.barchart.com/service?wsdl');

my $result = $ondemand->getEquitiesByExchange('NYSE', 'settlement');

print $result;

Python

from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')

result = client.service.getEquitiesByExchange('NYSE', 'settlement')

print result

Ruby

require 'savon'

ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')

response = ondemand.call(
    :getEquitiesByExchange,
    message: {
        exchange: 'NYSE',
        fields: 'settlement',
    }
)

response.body