JSON

Standard JSON

Query: https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json?apikey="your_api_key_token"&cmd=getmsg&msgtype=OptionNbboQuote&pkey=SPX-NMS-EQT-2024-03-15-4550-C

Response:

[
  {"header":{"mTyp":"OptionNbboQuote"},"message":{"pkey":{"okey":{"at":"EQT","ts":"NMS","tk":"SPX","dt":"2024-03-15","xx":4550,"cp":"Call"}},"updateType":"PrcChange","bidPrice":288.7,"askPrice":292.2,"bidSize":52,"askSize":30,"cumBidSize":52,"cumAskSize":30,"bidExch":"CBOE","askExch":"CBOE","bidMask":4,"askMask":4,"bidTime":31904651,"askTime":31904651,"srcTimestamp":1690379504651660288,"netTimestamp":1690379504651853000}},
  {"header":{"mTyp":"QueryResult"},"message":{"numMessagesSent":1,"queryElapsed":1.4089,"result":"Ok"}}
]

in case we want to show any error response

Error: listen EADDRINUSE: address already in use :::3000

Framed JSON

SpiderRock JSON with protobuf-like header. The framing header is a fixed length (14 bytes) and in the form: \r\nJMMMMMLLLLLL, where J is the protocol [J = framed json, P = protobuf], MMMMM is the message number (zero padded), and LLLLLL is the message length (zero padded).

Query: https://mlink-live.nms.saturn.spiderrockconnect.com/rest/jsonf?apikey="your_api_key"&cmd=getmsg&msgtype=OptionNbboQuote&pkey=SPX-NMS-EQT-2024-03-15-4550-C

Response:

J02785000423{"header":{"mTyp":"OptionNbboQuote"},"message":{"pkey":{"okey":{"at":"EQT","ts":"NMS","tk":"SPX","dt":"2024-03-15","xx":4550,"cp":"Call"}},"updateType":"PrcChange","bidPrice":289.4,"askPrice":291.9,"bidSize":11,"askSize":62,"cumBidSize":11,"cumAskSize":62,"bidExch":"CBOE","askExch":"CBOE","bidMask":4,"askMask":4,"bidTime":31982946,"askTime":31982592,"srcTimestamp":1690379582946764032,"netTimestamp":1690379582946960400}}
J03445000101{"header":{"mTyp":"QueryResult"},"message":{"numMessagesSent":1,"queryElapsed":1.4177,"result":"Ok"}}

Protobuf

Google’s mechanism for serializing structured data, generally more efficient for processing higher bandwidth, lower-latency applications. See compilation notes below for usages. See above Framed JSON for header information.

Query: https://mlink-live.nms.saturn.spiderrockconnect.com/rest/proto?apikey="your_api_key"&cmd=getmsg&msgtype=OptionNbboQuote&pkey=SPX-NMS-EQT-2024-03-15-4550-C

Response:

P02745000499<OptionNbboQuote as protoBuf/binary message>
P03320000111<QueryResult as protoBuf/binary message>

Unlimited editors available under the Startup Plan

Compiling SR proto files

.proto files exist in SRMLink/proto_files

  • spiderrock_common.proto
  • All Token .proto files for SpiderRock specific messages

Both of these files need to be compiled to use protobuf with MLink.

  • To compile, first install the compiler, download the package and follow the instructions in the README.
  • Then, run the compiler, specifying your application’s source directory (the current directory is used by default), the destination directory (where you want the generated code to go), and the path to your .proto file.

For python, using python_out:

python
protoc -I=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/[File].proto

In your specified destination, this will generate N .py files:

  • spiderrock_common_pb2.py
  • “Specific message”_pb2.py