Tick History API

Overview

FactSet’s Tick History provides cost-effective access to real-time and delayed global exchange data. Proprietary technology normalizes over 200 global exchanges and 19 tick history fields. Asset types integrated include equities, futures, options, fixed income, mutual funds, ETFs, indices, commodities, and FX rates. Tick History provides dynamic access to tick data for a specific security intra-day or historically via standard HTTPS protocol. History is available for all quotes and trades for a trailing 6 months or 1-year, respectively.

API Definition

swagger_file_format

API Documentation

SDK Library

Code Snippet

Example codes for HTTP GET

All of the example codes request the LAST_1, LAST_TIME_1, and LAST_VOL_1 fields for the symbol FDS-USA at 60-minute intervals. Two programming environments are illustrated (C#/.NET and Java). Each programming language has two sections. The first section makes the HTTP GET request and the second parses the XML response. The examples have been tested and can be used as-is provided that the HTTP Basic Authorization header is modified appropriately.

import java.io.*;
import java.util.zip.*;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import javax.xml.parsers.*;
import org.xml.sax.*;
public class MyXmlParser implements ContentHandler {
public static void main(String[] args)
{
 try {
 // setup the request
 URL url = new URL(
"https://datadirect-beta.factset.com/services/TickHistory?" +
"id=FDS-USA&format=xml" +
"&date=20170914&fields=LAST_1,LAST_TIME_1,LAST_VOL_1" +
"&interval=1H&st=100000&et=130000"
 HttpsURLConnection conn = HttpsURLConnection)url.openConnection();
 conn.setDoOutput(true);
 conn.setRequestProperty("Accept-Encoding", "deflate, gzip");
 conn.setRequestProperty("Authorization",
 "Basic AaBbCcDdEeFfGgHhIi1234==");
 // getInputStream will implicitly connect and get the response
 InputStream inputStream = conn.getInputStream();
 // uncompress the response
 if (conn.getContentEncoding().equals("deflate"))
 inputStream = new InflaterInputStream(inputStream,
 new Inflater(true));
 else if (conn.getContentEncoding().equals("gzip"))
 inputStream = new GZIPInputStream(inputStream);

XMLReader reader =
 SAXParserFactory.newInstance().newSAXParser().getXMLReader();
 reader.setContentHandler(new MyXMLParser());
 reader.parse(new InputSource(inputStream));
 } catch (IOException e) {
 // Deal with IOException
 } catch (SAXException e) {
 // Deal with SAXException
 } catch (ParserConfigurationException e) {
 // Deal with ParserConfigurationException
 }
}
public void startElement(String uri, String localname, String qName,
 Attributes atts)
{
 if (qName.equals("Error"))
 System.out.println("Error code: " + atts.getValue("code")
 + ", description: " + atts.getValue("description"));
 else if (qName.equals("Records")) {
 currentReqSym = atts.getValue("req_sym");
 currentKey = atts.getValue("key");
 currentStale = atts.getValue("stale");
 }
 else if (qName.equals("Field"))
 System.out.println("req_sym: " + currentReqSym
 + ", key: " + currentKey + ", stale: " + currentStale
 + ", id: " + atts.getValue("id")
 + ", name: " + atts.getValue("name")
 + " = " + atts.getValue("value"));
}
private String currentReqSym, currentKey, currentStale;
public void characters(char [] ch, int start, int length) {}
public void endDocument() {}
public void endElement(String uri, String localname, String qName) {}
public void endPrefixMapping(String prefix) {}
public void ignorableWhitespace(char [] ch, int start, int length) {}
public void processingInstruction(String target, String data) {}
public void setDocumentLocator(Locator locator) {}
public void skippedEntity(String name) {}
public void startDocument() {}
public void startPrefixMapping(String prefix, String uri) {}
} // class MyXMLParser
​
//setting up the GET Request 

using System.IO;
using System.IO.Compression;
using System.Net;
using System.Xml;
class MyXMLParser
{
[System.STAThread]
static void Main(string [] args)
{
// setup the request
 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(
"https://datadirect-beta.factset.com/services/TickHistory?" +
"id=FDS-USA&format=xml" +
"&date=20170914&fields=LAST_1,LAST_TIME_1,LAST_VOL_1" +
"&interval=1H&st=100000&et=130000"
 req.KeepAlive = false ;
 req.Headers.Add("Accept-Encoding", "deflate, gzip");
 req.Headers.Add("Authorization", "Basic AaBbCcDdEeFfGgHhIi1234==");
 // make request and get the response
 HttpWebResponse rsp = (HttpWebResponse)req.GetResponse();
 Stream stream = rsp.GetResponseStream();
 // uncompress the response
 If (rsp.ContentEncoding.Equals("deflate"))
 stream = new DeflateStream(stream, CompressionMode.Decompress);
 else if (rsp.ContentEncoding.Equals("gzip"))
 stream = new GZipStream(stream, CompressionMode.Decompress);
 .
 .
 .
//parsing the reponse

XmlTextReader reader = new XmlTextReader(stream);
reader.WhitespaceHandling = WhitespaceHandling.None;
 while (reader.Read())
 {
 if (reader.NodeType.Equals(XmlNodeType.Element))
 {
 if (reader.Name.Equals(“Error”))
 {
 System.Console.WriteLine(reader.Name);
 printAttributes(reader);
 System.Console.WriteLine();
 }
 else if (reader.Name.Equals(“Records”))
 {
 System.Console.WriteLine(reader.Name);
 printAttributes(reader);
 }
 else if (reader.Name.Equals(“Record”))
 {
 System.Console.WriteLine(reader.Name);

 // Move to first Field element
 while (reader.Read() && !reader.Name.Equals("Field"))
 { }

 // Print out all field ids, names and values
 do
 {
 printAttributes(reader);
 } while (reader.Read() && reader.Name.Equals("Field"));
 System.Console.WriteLine();
 }
 }
 }
}
static void printAttributes(XmlTextReader reader)
{
while (reader.MoveToNextAttribute())
 System.Console.Write(reader.Name + ": " + reader.Value + ", ");
System.Console.WriteLine();
}
} // class MyXmlParser

​

 

Example codes for HTTP GET

All of the example codes request the LAST_1, LAST_TIME_1, and LAST_VOL_1 fields for the symbol FDS-USA at 60-minute intervals. Two programming environments are illustrated (C#/.NET and Java). Each programming language has two sections. The first section makes the HTTP GET request and the second parses the XML response. The examples have been tested and can be used as-is provided that the HTTP Basic Authorization header is modified appropriately.

import java.io.*;
import java.util.zip.*;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import javax.xml.parsers.*;
import org.xml.sax.*;
public class MyXmlParser implements ContentHandler {
public static void main(String[] args)
{
 try {
 // setup the request
 URL url = new URL(
"https://datadirect-beta.factset.com/services/TickHistory?" +
"id=FDS-USA&format=xml" +
"&date=20170914&fields=LAST_1,LAST_TIME_1,LAST_VOL_1" +
"&interval=1H&st=100000&et=130000"
 HttpsURLConnection conn = HttpsURLConnection)url.openConnection();
 conn.setDoOutput(true);
 conn.setRequestProperty("Accept-Encoding", "deflate, gzip");
 conn.setRequestProperty("Authorization",
 "Basic AaBbCcDdEeFfGgHhIi1234==");
 // getInputStream will implicitly connect and get the response
 InputStream inputStream = conn.getInputStream();
 // uncompress the response
 if (conn.getContentEncoding().equals("deflate"))
 inputStream = new InflaterInputStream(inputStream,
 new Inflater(true));
 else if (conn.getContentEncoding().equals("gzip"))
 inputStream = new GZIPInputStream(inputStream);

XMLReader reader =
 SAXParserFactory.newInstance().newSAXParser().getXMLReader();
 reader.setContentHandler(new MyXMLParser());
 reader.parse(new InputSource(inputStream));
 } catch (IOException e) {
 // Deal with IOException
 } catch (SAXException e) {
 // Deal with SAXException
 } catch (ParserConfigurationException e) {
 // Deal with ParserConfigurationException
 }
}
public void startElement(String uri, String localname, String qName,
 Attributes atts)
{
 if (qName.equals("Error"))
 System.out.println("Error code: " + atts.getValue("code")
 + ", description: " + atts.getValue("description"));
 else if (qName.equals("Records")) {
 currentReqSym = atts.getValue("req_sym");
 currentKey = atts.getValue("key");
 currentStale = atts.getValue("stale");
 }
 else if (qName.equals("Field"))
 System.out.println("req_sym: " + currentReqSym
 + ", key: " + currentKey + ", stale: " + currentStale
 + ", id: " + atts.getValue("id")
 + ", name: " + atts.getValue("name")
 + " = " + atts.getValue("value"));
}
private String currentReqSym, currentKey, currentStale;
public void characters(char [] ch, int start, int length) {}
public void endDocument() {}
public void endElement(String uri, String localname, String qName) {}
public void endPrefixMapping(String prefix) {}
public void ignorableWhitespace(char [] ch, int start, int length) {}
public void processingInstruction(String target, String data) {}
public void setDocumentLocator(Locator locator) {}
public void skippedEntity(String name) {}
public void startDocument() {}
public void startPrefixMapping(String prefix, String uri) {}
} // class MyXMLParser
​
//setting up the GET Request 

using System.IO;
using System.IO.Compression;
using System.Net;
using System.Xml;
class MyXMLParser
{
[System.STAThread]
static void Main(string [] args)
{
// setup the request
 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(
"https://datadirect-beta.factset.com/services/TickHistory?" +
"id=FDS-USA&format=xml" +
"&date=20170914&fields=LAST_1,LAST_TIME_1,LAST_VOL_1" +
"&interval=1H&st=100000&et=130000"
 req.KeepAlive = false ;
 req.Headers.Add("Accept-Encoding", "deflate, gzip");
 req.Headers.Add("Authorization", "Basic AaBbCcDdEeFfGgHhIi1234==");
 // make request and get the response
 HttpWebResponse rsp = (HttpWebResponse)req.GetResponse();
 Stream stream = rsp.GetResponseStream();
 // uncompress the response
 If (rsp.ContentEncoding.Equals("deflate"))
 stream = new DeflateStream(stream, CompressionMode.Decompress);
 else if (rsp.ContentEncoding.Equals("gzip"))
 stream = new GZipStream(stream, CompressionMode.Decompress);
 .
 .
 .
//parsing the reponse

XmlTextReader reader = new XmlTextReader(stream);
reader.WhitespaceHandling = WhitespaceHandling.None;
 while (reader.Read())
 {
 if (reader.NodeType.Equals(XmlNodeType.Element))
 {
 if (reader.Name.Equals(“Error”))
 {
 System.Console.WriteLine(reader.Name);
 printAttributes(reader);
 System.Console.WriteLine();
 }
 else if (reader.Name.Equals(“Records”))
 {
 System.Console.WriteLine(reader.Name);
 printAttributes(reader);
 }
 else if (reader.Name.Equals(“Record”))
 {
 System.Console.WriteLine(reader.Name);

 // Move to first Field element
 while (reader.Read() && !reader.Name.Equals("Field"))
 { }

 // Print out all field ids, names and values
 do
 {
 printAttributes(reader);
 } while (reader.Read() && reader.Name.Equals("Field"));
 System.Console.WriteLine();
 }
 }
 }
}
static void printAttributes(XmlTextReader reader)
{
while (reader.MoveToNextAttribute())
 System.Console.Write(reader.Name + ": " + reader.Value + ", ");
System.Console.WriteLine();
}
} // class MyXmlParser

​

 

Example codes for HTTP GET

All of the example codes request the LAST_1, LAST_TIME_1, and LAST_VOL_1 fields for the symbol FDS-USA at 60-minute intervals. Two programming environments are illustrated (C#/.NET and Java). Each programming language has two sections. The first section makes the HTTP GET request and the second parses the XML response. The examples have been tested and can be used as-is provided that the HTTP Basic Authorization header is modified appropriately.

import java.io.*;
import java.util.zip.*;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import javax.xml.parsers.*;
import org.xml.sax.*;
public class MyXmlParser implements ContentHandler {
public static void main(String[] args)
{
 try {
 // setup the request
 URL url = new URL(
"https://datadirect-beta.factset.com/services/TickHistory?" +
"id=FDS-USA&format=xml" +
"&date=20170914&fields=LAST_1,LAST_TIME_1,LAST_VOL_1" +
"&interval=1H&st=100000&et=130000"
 HttpsURLConnection conn = HttpsURLConnection)url.openConnection();
 conn.setDoOutput(true);
 conn.setRequestProperty("Accept-Encoding", "deflate, gzip");
 conn.setRequestProperty("Authorization",
 "Basic AaBbCcDdEeFfGgHhIi1234==");
 // getInputStream will implicitly connect and get the response
 InputStream inputStream = conn.getInputStream();
 // uncompress the response
 if (conn.getContentEncoding().equals("deflate"))
 inputStream = new InflaterInputStream(inputStream,
 new Inflater(true));
 else if (conn.getContentEncoding().equals("gzip"))
 inputStream = new GZIPInputStream(inputStream);

XMLReader reader =
 SAXParserFactory.newInstance().newSAXParser().getXMLReader();
 reader.setContentHandler(new MyXMLParser());
 reader.parse(new InputSource(inputStream));
 } catch (IOException e) {
 // Deal with IOException
 } catch (SAXException e) {
 // Deal with SAXException
 } catch (ParserConfigurationException e) {
 // Deal with ParserConfigurationException
 }
}
public void startElement(String uri, String localname, String qName,
 Attributes atts)
{
 if (qName.equals("Error"))
 System.out.println("Error code: " + atts.getValue("code")
 + ", description: " + atts.getValue("description"));
 else if (qName.equals("Records")) {
 currentReqSym = atts.getValue("req_sym");
 currentKey = atts.getValue("key");
 currentStale = atts.getValue("stale");
 }
 else if (qName.equals("Field"))
 System.out.println("req_sym: " + currentReqSym
 + ", key: " + currentKey + ", stale: " + currentStale
 + ", id: " + atts.getValue("id")
 + ", name: " + atts.getValue("name")
 + " = " + atts.getValue("value"));
}
private String currentReqSym, currentKey, currentStale;
public void characters(char [] ch, int start, int length) {}
public void endDocument() {}
public void endElement(String uri, String localname, String qName) {}
public void endPrefixMapping(String prefix) {}
public void ignorableWhitespace(char [] ch, int start, int length) {}
public void processingInstruction(String target, String data) {}
public void setDocumentLocator(Locator locator) {}
public void skippedEntity(String name) {}
public void startDocument() {}
public void startPrefixMapping(String prefix, String uri) {}
} // class MyXMLParser
​
//setting up the GET Request 

using System.IO;
using System.IO.Compression;
using System.Net;
using System.Xml;
class MyXMLParser
{
[System.STAThread]
static void Main(string [] args)
{
// setup the request
 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(
"https://datadirect-beta.factset.com/services/TickHistory?" +
"id=FDS-USA&format=xml" +
"&date=20170914&fields=LAST_1,LAST_TIME_1,LAST_VOL_1" +
"&interval=1H&st=100000&et=130000"
 req.KeepAlive = false ;
 req.Headers.Add("Accept-Encoding", "deflate, gzip");
 req.Headers.Add("Authorization", "Basic AaBbCcDdEeFfGgHhIi1234==");
 // make request and get the response
 HttpWebResponse rsp = (HttpWebResponse)req.GetResponse();
 Stream stream = rsp.GetResponseStream();
 // uncompress the response
 If (rsp.ContentEncoding.Equals("deflate"))
 stream = new DeflateStream(stream, CompressionMode.Decompress);
 else if (rsp.ContentEncoding.Equals("gzip"))
 stream = new GZipStream(stream, CompressionMode.Decompress);
 .
 .
 .
//parsing the reponse

XmlTextReader reader = new XmlTextReader(stream);
reader.WhitespaceHandling = WhitespaceHandling.None;
 while (reader.Read())
 {
 if (reader.NodeType.Equals(XmlNodeType.Element))
 {
 if (reader.Name.Equals(“Error”))
 {
 System.Console.WriteLine(reader.Name);
 printAttributes(reader);
 System.Console.WriteLine();
 }
 else if (reader.Name.Equals(“Records”))
 {
 System.Console.WriteLine(reader.Name);
 printAttributes(reader);
 }
 else if (reader.Name.Equals(“Record”))
 {
 System.Console.WriteLine(reader.Name);

 // Move to first Field element
 while (reader.Read() && !reader.Name.Equals("Field"))
 { }

 // Print out all field ids, names and values
 do
 {
 printAttributes(reader);
 } while (reader.Read() && reader.Name.Equals("Field"));
 System.Console.WriteLine();
 }
 }
 }
}
static void printAttributes(XmlTextReader reader)
{
while (reader.MoveToNextAttribute())
 System.Console.Write(reader.Name + ": " + reader.Value + ", ");
System.Console.WriteLine();
}
} // class MyXmlParser

​

 

Change Logs