Skip to main content
Version: 8.5.11.3

Schema: SpanRiskCalculator (ID: 5060)

This table allows custom span risk calculations based on either user or SR supplied input values.

METADATA

AttributeValue
Topic5030-srse-calculators
MLink TokenSRMLinkAnalytics
SRSE ProductSRAnalytics

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

BODY

#FieldTypeDefault ValueComment
10=secKeyOptionKey
11=secTypeenum : SpdrKeyType
12=userNamestring(24)
100voldouble0volatility
103volSrcenum : FieldSrcDefault
106uPrcdouble0underlying price
109uPrcSrcenum : FieldSrcDefault
112yearsdouble0years-to-expiration (default uses SR volatility time value)
115yearsSrcenum : FieldSrcDefault
118sdivdouble0continuous stock dividend using for pricing
121sdivSrcenum : FieldSrcDefault
124ratedouble0discount rate used for pricing
127rateSrcenum : FieldSrcDefault
130exTypeenum : ExerciseTypeNoneexercise type of the option (American or European)
133exTypeSrcenum : FieldSrcDefault
136effStrikedouble0effective strike used for pricing (default is okey.Strike)
139effStrikeSrcenum : FieldSrcDefault
142symRatiodouble0underlying symbol ratio (for non-standard options); discrete dividend will be scaled by this factor
145symRatioSrcenum : FieldSrcDefault
148divStringtext1discrete dividend string [ yearsToExpiry, years1:amt1, years2:amt2, ...] or [ -1, date1:amt1, date2:amt2, ... ]
151divSrcenum : FieldSrcDefault
154modelTypeenum : CalcModelTypeNoneLogNormalExact, LogNormalApprox, NormalExact, NormalApprox
157modelTypeSrcenum : FieldSrcDefault
160calcPrecisionenum : CalcPrecisionLownumerical precision (# of steps) if a numerical method is used; [more steps will be slower to calculate]
163pointValuedouble0$ value of a point in the underlying product
248pointCurrencyenum : Currency
166pointValueSrcenum : FieldSrcDefault
169prcSpanUpfloat0
172prcSpanDnfloat0
175prcSpanTypeenum : PrcSpanTypeExch
178volSpanfloat0
181volSpanTypeenum : VolSpanTypeExch
184spanCalcTypeenum : SpanCalcTypePnL
187hedgeDeltaNeutralenum : YesNoNoall option will be assumed hedged delta neutral, stock and futures will not have slide values
190adjYearsdouble-1year adjustment: effYears = years + adjYears (-1 = no limit)
193maxYearsdouble-1upper bound for years: effYears = MIN(maxYears, effYears) (-1 = no limit)
196span01float0span1: uPrc=unch, vol=up
199span02float0span2: uPrc=unch, vol=down
202span03float0span3: uPrc=+33%, vol=up
205span04float0span4: uPrc=+33%, vol=dn
208span05float0span5: uPrc=-33%, vol=up
211span06float0span6: uPrc=-33%, vol=down
214span07float0span7: uPrc=+67%, vol=up
217span08float0span8: uPrc=+67%, vol=down
220span09float0span9: uPrc=-67%, vol=up
223span10float0span10: uPrc=-67%, vol=down
226span11float0span11: uPrc=+100%, vol=up
229span12float0span12: uPrc=+100%, vol=down
232span13float0span13: uPrc=-100%, vol=up
235span14float0span14: uPrc=-100%, vol=down
238span15float0span15: uPrc=+300%; price slide * 0.33
241span16float0span16: uPrc=-300%, price slide * 0.33
244errorstring(32)calculation error
247timestampDateTime2000-01-01

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 = 'SpanRiskCalculator'

# 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 = 'SpanRiskCalculator'

# 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 = 'vol|volSrc|uPrc|uPrcSrc|years|yearsSrc|sdiv|sdivSrc|rate|rateSrc|exType|exTypeSrc|effStrike|effStrikeSrc|symRatio|symRatioSrc|divString|divSrc|modelType|modelTypeSrc|calcPrecision|pointValue|pointCurrency|pointValueSrc|prcSpanUp|prcSpanDn|prcSpanType|volSpan|volSpanType|spanCalcType|hedgeDeltaNeutral|adjYears|maxYears|span01|span02|span03|span04|span05|span06|span07|span08|span09|span10|span11|span12|span13|span14|span15|span16|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 = 'userName:eq:ExampleString'

# 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 = 'SpanRiskCalculator'

# Replace with your desired view. A "|" separated list of views can be provided
# If no view is provided, all views will be returned
VIEW = 'vol|volSrc|uPrc|uPrcSrc|years|yearsSrc|sdiv|sdivSrc|rate|rateSrc|exType|exTypeSrc|effStrike|effStrikeSrc|symRatio|symRatioSrc|divString|divSrc|modelType|modelTypeSrc|calcPrecision|pointValue|pointCurrency|pointValueSrc|prcSpanUp|prcSpanDn|prcSpanType|volSpan|volSpanType|spanCalcType|hedgeDeltaNeutral|adjYears|maxYears|span01|span02|span03|span04|span05|span06|span07|span08|span09|span10|span11|span12|span13|span14|span15|span16|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 = 'userName:eq:ExampleString'

# 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 = 'vol: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 = 'SpanRiskCalculator'

# Replace with fields you want to see aggregate values for. A "|" separated list of measures should be provided
MEASURE = 'vol|volSrc|uPrc|uPrcSrc|years|yearsSrc|sdiv|sdivSrc|rate|rateSrc|exType|exTypeSrc|effStrike|effStrikeSrc|symRatio|symRatioSrc|divString|divSrc|modelType|modelTypeSrc|calcPrecision|pointValue|pointCurrency|pointValueSrc|prcSpanUp|prcSpanDn|prcSpanType|volSpan|volSpanType|spanCalcType|hedgeDeltaNeutral|adjYears|maxYears|span01|span02|span03|span04|span05|span06|span07|span08|span09|span10|span11|span12|span13|span14|span15|span16|error|timestamp'

# Replace with fields you want to see aggregated. A "|" separated list of fields should be provided
GROUP = 'volSrc|uPrcSrc|yearsSrc|sdivSrc|rateSrc|exType|exTypeSrc|effStrikeSrc|symRatioSrc|divSrc|modelType|modelTypeSrc|calcPrecision|pointCurrency|pointValueSrc|prcSpanType|volSpanType|spanCalcType|hedgeDeltaNeutral'

# 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 = 'userName:eq:ExampleString'

# 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 = 'SpanRiskCalculator'

# 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 = 'userName:eq:ExampleString'

# 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, (R)eplace, (U)pdate, or (D)elete
"postmerge": "Y", # (Y)es or (N)o
}

payload = {
"header": {
"mTyp": "SpanRiskCalculator"
},
"message": {
"pkey": {
"secKey": {
"at": "EQT",
"ts": "NMS",
"tk": "AAPL",
"dt": "2025-01-01",
"xx": 1,
"cp": "Call"
},
"secType": "enumValue", // enum(SpdrKeyType) - None, Stock, Future, Option, MLeg
"userName": "exampleString" // string
},
"vol": 0, // double. Default=0
"volSrc": "Default", // enum(FieldSrc) - Default, User. Default=Default
"uPrc": 0, // double. Default=0
"uPrcSrc": "Default", // enum(FieldSrc) - Default, User. Default=Default
"years": 0, // double. Default=0
"yearsSrc": "Default", // enum(FieldSrc) - Default, User. Default=Default
"sdiv": 0, // double. Default=0
"sdivSrc": "Default", // enum(FieldSrc) - Default, User. Default=Default
"rate": 0, // double. Default=0
"rateSrc": "Default", // enum(FieldSrc) - Default, User. Default=Default
"exType": "None", // enum(ExerciseType) - None, American, European, Asian, Cliquet. Default=None
"exTypeSrc": "Default", // enum(FieldSrc) - Default, User. Default=Default
"effStrike": 0, // double. Default=0
"effStrikeSrc": "Default", // enum(FieldSrc) - Default, User. Default=Default
"symRatio": 0, // double. Default=0
"symRatioSrc": "Default", // enum(FieldSrc) - Default, User. Default=Default
"divString": "exampleString", // text1
"divSrc": "Default", // enum(FieldSrc) - Default, User. Default=Default
"modelType": "None", // enum(CalcModelType) - None, LogNormalExact, NormalExact, LogNormalApprox, NormalApprox. Default=None
"modelTypeSrc": "Default", // enum(FieldSrc) - Default, User. Default=Default
"calcPrecision": "Low", // enum(CalcPrecision) - None, Low, Normal, High, Custom. Default=Low
"pointValue": 0, // double. Default=0
"pointCurrency": "enumValue", // enum(Currency) - None, AUD, BRL, CAD, CHF, CNH, CNY, EUR, GBP, JPY, KRW, MXN, MYR, NOK, NZD, SEK, TRY, USD, USDCents, CZK, ZAR, HUF, USX, GBX, DKK, GEL
"pointValueSrc": "Default", // enum(FieldSrc) - Default, User. Default=Default
"prcSpanUp": 0, // float. Default=0
"prcSpanDn": 0, // float. Default=0
"prcSpanType": "Exch", // enum(PrcSpanType) - None, Pct, Log, Pts, SD1d, Exch. Default=Exch
"volSpan": 0, // float. Default=0
"volSpanType": "Exch", // enum(VolSpanType) - None, Pct, Log, Pts, Abs, vAnn, Exch. Default=Exch
"spanCalcType": "PnL", // enum(SpanCalcType) - PnL, Delta, Vega, WVega, TVega, WtVega, Gamma, Theta. Default=PnL
"hedgeDeltaNeutral": "No", // enum(YesNo) - None, Yes, No. Default=No
"adjYears": -1, // double. Default=-1
"maxYears": -1, // double. Default=-1
"span01": 0, // float. Default=0
"span02": 0, // float. Default=0
"span03": 0, // float. Default=0
"span04": 0, // float. Default=0
"span05": 0, // float. Default=0
"span06": 0, // float. Default=0
"span07": 0, // float. Default=0
"span08": 0, // float. Default=0
"span09": 0, // float. Default=0
"span10": 0, // float. Default=0
"span11": 0, // float. Default=0
"span12": 0, // float. Default=0
"span13": 0, // float. Default=0
"span14": 0, // float. Default=0
"span15": 0, // float. Default=0
"span16": 0, // float. Default=0
"error": "exampleString", // string
"timestamp": "2025-01-01 12:00:00.000000" // yyyy-MM-dd HH:mm:ss.SSSSSS
}
}

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