NASDAQAnalytics: SearchQuotesBySpread

Symbols:
StartDateTime:
EndDateTime:
MarketCenters:
Spread:

Web Service Description

Retrieves all quotes whose spread (best offer - best bid) is smaller than a Spread value for requested symbol(s) within a date and time range and for a market center(s).


Web Service Hit Calculation

Requests against this operation count as 5 hits per symbol per day.

Inputs and Outputs Parameters for SearchQuotesBySpread

Inputs

NameDescriptionRequiredExample
SymbolsSymbol(s)YesNDAQ, GOOG
StartDateTimeStart date and time.

For an entire day of market activity, NASDAQ OMX recommends firms enter the time range 00:00:00.000 - 20:00:00.000. For example, for 6/20/2011 activity, enter 6/20/2011 00:00:00.000 in the StartDateTime field and 6/20/2011 20:00:00.000 in the EndDateTimeField. For 6/20/2011 - 6/25/2011 data, enter 6/20/2011 00:00:00.000 in the StartDateTime field and 6/25/2011 20:00:00.000 in the EndDateTime field.
Yes11/9/2018 09:30:00.000
EndDateTimeEnd date and time.

For an entire day of market activity, NASDAQ OMX recommends firms enter the time range 00:00:00.000 - 20:00:00.000. For example, for 6/20/2011 activity, enter 6/20/2011 00:00:00.000 in the StartDateTime field and 6/20/2011 20:00:00.000 in the EndDateTimeField. For 6/20/2011 - 6/25/2011 data, enter 6/20/2011 00:00:00.000 in the StartDateTime field and 6/25/2011 20:00:00.000 in the EndDateTime field.
Yes11/9/2018 09:30:25.000
MarketCentersMarket center code(s). NASDAQ OMX Market Center is identified with the 'T' or 'Q' market center codes.NoQ, B
SpreadMarket Spread- The difference between current bid and the current askYes1.02

Outputs

NameDescriptionAlways Present
ArrayOfQuoteResults
Array of QuoteResults instancesYes
QuoteResults
Each instance represents a Quote ResultNo
OutcomeThe outcome of the call. Possible values are: Success, SystemError, RequestError and RegistrationError.Yes
MessageA short message describing the error if the Outcome field contains RequestError, RegistrationError, or SystemError. An informational message is sometimes provided when Outcome is Success.Yes
IdentityA description of how the call was authenticated. Possible values are: IP, Cookie, Header and Request.Yes
DelayReports the time it took for the server to complete a request, in a decimal format measured in seconds (Example: 0.0016). This does not take into account any network latency experienced by the caller.Yes
SymbolTicker symbol for a specific securityYes
StartTimeStart date and time of range specified from input parametersYes
EndTimeEnd date and time of range specified from input parametersYes
Quotes
Returns an array of Quote instancesYes
Quote

Each instance represents a Quote

**Data-On-Demand functions as a pass through of the bid/ask information directly from the Security Information Processors (SIP). Therefore, users may see one sided quotes (0 priced asks or 0 priced bids) in the quotes data set. Please refer to the Technical FAQs, UTP Quotation Data Feed Specification and the Consolidated Quotation System Specification for more detail.**

No
MarketCenterIndicates the Market center code that originated the messageYes
BidQuantityNumber of shares available at the Market Center's bid price in a given securityYes
BidPriceThe highest price at the Market Center that someone is willing to buy a security at the given timeYes
AskQuantityNumber of shares available at the Market Center's ask price in a given securityYes
AskPriceThe lowest price at the Market Center that someone is willing to sell a security at a given timeYes
QuoteCondition Quote Condition Code(s); for more information on QuoteCondition codes, please see:
Yes
StartTimeActual start time of the QuoteYes
EndTimeActual end time of the QuoteYes

SOAP Request for SearchQuotesBySpread

Request

POST http://ws.nasdaqdod.com/v1/NASDAQAnalytics.asmx HTTP/1.1
Host: ws.nasdaqdod.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://ws.nasdaqdod.com/services/v1/SearchQuotesBySpread"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <Header xmlns="http://ws.nasdaqdod.com/services/v1/"> <Username>string</Username> <Password>string</Password> <Tracer>string</Tracer> </Header> </soap:Header> <soap:Body> <SearchQuotesBySpread xmlns="http://ws.nasdaqdod.com/services/v1/"> <Symbols>string</Symbols> <StartDateTime>string</StartDateTime> <EndDateTime>string</EndDateTime> <MarketCenters>string</MarketCenters> <Spread>double</Spread> </SearchQuotesBySpread> </soap:Body> </soap:Envelope>


Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <SearchQuotesBySpreadResponse xmlns="http://ws.nasdaqdod.com/services/v1/"> <SearchQuotesBySpreadResult> <QuoteResults> <Common> <Outcome>Success or SystemError or RequestError or RegistrationError
</Outcome> <Message>string</Message> <Identity>string</Identity> <Delay>double</Delay> </Common> <Symbol>string</Symbol> <StartTime>string</StartTime> <EndTime>string</EndTime> <Quotes> <Quote> <MarketCenter>string</MarketCenter> <BidQuantity>double</BidQuantity> <BidPrice>double</BidPrice> <AskQuantity>double</AskQuantity> <AskPrice>double</AskPrice> <QuoteCondition>string</QuoteCondition> <StartTime>string</StartTime> <EndTime>string</EndTime> </Quote> <Quote> <MarketCenter>string</MarketCenter> <BidQuantity>double</BidQuantity> <BidPrice>double</BidPrice> <AskQuantity>double</AskQuantity> <AskPrice>double</AskPrice> <QuoteCondition>string</QuoteCondition> <StartTime>string</StartTime> <EndTime>string</EndTime> </Quote> </Quotes> </QuoteResults> <QuoteResults> <Common> <Outcome>Success or SystemError or RequestError or RegistrationError
</Outcome> <Message>string</Message> <Identity>string</Identity> <Delay>double</Delay> </Common> <Symbol>string</Symbol> <StartTime>string</StartTime> <EndTime>string</EndTime> <Quotes> <Quote> <MarketCenter>string</MarketCenter> <BidQuantity>double</BidQuantity> <BidPrice>double</BidPrice> <AskQuantity>double</AskQuantity> <AskPrice>double</AskPrice> <QuoteCondition>string</QuoteCondition> <StartTime>string</StartTime> <EndTime>string</EndTime> </Quote> <Quote> <MarketCenter>string</MarketCenter> <BidQuantity>double</BidQuantity> <BidPrice>double</BidPrice> <AskQuantity>double</AskQuantity> <AskPrice>double</AskPrice> <QuoteCondition>string</QuoteCondition> <StartTime>string</StartTime> <EndTime>string</EndTime> </Quote> </Quotes> </QuoteResults> </SearchQuotesBySpreadResult> </SearchQuotesBySpreadResponse> </soap:Body> </soap:Envelope>

HttpGet Request for SearchQuotesBySpread

Request

GET http://ws.nasdaqdod.com/v1/NASDAQAnalytics.asmx/SearchQuotesBySpread?
Symbols=string&StartDateTime=string&EndDateTime=string&MarketCenters=string
&Spread=string HTTP/1.1 Host: ws.nasdaqdod.com


Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfQuoteResults xmlns="http://ws.nasdaqdod.com/services/v1/">
  <QuoteResults>
    <Common>
      <Outcome>Success or SystemError or RequestError or RegistrationError
</Outcome> <Message>string</Message> <Identity>string</Identity> <Delay>double</Delay> </Common> <Symbol>string</Symbol> <StartTime>string</StartTime> <EndTime>string</EndTime> <Quotes> <Quote> <MarketCenter>string</MarketCenter> <BidQuantity>double</BidQuantity> <BidPrice>double</BidPrice> <AskQuantity>double</AskQuantity> <AskPrice>double</AskPrice> <QuoteCondition>string</QuoteCondition> <StartTime>string</StartTime> <EndTime>string</EndTime> </Quote> <Quote> <MarketCenter>string</MarketCenter> <BidQuantity>double</BidQuantity> <BidPrice>double</BidPrice> <AskQuantity>double</AskQuantity> <AskPrice>double</AskPrice> <QuoteCondition>string</QuoteCondition> <StartTime>string</StartTime> <EndTime>string</EndTime> </Quote> </Quotes> </QuoteResults> <QuoteResults> <Common> <Outcome>Success or SystemError or RequestError or RegistrationError
</Outcome> <Message>string</Message> <Identity>string</Identity> <Delay>double</Delay> </Common> <Symbol>string</Symbol> <StartTime>string</StartTime> <EndTime>string</EndTime> <Quotes> <Quote> <MarketCenter>string</MarketCenter> <BidQuantity>double</BidQuantity> <BidPrice>double</BidPrice> <AskQuantity>double</AskQuantity> <AskPrice>double</AskPrice> <QuoteCondition>string</QuoteCondition> <StartTime>string</StartTime> <EndTime>string</EndTime> </Quote> <Quote> <MarketCenter>string</MarketCenter> <BidQuantity>double</BidQuantity> <BidPrice>double</BidPrice> <AskQuantity>double</AskQuantity> <AskPrice>double</AskPrice> <QuoteCondition>string</QuoteCondition> <StartTime>string</StartTime> <EndTime>string</EndTime> </Quote> </Quotes> </QuoteResults> </ArrayOfQuoteResults>

HttpPost Request for SearchQuotesBySpread

Request

POST http://ws.nasdaqdod.com/v1/NASDAQAnalytics.asmx/SearchQuotesBySpread HTTP/1.1
Host: ws.nasdaqdod.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

Symbols=string&StartDateTime=string&EndDateTime=string&MarketCenters=string
&Spread=string


Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfQuoteResults xmlns="http://ws.nasdaqdod.com/services/v1/">
  <QuoteResults>
    <Common>
      <Outcome>Success or SystemError or RequestError or RegistrationError
</Outcome> <Message>string</Message> <Identity>string</Identity> <Delay>double</Delay> </Common> <Symbol>string</Symbol> <StartTime>string</StartTime> <EndTime>string</EndTime> <Quotes> <Quote> <MarketCenter>string</MarketCenter> <BidQuantity>double</BidQuantity> <BidPrice>double</BidPrice> <AskQuantity>double</AskQuantity> <AskPrice>double</AskPrice> <QuoteCondition>string</QuoteCondition> <StartTime>string</StartTime> <EndTime>string</EndTime> </Quote> <Quote> <MarketCenter>string</MarketCenter> <BidQuantity>double</BidQuantity> <BidPrice>double</BidPrice> <AskQuantity>double</AskQuantity> <AskPrice>double</AskPrice> <QuoteCondition>string</QuoteCondition> <StartTime>string</StartTime> <EndTime>string</EndTime> </Quote> </Quotes> </QuoteResults> <QuoteResults> <Common> <Outcome>Success or SystemError or RequestError or RegistrationError
</Outcome> <Message>string</Message> <Identity>string</Identity> <Delay>double</Delay> </Common> <Symbol>string</Symbol> <StartTime>string</StartTime> <EndTime>string</EndTime> <Quotes> <Quote> <MarketCenter>string</MarketCenter> <BidQuantity>double</BidQuantity> <BidPrice>double</BidPrice> <AskQuantity>double</AskQuantity> <AskPrice>double</AskPrice> <QuoteCondition>string</QuoteCondition> <StartTime>string</StartTime> <EndTime>string</EndTime> </Quote> <Quote> <MarketCenter>string</MarketCenter> <BidQuantity>double</BidQuantity> <BidPrice>double</BidPrice> <AskQuantity>double</AskQuantity> <AskPrice>double</AskPrice> <QuoteCondition>string</QuoteCondition> <StartTime>string</StartTime> <EndTime>string</EndTime> </Quote> </Quotes> </QuoteResults> </ArrayOfQuoteResults>

Sample Code for SearchQuotesBySpread

ASPX/ASP.NET

<%@ Page Language="vb" %>
<%@ Import Namespace="System.Net" %>
<!-- here, NASDAQAnalytics is the name of this assembly-->
<%@ Import Namespace="NASDAQAnalytics" %>
<HTML>
<HEAD>
<script language="vb" runat="server">
' declare the return object globally so that you can reuse it around the page
Dim objQuoteResults() As QuoteResults
' call the service inside the Page_Load routine
Sub Page_Load(obj as object, e as eventargs)
' create an instance of the web service
Dim objAnalyticsService As New NASDAQAnalytics()
' add authentication info
Dim objHeader As New RemoteAnalytics.Header = new Header();
objHeader.Username = "YOUR_TOKEN" objQuoteResults.HeaderValue = objHeader

' call the operation and load the return object
objQuoteResults = objAnalyticsService.
SearchQuotesBySpread("NDAQ, GOOG", "11/9/2018 09:30:00.000", "11/9/2018 09:30:25.000", "Q, B", 1.02)
If Not objQuoteResults Is Nothing Then
Select Case objQuoteResults(0).Outcome
Case OutcomeTypes.RegistrationError
' add processing for handling subscription problems, e.g.
Response.Write("Our subscription to this service has expired.")
Case OutcomeTypes.RequestError
' add processing for handling request problems, e.g.
' you could pass back the info message received from the service
Response.Write(objQuoteResults(0).Message)
Case OutcomeTypes.SystemError
' add processing for handling system problems, e.g.
Response.Write("Service is unavailable at this time.")
End Select
Else
' add error processing here
' this condition could be caused by an HTTP error (404,500...)
Response.Write("Service is unavailable at this time.")
End If
End Sub
</script>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>
<!-- add processing for displaying the results, e.g. -->
<!-- since the return class contains an array-->
<!-- we just display its first element-->
<!-- each instance and its values can be easily accessed-->
<!-- display the value for objArrayOfQuoteResults(0).Quotes(0).EndTime-->
<!-- other values could be consumed in the same manner-->
<%Response.Write(objArrayOfQuoteResults(0).Quotes(0).EndTime)%>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>

C# (CSharp)

This code could be used in any type of application (Windows, console ...). Here, RemoteAnalytics is the web reference to the web service. Note that the default name for a web reference is generally "com.nasdaqondemand.www". You will need to rename your web reference to use to use this code.

RemoteAnalytics.NASDAQAnalytics objAnalyticsService;
objAnalyticsService = new RemoteAnalytics.NASDAQAnalytics();
// add authentication info
RemoteAnalytics.Header objHeader = new RemoteAnalytics.Header();
objHeader.Username = "YOUR_TOKEN";
objAnalyticsService.HeaderValue = objHeader;

RemoteAnalytics.QuoteResults[] objQuoteResults;
objQuoteResults = objAnalyticsService.
SearchQuotesBySpread("NDAQ, GOOG", "11/9/2018 09:30:00.000", "11/9/2018 09:30:25.000", "Q, B", 1.02);

if (objQuoteResults == null)
{
// add error processing here
// this condition could be caused by an HTTP error (404,500...)
Console.Write("Service is unavailable at this time.");
}
else
{
switch(objQuoteResults[0].Outcome)
{
case RemoteAnalytics.OutcomeTypes.Success:
// add processing for displaying the results, e.g.
// since the return class contains an array
// we just display its first element
// each instance and its values can be easily accessed
// display the value for objQuoteResults[0].Quotes[0].EndTime
// other values could be consumed in the same manner
Console.Write(objQuoteResults[0].Quotes[0].EndTime);
break;
default:
// add processing for handling request problems, e.g.
// you could pass back the info message received from the service
Console.Write(objQuoteResults[0].Message);
break;
}
}

Java/Axis

This section assumes that you have Axis installed on your machine and that you are fairly familiar with it.

Because all our web services return complex types, the best way to use Axis (Apache Axis2 1.4+) is to first generate a proxy class using the 'WSDL2Java' tool'. By default, the tool will put all generated classes into the package "com.nasdaqondemand.www.services".

You should then compile the classes (including the axis dependencies):


C:\axis>java org.apache.axis.wsdl.WSDL2Java http://ws.nasdaqdod.com/v1/NASDAQAnalytics.asmx?WSDL
C:\axis>javac com\nasdaq\*.java
C:\axis>
C:\axis>YOUR_AXIS_INSTALLATION\bin\wsdl2java.bat -ap -uri http://ws.nasdaqdod.com/v1/NASDAQAnalytics.asmx?WSDL
C:\axis>javac -classpath "YOUR_AXIS_INSTALLATION/lib/*" com/nasdaq/www/services/*.java

You can then create your source file. See below


After creating your source file, you can compile it like this:

C:\axis>javac -classpath .;"YOUR_AXIS_INSTALLATION/lib/*" NASDAQAnalyticsDemo.java

// By default, all of the classes auto-generated by the Axis2 
// "WSDL2Java" tool are placed into the package "com.nasdaqondemand.www.services"
// for our NASDAQ WSDL, so we need an import.
import com.nasdaqondemand.www.services.NASDAQAnalyticsNASDAQAnalyticsSoapStub; import com.nasdaqondemand.www.services.NASDAQAnalyticsNASDAQAnalyticsSoapStub.*;
public class NASDAQAnalyticsDemo {
public static void main(String[] args) throws Exception { // Instantiate the NASDAQAnalytics proxy
// proxy object using the Helper class.
// This class was autogenerated by the WSDL2Java tool

try { NASDAQAnalyticsNASDAQAnalyticsSoapStub stub = new NASDAQAnalyticsNASDAQAnalyticsSoapStub(); // Instantiate the return class from the operation
// This class was autogenerated by the WSDL2Java tool
SearchQuotesBySpread searchQuotesBySpreadArguments = new SearchQuotesBySpread(); searchQuotesBySpreadArguments.setSymbols("NDAQ, GOOG");
searchQuotesBySpreadArguments.setStartDateTime("11/9/2018 09:30:00.000");
searchQuotesBySpreadArguments.setEndDateTime("11/9/2018 09:30:25.000");
searchQuotesBySpreadArguments.setMarketCenters("Q, B");
searchQuotesBySpreadArguments.setSpread(1.02);
// Add authentication info
HeaderE header = new HeaderE(); Header myHeader = new Header(); myHeader.setUsername("YOUR_TOKEN"); header.setHeader(myHeader);

SearchQuotesBySpreadResponse response = stub.searchQuotesBySpread(searchQuotesBySpreadArguments, header); QuoteResults[] objQuoteResults = response.getSearchQuotesBySpreadResult().getQuoteResults(); // objQuoteResults is pointing to the result of the operation
if (objQuoteResults[0].getOutcome() == OutcomeTypes.RegistrationError) { // code to handle registration errors
System.out.println(OutcomeTypes.RegistrationError.toString() + ": " + objQuoteResults[0].getMessage()); } else if (objQuoteResults[0].getOutcome() == OutcomeTypes.RequestError) { // code to handle request errors
System.out.println(OutcomeTypes.RequestError.toString() + ": " + objQuoteResults[0].getMessage()); } else if (objQuoteResults[0].getOutcome() == OutcomeTypes.SystemError) { // code to handle system errors
System.out.println(OutcomeTypes.SystemError.toString() + ": " + objQuoteResults[0].getMessage()); } else // Success
{ for(int i = 0; i < objQuoteResults.length; i++) { System.out.println(objQuoteResults[i].getArrayOfQuoteResults().getQuotes()[0].getEndTime()); } } } catch (Exception ex) { // add exception handling code here

} } }

Perl/SoapLite

This section assumes that you have SOAP::Lite for Perl installed on your machine and that you are fairly familiar with it. But just in case your are not:

You can then use a text editor to create the source code below. You can execute it by running:


C:\perl\perl demo.pl

Note that there are some unique steps to follow to use SOAP::Lite with .Net web Services. For detailed info, check this article on MSDN.

Here is a sample source for this operation.
# the maptype instruction is critical for compatibility 
use SOAP::Lite maptype => {};
use Data::Dumper;

# this is our namespace
my $namespace = 'http://ws.nasdaqdod.com/services/v1/';

# declare the service using the namespace, the SOAP action and the uri
my $service = SOAP::Lite
-> uri($namespace)
-> on_action( sub { join '/', 'http://ws.nasdaqdod.com/services/v1', $_[1] } )
-> proxy('http://ws.nasdaqdod.com/v1/NASDAQAnalytics.asmx');

# .Net requires the method, header, and attributes to be fully qualified
my $method = SOAP::Data->name('SearchQuotesBySpread')
->attr({xmlns => $namespace});

# this section is required for authentication
# you can skip it if you use IP-based authentication
my $header = SOAP::Header->name(Header => {
Username => '<your username here>'})->uri($namespace)->prefix('');

# same here, you can omit $header if you use IP-based authentication

my @params = ( $header,
SOAP::Data->name(Symbols => "NDAQ, GOOG")->uri($namespace),
SOAP::Data->name(StartDateTime => "11/9/2018 09:30:00.000")->uri($namespace),
SOAP::Data->name(EndDateTime => "11/9/2018 09:30:25.000")->uri($namespace),
SOAP::Data->name(MarketCenters => "Q, B")->uri($namespace),
SOAP::Data->name(Spread => "1.02")->uri($namespace));
# you can now call the service
my $result = $service->call($method => @params);
if ($result->fault)
{
print $result->faultstring;
}
else
{
# here we parse the output using the main return class
# and one of its attributes
# Uncoment the line below to print the full result object graph:
# print Dumper($result);
# since the output is an array, we must loop through the returned instances
foreach my $instance ($result->valueof('//QuoteResults'))
{
print $instance->{'objArrayOfQuoteResults[0]/Quotes[0]/EndTime'}, "\n";
}
}

PHP/NuSoap

NuSoap is one of the three major SOAP implementations for PHP: PEAR::SOAP, NuSOAP, and PHP-SOAP.

If you use PHP, we recommend you use NuSoap to access our web services. NuSoap uses our web services for demonstration in their own documentation and it works well.

This section assumes that you have PHP installed on your machine and that you are fairly familiar with it. We have tested this implementation for PHP 4.2.1 on Windows 2000. It should also work with more recent versions on more recent platforms. Note that PHP 5.0 supports SOAP natively (without extension), please follow their documentation for upgrade or code changes required.

To install NuSoap, download the latest package from this location. You can unzip the package in your PHP application directory. The package includes libraries (/lib) and samples (/samples). The sample code below is based on the wsdlclient1.php sample.

If you use one of the older version or PHP (i.e. 4.2.1) , you will need to comment out one line in the /lib/nusoap.php file. That section is not supported in earlier version. The line to comment out is line 1877 as shown below.


1876 // set response timeout
1877 //socket_set_timeout( $this->fp, $response_timeout);

You can then create your source file.


<?php
// need to use the NuSoap extension
require_once('../lib/nusoap.php');

// if you access the internet through a proxy server
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';

// define the SOAP client using the url for the service
$client = new soapclient('http://ws.nasdaqdod.com/v1/NASDAQAnalytics.asmx?WSDL',
true, $proxyhost, $proxyport, $proxyusername, $proxypassword);

// assess the results
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}

// create an array of parameters
$param = array(
"Symbols" => "NDAQ, GOOG",
"StartDateTime" => "11/9/2018 09:30:00.000",
"EndDateTime" => "11/9/2018 09:30:25.000",
"MarketCenters" => "Q, B",
"Spread" => "1.02");
// call the service, passing the parameters and the name of the operation
$result = $client->call('SearchQuotesBySpread', array('parameters' => $param), '', '', false, true);
// assess the results
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
$err = $client->getError();
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
// display the results
echo '<h2>Result</h2><pre>';
// this function exposes the complete structure of the return class
print_r($result);
echo '</pre>';
}
}
// print the SOAP request
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
// print the SOAP response
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
// print the PHP debugging trace
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?>

PHP 5

PHP-SOAP is one of the three major SOAP implementations for PHP: PEAR::SOAP, NuSOAP, and PHP-SOAP.

This section assumes that you have PHP5.0 installed on your machine and that you are fairly familiar with it.

Note that PHP 5.0 supports SOAP, please follow their documentation for code changes required.

Here is a sample source for this operation.

<?php
// define the SOAP client using the url for the service
$client = new soapclient('http://ws.nasdaqdod.com/v1/NASDAQAnalytics.asmx?WSDL');
// create an array of parameters
$param = array( "Symbols" => "NDAQ, GOOG",
"StartDateTime" => "11/9/2018 09:30:00.000",
"EndDateTime" => "11/9/2018 09:30:25.000",
"MarketCenters" => "Q, B",
"Spread" => "1.02");
// add authentication info
$xignite_header = new SoapHeader('http://www.xignite.com/services/',
"Header", array("Username" => "YOUR_TOKEN"));
$client->__setSoapHeaders(array($xignite_header));

// call the service, passing the parameters and the name of the operation
$result = $client->SearchQuotesBySpread($param); // assess the results
if (is_soap_fault($result)) { echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>'; } else { echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>'; } // print the SOAP request
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->__getLastRequest(), ENT_QUOTES) . '</pre>'; // print the SOAP request Headers
echo '<h2>Request Headers</h2><pre>' . htmlspecialchars($client->__getLastRequestHeaders(), ENT_QUOTES) . '</pre>'; // print the SOAP response
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->__getLastResponse(), ENT_QUOTES) . '</pre>'; ?>

Ruby

This section assumes that you have some knowledge of the Ruby language, and in particular the SOAP library Savon version 2.

require 'rubygems'
require 'savon'
require 'pp'

url = "http://ws.nasdaqdod.com/v1/NASDAQAnalytics.asmx?WSDL"

soap_header = { "Header" => { "@xmlns" => "http://www.xignite.com/services/", "Username" => "YOUR_TOKEN" } }
client = Savon.client(wsdl: url, :soap_header => soap_header, convert_request_keys_to: :none, env_namespace: 'soap')
response = client.call(:search_quotes_by_spread, message: {
"@xmlns" => "http://www.xignite.com/services/",
Symbols: 'NDAQ, GOOG',
StartDateTime: '11/9/2018 09:30:00.000',
EndDateTime: '11/9/2018 09:30:25.000',
MarketCenters: 'Q, B',
Spread: '1.02'
})

pp response.to_hash

VB.NET

Dim objAnalyticsService As New RemoteAnalytics.NASDAQAnalytics()
Dim objHeader As New RemoteAnalytics.Header = new RemoteAnalytics.Header();
objHeader.Username = "YOUR_TOKEN" objAnalytics.HeaderValue = objHeader

Dim objQuoteResults() As RemoteAnalytics.QuoteResults _
= objAnalyticsService.SearchQuotesBySpread("NDAQ, GOOG", "11/9/2018 09:30:00.000", "11/9/2018 09:30:25.000", "Q, B", 1.02)

If Not objQuoteResults Is Nothing Then
Select Case objQuoteResults(0).Outcome
Case RemoteAnalytics.OutcomeTypes.RegistrationError
' display the error to facilitate diagnostics, e.g.
Console.WriteLine(objQuoteResults(0).Message)
Case RemoteAnalytics.OutcomeTypes.RequestError
' add processing for handling request problems, e.g.
' you could pass back the info message received from the service
Console.WriteLine(objQuoteResults(0).Message)
Case RemoteAnalytics.OutcomeTypes.SystemError
' add processing for handling system problems, e.g.
Console.WriteLine("Service is unavailable at this time.")
Case Else
' add processing for displaying the results, e.g.
' since the return class contains an array
' we just display its first element
' each instance and its values can be easily accessed
' display the value for objQuoteResults(0).Quotes(0).EndTime
' other values could be consumed in the same manner
Console.WriteLine(objQuoteResults(0).Quotes(0).EndTime)
End Select
Else
' add error processing here
' this condition could be caused by an HTTP error (404,500...)
Console.WriteLine("Service is unavailable at this time.")
End If

VB6

' this DOM object will contain the result of the call
Dim objResult As IXMLDOMSelection
' create an instance of the soap toolkit
Dim objService As New MSSOAPLib30.SoapClient30
' if your network uses a proxy server, add this line
objService.ConnectorProperty("ProxyServer") = "ip of your proxy server"
' SOAP headers are not supported in the toolkit, so we will fake it with this handler
Dim objHeader As ClientHeaderHandler
Set objHeader = New ClientHeaderHandler
' set the username and passwords to your values
objHeader.Username = "YOUR_TOKEN"
Set objService.HeaderHandler = objHeader

' point the the toolkit to the WSDL
objService.mssoapinit "http://ws.nasdaqdod.com/v1/NASDAQAnalytics.asmx?WSDL"

' load the result into the DOM object
Set objResult = objService.SearchQuotesBySpread("NDAQ, GOOG", "11/9/2018 09:30:00.000", "11/9/2018 09:30:25.000", "Q, B", 1.02)

' you can access the properties this way:
' where objResult(5).nodeName is the name of the 5th field of the instance returned
' and objResult(5).Text is the value
MsgBox objResult(5).nodeName & " = " & objResult(5).Text


' you must also add this class to your code.
' it will create the SOAP header to pass with your request
Class Module "ClientHeaderHandler"
Option Explicit
Implements IHeaderHandler

Private m_uid As String
Private m_pwd As String
Private m_tracer As String

Property Let Username(ByVal value As String)
m_uid = value
End Property

Property Let Password(ByVal value As String)
m_pwd = value
End Property

Property Let Tracer(ByVal value As String)
m_tracer = value
End Property

Private Function iHeaderHandler_ReadHeader( _
ByVal par_reader As MSSOAPLib30.ISoapReader, _
ByVal par_HeaderNode As MSXML2.IXMLDOMNode, _
ByVal par_object As Object) As Boolean
iHeaderHandler_ReadHeader = False
End Function

Private Function iHeaderhandler_willWriteHeaders() As Boolean
iHeaderhandler_willWriteHeaders = True
End Function

Private Sub iHeaderHandler_WriteHeaders( _
ByVal par_serializer As MSSOAPLib30.ISoapSerializer, _
ByVal par_object As Object)

Dim NASDAQHeaderString As String

NASDAQHeaderString = "<Header xmlns="http://ws.nasdaqdod.com/services/v1/"> " & _
"<Username>" & m_uid & "</Username>" & _
"<Password>" & m_pwd & "</Password>" & _
"<Tracer>" & m_tracer & "</Tracer>" & _
"</Header>"

par_serializer.WriteXml NASDAQHeaderString
End Sub

XSLT

When working with XSL, you only need to worry about properly dealing with namespaces.

The general principle in working with XSL is to apply the stylesheet (the XSL document) to the output of the web service (XML document). The code required to accomplish this varies based on your envirobment. For instance, using VB.Net it would be:

Dim objSOAPClient
Dim objTemplate As New System.Xml.Xsl.XslTransform()
objTemplate.Load(<url_of_XSL_template>)
objTemplate.Transform(<url_of_input_document>,<url_of_output_document>)

In the code above, you want to replace the <url_of_input_document> with the following URL.

http://ws.nasdaqdod.com/v1/NASDAQAnalytics.asmx/SearchQuotesBySpread?Symbols=NDAQ, GOOG&StartDateTime=11/9/2018 09:30:00.000&EndDateTime=11/9/2018 09:30:25.000&MarketCenters=Q, B&Spread=1.02


And this is how you could write the XSL stylesheet. Note that all node names are prefixed.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://ws.nasdaqdod.com/services/v1/"
version="1.0" exclude-result-prefixes="xi">
<xsl:template match="xi:ArrayOfQuoteResults">
<table>
<xsl:for-each select="xi:QuoteResults">
<tr>
<td>
<xsl:value-of select="xi:EndTime"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template></xsl:stylesheet>

The sample code is provided "as is" without any express or implied warranty. You are solely responsible for obtaining any necessary licenses or ownership rights, including for Xignite APIs and open source code, to use this sample code. Xignite has no obligation to test, certify, or support its use.