Skip to main content
Version: Upcoming

MLink REST API

The MLink REST API is implemented as a standard HTTP/RESTful service accessible at:

Query parameters are URL-encoded and passed in the querystring. If successful, responses are sent back via the HTTP request body section. The URL also determines the protocol.

You can authenticate to MLink through 2 different methods: Login or API Key. The Login method is intended for humans to access MLink via only a WebSocket connection. The API key method is intended for machines to access MLink through either a WebSocket connection or a REST API connection.

  1. Login (Rest): Use this method to authenticate your application by challenging humans to login with their SpiderRock Connect ID credentials along with multi-factor authentication (MFA).

    • The SpiderRock Client Support Desk will issue you a SpiderRock Connect ID, by which you will receive an invitation to your registered email. From there, you will complete your setup and select which MFA method you want: Authenticator App or SMS. Upon completion of sign up you will have access to MLink as determined by your configuration.

    • Session Keys: a Session Key is issued for each valid session after you login. This session key is a secret that you (usually your web browser) uses to access SpiderRock serves. Once a user authenticates with their SpiderRock Connect ID credentials their Session Key will be automatically issued and used for the remainder of the session.

  2. API Key (Rest): Use this method to authenticate your application directly to MLink if there is no ability to use MFA or you only require a single data feed.

    • API Keys are issued by the SpiderRock Client Support Desk. This process is being retired and will be moved to a process when you can request a key from the SpiderRock Connect Portal directly.

    • Using an API Key via REST: Add your API Key to the querystring as "apikey": https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json?apikey=1234-5678-9012-31415

REST Commands:

Query parameters are a set of key/value pairs (not case-sensitive):

NameParameterDescription
cmdcc="command" - the type of command, see list below
msgTypemtmt="message type" - either the string or numeric label of an SR Data Object class
pkeypkpk="primary key" - a string representation of the primary key of a specific SR Data Object instance
limitll="limit" - a number between 1 and 10,000 and acts to limit the number of messages in the response body
viewvv="view clause" - a string in the form of "field1 field2 field3"
whereww= "where clause" - a string in the form "field1:eq:value" or "(field1:ne:value1 & field1:ne:value2)
orderorder(optional) order clause eg. "(bidsize:DESC | bidexch:ASC | bidprice:DESC:ABS | askprice:ASC:ABS)" (default is unordered; default is faster)
postactionpais the action: (I)nsert, (U)pdate, (R)eplace, or (D)elete to apply to the messages in the post body. Required.
postmergepm(Yes or No) will attempt to merge the message being posted with the previous message

Commands:

CommandDescriptionParameters
getsessionkeyUses an MLink API key to get a session key
getmsgtypesreturns all available message typesview, where
getschemareturns a single message schemamsgType, view
getmsgreturns a single message by PrimaryKeymsgType, pkey, view
getmsgsreturns all available messages for a message typemsgtype, pkey, limit, view, where, order
getaggregatereturns summarized or aggregated data based on specified criteriamsgtype, group, measure
getcountreturns the count of records for a message typemsgType, where
postmsgsto post a message to MLinkpostaction, postmerge

Where Clause

"WHERE" clauses can contain the following comparison symbols:

  • :gt: is greater than
  • :ge: is greater than or equal to
  • :lt: is less than
  • :le: is less than or equal to
  • :eq: is equal
  • :ne: is not equal
  • %26 is an AND statement
  • | is an OR statement
  • :sw: is starts with
  • :ew: is ends with
  • :cv: is contains values
  • :nv: is does not contain value
  • :cb: is contained between (two dates for instance) separated by '$'

GetAggregate

"getAggregate" takes in both group and measure with a msgType:

  • Group types can be the following; examples: Numeric Quantile: { "cmd", "getaggregate" }, { "msgtype", "OptionNbboQuote" }, { "group", "bidprice:Q:9" }, { "measure", "bidprice" }

    Numeric Range: { "cmd", "getaggregate" },{ "msgtype", "OptionNbboQuote" },{ "group", "bidprice:RANGE:3" }, { "measure", "bidprice" }

    DateTimeRange: { "cmd", "getaggregate" }, { "msgtype", "OptionPrint" },{ "group", $"timestamp:TIMEHIST:3#STARTDATE#ENDDATE" },{ "measure", "prtprice" }

    String Top N: { "cmd", "getaggregate" }, { "msgtype", "OptionNbboQuote" }, { "group", "bidexch:top:3" }, { "measure", "bidprice|askprice|bidsize|asksize" }

  • You can set measureTypes in group parameters such that: { "cmd", "getaggregate" }, { "msgtype", "OptionNbboQuote" }, { "group", "bidexch:top:3:asksize:max" }, { "measure", "bidprice|askprice|bidsize|asksize"}

Note that measureTypes can be of cnt, min, max, sum, avg

Rest Examples

Obtain your session Key (first needs UserName, PassWord, and MFA):

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"cmd": "logon",
"user": "USERNAME",
"pw": "PASSWORD",
"pin":
}
}

Get all messages available:

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getmsgtypes"
}
}

Get field definitions for a message:

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getschema",
"msgtype": "OptionNbboQuote"
}
}
Filtering for an Option Key:
{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getmsgs",
"msgtype": "OptionNbboQuote",
"where": "okey:eq:SPX-NMS-EQT-2024-03-15-4550-C"
}
}

Filtering for a Ticker Key:

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getmsgs",
"msgtype": "StockBookQuote",
"where": "ticker:eq:AAPL-NMS-EQT"
}
}

or

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getmsgs",
"msgtype": "OptionNbboQuote",
"where": "okey.tk:eq:AAPL"
}
}

Filtering with a View:

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getmsgs",
"msgtype": "OptionNbboQuote",
"view": "okey|bidprice|askprice"
}
}

Complex filtering:

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getmsgs",
"msgtype": "OptionNbboQuote",
"where": "(bidsize:eq:1&asksize:eq:1)|(bidsize:eq:10&asksize:eq:1)",
"view": "okey|bidprice|askprice|asksize|bidsize"
}
}

Complex Primary Keys:

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getmsg",
"msgtype": "LiveSurfaceCurve",
"pkey": "AAPL-NMS-EQT-2023-12-01|Live"
}
}
  • Note that in this example the pkey is a repeater with en Expiry Key + SurfaceType

Simple getAggregate:

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getaggregate",
"msgtype": "OptionNbboQuote",
"measure": "bidprice|askprice|bidsize|asksize"
}
}

GetAggregate by Bid Exchange:

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getaggregate",
"msgtype": "OptionNbboQuote",
"group": "bidexch",
"measure": "bidprice|askprice|bidsize|asksize"
}
}

GetAggregate by Bid Exchange Top3:

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getaggregate",
"msgtype": "OptionNbboQuote",
"group": "bidexch:top:3",
"measure": "bidprice|askprice|bidsize|asksize"
}
}

GetAggregate by bidPrice Range:

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getaggregate",
"msgtype": "OptionNbboQuote",
"group": "bidprice:RANGE:3",
"measure": "bidprice"
}
}

GetAggregate complex:

{
"url": "https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json",
"method": "GET",
"params": {
"apikey": "your_api_key_token",
"cmd": "getaggregate",
"msgtype": "OptionPrint",
"group": "timestamp:TRANGE:3",
"measure": "prtsize",
"where": "timestamp:cb:value1$value2"
}
}