Skip to main content
Version: 8.5.11.1

Schema: GetFlexSpreadPrice (ID: 3488)

METADATA

AttributeValue
Topic3480-mlink-custom
MLink TokenRiskCalc

Note: The symbol = next to a field number indicates that it is a primary key.

BODY

#FieldTypeDefault ValueComment
100uPrcdouble0live uPrc on arrival (if not supplied)
101fixedPremUPctdouble0premium as a percent of the underlying price. required if a leg with strikeType=PctVariable is included (can be zero).
102incGreeksenum : YesNoNowhether greeks should be computed
125tickerTickerKeyunderlier ticker (all legs must have the same underlier ticker)
126sprdPremdoublespread premium ($)
127sprdDeltafloatdelta
128sprdGammafloatgamma
129sprdThetafloattheta
130sprdVegafloatvega
131sprdVolgafloatvolga
132sprdVannafloatvanna
133sprdRhofloatrho
134sprdPhifloatphi
138calcDetailtext1calculation details
139errortext1overall error for the calculation
140timestampDateTime

REPEATING FIELDS

Legs

#FieldTypeDefault ValueComment
104okeyOptionKeyshould be in OSI root format; strike can be zero for the variable strike leg
105sideenum : BuySell
106ratioshort1leg ratio
107strikeTypeenum : StrikeTypeDollarAmt, Percent or PctVariable (exactly one leg can be PctVariable)
108flexTypeOutenum : FlexTypereflects the type of flex decoded from the okey root
109vYearsOutdoublevolatility years to expiry
110dYearsOutdoublecalendar days to expiry / 365.0
111sdivOutdoublecontinuous stock dividend used for pricing
112rateOutdoublediscount rate used for pricing
113effStrikeOutdoubleeffective strike ($); will be the implied surface strike if strikeType=PctVariable
114sVolOutdoubleleg surface volatility
115sPrcOutdoubleleg surface price
116deltaOutfloatdelta
117gammaOutfloatgamma
118thetaOutfloattheta
119vegaOutfloatvega
120volgaOutfloatvolga
121vannaOutfloatvanna
122rhoOutfloatrho
123phiOutfloatphi
124errorOutstring(32)leg error (if any)

DiscreteDividend

#FieldTypeDefault ValueComment
136dateDateTime
137amountfloat

Get Schema API Call

import requests 

# Replace with your desired MLINK URL
MLINK_PROD_URL = 'https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json'

# Replace with your MLINK API Key
API_KEY = 'XXXX-XXXX-XXXX-XXXX'

# Replace with your desired MsgType.
MSG_TYPE = 'GetFlexSpreadPrice'

# Request Parameters for Get Schema Of The MsgType
params = {
# Required Parameters
"apiKey": API_KEY,
"cmd": 'getschema',
"msgType": MSG_TYPE,
}

response = requests.get(MLINK_PROD_URL, params=params)

Get Msg API Call

import requests 

# Replace with your desired MLINK URL
MLINK_PROD_URL = 'https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json'

# Replace with your MLINK API Key
API_KEY = 'XXXX-XXXX-XXXX-XXXX'

# Replace with your desired MsgType.
MSG_TYPE = 'GetFlexSpreadPrice'

# Replace with your pkey value for getting the specific message desired
PKEY = 'ReplaceThisValueForTheQueryToWork'

# Replace with your desired view. A "|" separated list of views can be provided
# If no view is provided, all views will be returned.
VIEW = 'uPrc|fixedPremUPct|incGreeks|ticker|sprdPrem|sprdDelta|sprdGamma|sprdTheta|sprdVega|sprdVolga|sprdVanna|sprdRho|sprdPhi|calcDetail|error|timestamp'

# Replace with your desired where clause.
# a string in the form "field1:eq:valuse" or "(field1:ne:value1 & field1:ne:value2)
# "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 '$'
WHERE = ''

# Request Parameters for getmsg Of The MsgType
params = {
# Required Parameters
"apiKey": API_KEY,
"cmd": 'getmsg',
"pkey": PKEY,
"msgType": MSG_TYPE,
# Optional Parameters
"view": VIEW,
"where": WHERE
}

response = requests.get(MLINK_PROD_URL, params=params)

Get Msgs API Call

import requests 

# Replace with your desired MLINK URL
MLINK_PROD_URL = 'https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json'

# Replace with your MLINK API Key
API_KEY = 'XXXX-XXXX-XXXX-XXXX'

# Replace with your desired MsgType.
MSG_TYPE = 'GetFlexSpreadPrice'

# Replace with your desired view. A "|" separated list of views can be provided
# If no view is provided, all views will be returned
VIEW = 'uPrc|fixedPremUPct|incGreeks|ticker|sprdPrem|sprdDelta|sprdGamma|sprdTheta|sprdVega|sprdVolga|sprdVanna|sprdRho|sprdPhi|calcDetail|error|timestamp'

# Replace with your desired where clause.
# a string in the form "field1:eq:value" or "(field1:ne:value1 & field1:ne:value2)
# "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 '$'
WHERE = ''

# Replace with your desired limit of how many messages you receive. The default limit is 500
LIMIT = 500

# Order clause eg. "(field1:DESC | field1:ASC | field2:DESC:ABS | field2:ASC:ABS" (default is unordered; default is faster)
ORDER = 'uPrc:ASC'

# Request Parameters for getmsgs Of The MsgType
params = {
# Required Parameters
"apiKey": API_KEY,
"cmd": 'getmsgs',
"msgType": MSG_TYPE,
# Optional Parameters
"view": VIEW,
"where": WHERE,
"limit": LIMIT,
"order": ORDER
}

response = requests.get(MLINK_PROD_URL, params=params)

Get Aggregate API Call

import requests 

# Replace with your desired MLINK URL
MLINK_PROD_URL = 'https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json'

# Replace with your MLINK API Key
API_KEY = 'XXXX-XXXX-XXXX-XXXX'

# Replace with your desired MsgType.
MSG_TYPE = 'GetFlexSpreadPrice'

# Replace with fields you want to see aggregate values for. A "|" separated list of measures should be provided
MEASURE = 'uPrc|fixedPremUPct|incGreeks|ticker|sprdPrem|sprdDelta|sprdGamma|sprdTheta|sprdVega|sprdVolga|sprdVanna|sprdRho|sprdPhi|calcDetail|error|timestamp'

# Replace with fields you want to see aggregated. A "|" separated list of fields should be provided
GROUP = 'incGreeks'

# Replace with your desired where clause.
# a string in the form "field1:eq:value" or "(field1:ne:value1 & field1:ne:value2)
# "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 '$'
WHERE = ''

# Request Parameters for getaggregate Of The MsgType
params = {
# Required Parameters
"apiKey": API_KEY,
"cmd": 'getaggregate',
"msgType": MSG_TYPE,
"measure": MEASURE,
"group": GROUP,
# Optional Parameters
"where": WHERE,
}

response = requests.get(MLINK_PROD_URL, params=params)

Get Count API Call

import requests 

# Replace with your desired MLINK URL
MLINK_PROD_URL = 'https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json'

# Replace with your MLINK API Key
API_KEY = 'XXXX-XXXX-XXXX-XXXX'

# Replace with your desired MsgType.
MSG_TYPE = 'GetFlexSpreadPrice'

# Replace with your desired where clause.
# a string in the form "field1:eq:value" or "(field1:ne:value1 & field1:ne:value2)
# "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 '$'
WHERE = ''

# Request Parameters for getCount Of The MsgType
params = {
# Required Parameters
"apiKey": API_KEY,
"cmd": 'getcount',
"msgType": MSG_TYPE,
# Optional Parameters
"where": WHERE,
}

response = requests.get(MLINK_PROD_URL, params=params)

Post Msgs API Call

import requests

# Replace with your desired MLINK URL
MLINK_PROD_URL = 'https://mlink-live.nms.saturn.spiderrockconnect.com/rest/json'

# Replace with your MLINK API Key
API_KEY = 'XXXX-XXXX-XXXX-XXXX'

# Request Parameters
params = {
# Required Parameters
"apiKey": API_KEY,
"cmd": 'postmsgs',
"postaction": "I", # (I)nsert, or (R)eplace
"postmerge": "Y", # (Y)es or (N)o
}

payload = {
"header": {
"mTyp": "GetFlexSpreadPrice"
},
"message": {
"uPrc": 0, // double. Default=0
"fixedPremUPct": 0, // double. Default=0
"incGreeks": "No", // enum(YesNo) - None, Yes, No. Default=No
"ticker": {
"at": "EQT",
"ts": "NMS",
"tk": "AAPL"
},
"sprdPrem": 1.0, // double
"sprdDelta": 1.0, // float
"sprdGamma": 1.0, // float
"sprdTheta": 1.0, // float
"sprdVega": 1.0, // float
"sprdVolga": 1.0, // float
"sprdVanna": 1.0, // float
"sprdRho": 1.0, // float
"sprdPhi": 1.0, // float
"calcDetail": "exampleString", // text1
"error": "exampleString", // text1
"timestamp": "2025-01-01 12:00:00.000000", // yyyy-MM-dd HH:mm:ss.SSSSSS
"Legs": [ // Repeating Field
{
"okey": {
"at": "EQT",
"ts": "NMS",
"tk": "AAPL",
"dt": "2025-01-01",
"xx": 1,
"cp": "Call"
},
"side": "enumValue", // enum(BuySell) - None, Buy, Sell
"ratio": 1, // short. Default=1
"strikeType": "enumValue", // enum(StrikeType) - None, DollarAmt, Percent, PctVariable
"flexTypeOut": "enumValue", // enum(FlexType) - None, AM_Amer_Cash, AM_Euro_Cash, PM_Amer_Cash, PM_Euro_Cash, PM_Amer_Physical, PM_Euro_Physical, Asian, Cliquet, Other, Listed
"vYearsOut": 1.0, // double
"dYearsOut": 1.0, // double
"sdivOut": 1.0, // double
"rateOut": 1.0, // double
"effStrikeOut": 1.0, // double
"sVolOut": 1.0, // double
"sPrcOut": 1.0, // double
"deltaOut": 1.0, // float
"gammaOut": 1.0, // float
"thetaOut": 1.0, // float
"vegaOut": 1.0, // float
"volgaOut": 1.0, // float
"vannaOut": 1.0, // float
"rhoOut": 1.0, // float
"phiOut": 1.0, // float
"errorOut": "exampleString" // string
}
],
"DiscreteDividend": [ // Repeating Field
{
"date": "2025-01-01 12:00:00.000000", // yyyy-MM-dd HH:mm:ss.SSSSSS
"amount": 1.0 // float
}
]
}
}

response = requests.post(MLINK_PROD_URL, params=params, json=payload)