As part of its custom web hosting business, Markit On Demand, Inc sometimes provides web service APIs for it clients to use. The details of each service vary depending on the needs of each client and project, but they generally follow a similar format. The services can return data in either XML or JSON format, with an optional JSON-P wrapper. The data returned will be the same regardless of the format requested.
The following is a list of the service methods provided by this API.
Markit On Demand web services typically follow the "REST" model for web services. In simple terms, REST is a formal description of the HTTP protocol. Accessing a "REST" web service, therefore is merely a matter of making a standard HTTP request to a defined resource.
In some cases a SOAP Web Service API will be provided in addition to or instead of the REST API. In these cases, this document may not exactly reflect the method names and parameters expected by the SOAP API. In case of a discrepancy, please refer to the supplied WSDL file for the correct interface.
Except where otherwise specified, all of the web services described in this document are accessed by an HTTP GET request. HTTP POST requests are reserved for methods that change data on the server, e.g. updating a user's profile. Each request consists of a URI, and a list of parameters. The URI consists of a hostname and base path, a method name, and an optional format specifier. The parameters are appended to the URI on the query string.
Below is a sample request to a web service named "SampleRequest" in XML format.
The "/xml" format specifier in the above request could be safely omitted, as XML is the default format. Other formats supported at the current time are JSON ("JavaScript Object Notation"), and JSONP. JSONP requests all require an additional parameter, named "jsoncallback". A sample response to the request shown above has the following type:
| Field | Type | Description |
|---|---|---|
| Echo | String | |
| SampleList | SampleItem[] |
| Field | Type | Description |
|---|---|---|
| ItemNumber | Int32 |
The XML response format consists of a sequence of elements representing Type names and Property names. Type names are used for the root node, and to identify individual items in a collection. An example XML representation of the SampleResponse object is shown below:
<SampleResponse>
<Echo>example</Echo>
<SampleList>
<SampleItem>
<ItemNumber>1</ItemNumber>
</SampleItem>
<SampleItem>
<ItemNumber>2</ItemNumber>
</SampleItem>
<SampleItem>
<ItemNumber>3</ItemNumber>
</SampleItem>
</SampleList>
</SampleResponse>
The JSON response format does not include type information. A description of the JSON format can be found at http://json.org. It will not be described in this document. A sample JSON response is shown below (with white space added for readability):
{
"Echo": "example",
"SampleList": [
{ "ItemNumber": 1 },
{ "ItemNumber": 2 },
{ "ItemNumber": 3 }
]
}
The JSONP response format is similar, with the addition of a callback method name.
mySampleCallbackName({
"Echo": "example",
"SampleList": [
{ "ItemNumber": 1 },
{ "ItemNumber": 2 },
{ "ItemNumber": 3 }
]
})
Some API Methods require a User ID, whether to retrieve user specific information (e.g. Portfolio, Watchlist), or for permissions or accounting purposes (e.g. Real Time Quotes). These methods are denoted by an input of user_id, and optionally user_password or user_tier. Depending on the hosting arrangements and usage of the API, these parameters may need to be encrypted. If encryption is required, you will be supplied with an encryption spec document, sample code, and an encryption key from Markit On Demand.
This section describes the API functions available through the API, their input and output parameters, and the possible errors. A "?" indicates a value is optional (for the request) or may be null (in the response). A "[ ]" indicates that the value is an array containing 0 or more instances of the specified type.
The Lookup method requires the following input parameters
| Field | Type | Description |
|---|---|---|
| input | String | A part of a company name or company symbol. The API will attempt to match a symbol, a partial symbol, and a partial name, in that order. The input string must be at the beginning of the symbol or one of the words in the name. |
When successful, the Lookup method returns a serialized array of LookupResult objects.
| Field | Type | Description |
|---|---|---|
| Symbol | String | The Symbol for this security in the ExchangeSymbol symbol set. |
| Name | String | The Name of the security. |
| Exchange | String | The Exchange code that the security trades on. |
If an error occurs, the Lookup method returns a serialized Error object.
| Field | Type | Description |
|---|---|---|
| Message | String | If the inputs are not valid, the Message will contain a description of why the request could not proceed. |
The Quote method requires the following input parameters
| Field | Type | Description |
|---|---|---|
| symbol | String | Ticker symbol |
When successful, the Quote method returns a serialized StockQuote object.
| Field | Type | Description |
|---|---|---|
| Status | String | Status of quote request |
| Name | String | Name of the company |
| Symbol | String | The company's ticker symbol |
| LastPrice | Double | The last price of the company's stock |
| Change | Double | The change in price of the company's stock since the previous trading day's close |
| ChangePercent | Double | The change percent in price of the company's stock since the previous trading day's close |
| Timestamp | String | The last time the company's stock was traded. Represented as a JavaScript date |
| MarketCap | Double | The company's market cap |
| Volume | Int32 | The trade volume of the company's stock |
| ChangeYTD | Double | The change in price of the company's stock since the start of the year |
| ChangePercentYTD | Double | The change percent in price of the company's stock since the start of the year |
| High | Double | The high price of the company's stock in the trading session |
| Low | Double | The low price of the company's stock in the trading session |
| Open | Double | The opening price of the company's stock at the start of the trading session |
If an error occurs, the Quote method returns a serialized Error object.
| Field | Type | Description |
|---|---|---|
| Message | String | If the inputs are not valid, the Message will contain a description of why the request could not proceed. |
The Timeseries method requires the following input parameters
| Field | Type | Description |
|---|---|---|
| symbol | String | Ticker symbol |
| duration | Int32? | Duration of timeseries in number of days. Defaults to 365 and cannot be less than 10 (this is a historical timeseries) |
When successful, the Timeseries method returns a serialized Timeseries object.
| Field | Type | Description |
|---|---|---|
| Name | String | Name of the company |
| Symbol | String | The company's ticker symbol |
| Series | Object | Timeseries of open, high, low, close data (OHLC) represented in JSON |
| SeriesLabels | Object | Timeseries labels in JSON |
| SeriesLabelCoordinates | Object | Timeseries label X/Y coordinates in JSON |
| SeriesDuration | Int32 | Duration of chart history |
| SeriesDates | List`1 | Timeseries dates (one for each price value). Represented as a JavaScript date |
If an error occurs, the Timeseries method returns a serialized Error object.
| Field | Type | Description |
|---|---|---|
| Message | String | If the inputs are not valid, the Message will contain a description of why the request could not proceed. |
The Interactive method requires the following input parameters
| Field | Type | Description |
|---|---|---|
| parameters | String | A JSON encoded InteractiveChartDataInput object |
| realtime | Boolean? |
| Field | Type | Description |
|---|---|---|
| Normalized | Boolean | Show data in price units (false) or percentages (true) |
| StartDate | String | Start date timestamp (formatted like 2011-03-01T00:00:00-00). Only valid for interday requests. |
| EndDate | String | End date timestamp (formatted like 2011-06-01T00:00:00-00). Only valid for interday requests. |
| EndOffsetDays | Int32 | Number of days back that chart should end. Defaults to 0 if not specified. May be used instead of EndDate for interday requests. |
| NumberOfDays | Int32 | Number of days that should be shown on the chart. Required for intraday requests. May be used instead of StartDate for interday requests. When dealing with intraday data, NumberOfDays represents the number of trading days shown. When dealing with interday requests, it represents the number of calendar days. |
| DataPeriod | TimePeriod | Minute, Hour, Day, Week, Month, Quarter, Year |
| DataInterval | Int32? | For intraday data, specifies the number of periods between data points. e.g. if DataPeriod is Minute and DataInterval is 5, you will get a chart with five minute intervals. Must be 0 or null for interday charts |
| LabelPeriod | TimePeriod | Minute, Hour, Day, Week, Month, Quarter, Year |
| LabelInterval | Int32? | How many LabelPeriods to skip between labels. 1 is usually a safe default. |
| ExtraPoints | Int32 | A number indicating the maximum number of additional price points in order for all indicators to have enough "warm up" data. For instance, if you request a 30-day simple moving average and a 200-day moving average, you'll need to set ExtraPoints to 200 (assuming you're requesting daily data) |
| Elements | Element[] | An Array of 1 or more Elements. |
| RealTime | Boolean | RealTime request "true" or "false" |
| Field | Type | Description |
|---|---|---|
| Symbol | String | Symbol |
| Type | ElementType | Type of data requested. Options are "bollinger" (Bollinger Bands), "ema" (Exponential Moving Average), "macd" (Moving Average Convergence/Divergence), "price", "sma" (Simple Moving Average), "tsf" (Time Series Forecast), "volume", "revenues", "dividends", "splits", "earnings". |
| Params | Object[] | Params vary for each Type. The following Types accept Params. For the other types, Params should be null or an empty array. "bollinger": [period, standard deviations], "ema": [period], "macd": [fast, slow, smoothing], "price": ["ohlc"] for open/high/low/close, ["c"] for close only, "sma": [period], "tsf": [period], "earnings": ["includeExtraordinary"] to include extraordinary items such as expenses due to natural disasters, etc. null to exclude extraordinary items. |
When successful, the Interactive method returns a serialized InteractiveChartData object.
| Field | Type | Description |
|---|---|---|
| Labels | Object | X Axis label position, text, and dates. The "dates" are in Microsoft "OA Date" format. The "text" is an ISO timestamp. |
| Positions | Object | List of X coordinate positions for each data point returned, between 0 and 1. |
| Dates | Object | Dates in "OA Date" format corresponding to each position. |
| Elements | ElementData[] | Chart coordinates and other data for each Element specified in the input "Elements" array. |
| Field | Type | Description |
|---|---|---|
| Currency | String | |
| TimeStamp | DateTime? | |
| Symbol | String | |
| Type | ElementType | |
| DataSeries | Object | Y Axis Values of the specified Element, corresponding with the X Axis coordinates in the list of "Positions". |
The Interactive method does not define any error conditions.
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="SampleResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Echo" type="xsd:string" />
<xsd:element name="SampleList">
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="SampleItem">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ItemNumber" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="LookupResult">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Symbol" type="xsd:string" />
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="Exchange" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Error">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Message" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="StockQuote">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Status" type="xsd:string" />
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="Symbol" type="xsd:string" />
<xsd:element name="LastPrice" type="xsd:double" />
<xsd:element name="Change" type="xsd:double" />
<xsd:element name="ChangePercent" type="xsd:double" />
<xsd:element name="Timestamp" type="xsd:string" />
<xsd:element name="MarketCap" type="xsd:double" />
<xsd:element name="Volume" type="xsd:int" />
<xsd:element name="ChangeYTD" type="xsd:double" />
<xsd:element name="ChangePercentYTD" type="xsd:double" />
<xsd:element name="High" type="xsd:double" />
<xsd:element name="Low" type="xsd:double" />
<xsd:element name="Open" type="xsd:double" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Timeseries">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="Symbol" type="xsd:string" />
<xsd:element name="Series">
<xsd:complexType>
<xsd:sequence />
</xsd:complexType>
</xsd:element>
<xsd:element name="SeriesLabels">
<xsd:complexType>
<xsd:sequence />
</xsd:complexType>
</xsd:element>
<xsd:element name="SeriesLabelCoordinates">
<xsd:complexType>
<xsd:sequence />
</xsd:complexType>
</xsd:element>
<xsd:element name="SeriesDuration" type="xsd:int" />
<xsd:element name="SeriesDates">
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="String" type="xsd:string" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="InteractiveChartDataInput">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Normalized" type="xsd:boolean" />
<xsd:element name="StartDate" type="xsd:string" />
<xsd:element name="EndDate" type="xsd:string" />
<xsd:element name="EndOffsetDays" type="xsd:int" />
<xsd:element name="NumberOfDays" type="xsd:int" />
<xsd:element name="DataPeriod" type="xsd:string" />
<xsd:element name="DataInterval" type="xsd:int" nillable="true" />
<xsd:element name="LabelPeriod" type="xsd:string" />
<xsd:element name="LabelInterval" type="xsd:int" nillable="true" />
<xsd:element name="ExtraPoints" type="xsd:int" />
<xsd:element name="Elements">
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="Element">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Symbol" type="xsd:string" />
<xsd:element name="Type" type="xsd:string" />
<xsd:element name="Params">
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="Object">
<xsd:complexType>
<xsd:sequence />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="RealTime" type="xsd:boolean" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="InteractiveChartData">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Labels">
<xsd:complexType>
<xsd:sequence />
</xsd:complexType>
</xsd:element>
<xsd:element name="Positions">
<xsd:complexType>
<xsd:sequence />
</xsd:complexType>
</xsd:element>
<xsd:element name="Dates">
<xsd:complexType>
<xsd:sequence />
</xsd:complexType>
</xsd:element>
<xsd:element name="Elements">
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="ElementData">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Currency" type="xsd:string" />
<xsd:element name="TimeStamp" type="xsd:dateTime" nillable="true" />
<xsd:element name="Symbol" type="xsd:string" />
<xsd:element name="Type" type="xsd:string" />
<xsd:element name="DataSeries">
<xsd:complexType>
<xsd:sequence />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>