Skip to main content
Version: 8.6.9.2

Schema: MarRiskControl (ID: 4550)

MarRiskControl records are used to establish risk controls within SpiderRock execution engines. These records are only viewable and editable by users belonging to the same riskFirm as the control records.

METADATA​

AttributeValue
Topic4535-risk-control
MLink TokenMARRisk
MLink EndpointMLink-Live
SRSE ProductSRControl

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

BODY​

#FieldTypeDefault ValueComment
12=riskFirmstring(16)If exists, a client firm imposing risk controls (should be an existing SR client ID)
11=riskGroupstring(16)The ID of the risk group these rules will apply to
14=isTestAccntenum : YesNoIf Yes, this control applies only to risk for test accounts
15=riskLevelenum : MarRiskLevelAccountConfig risk level this control binds to. None = legacy (pre-level) record: lookups prefer an exact level match and fall back to None; new records must set a real level
158stkEnabledenum : MarStateEnabled or not for equities (None=disabled)
160optEnabledenum : MarStateEnabled or not for options (None=disabled)
159futEnabledenum : MarStateEnabled or not for futures (None=disabled); required Enable on every risk level
180futOptEnabledenum : MarStateEnabled or not for futures options (None=disabled); required Enable on every risk level
161marginLimitAccfloat0Maximum net (per symbol) total portfolio (start-of-day positions + day trades) margin (can include external sources)
162marginLimitDayfloatMaximum net (per symbol/day) day portfolio (day trades only) margin (can include external sources)
163openExposureLimitfloat0Maximum abs open child order $Delta (no netting) (open child orders only)
165orderMaxStkQtyintNumber of equity shares that can be bought or sold by a single parent order. Has a maximum value of 10M
167orderMaxOptQtyintNumber of option contracts that can be bought or sold by a single parent order
168orderMaxStkDDeltafloatMaximum (abs) mny per stock parent order; ddelta = shares * pointValue * midPrc
170orderMaxOptDDeltafloatMaximum (abs) mny per option parent order; ddelta = contracts * pointValue * ABS(de) * uMidPrc
171stkCollarPctfloatMaximum user limit vs bid/ask price control - percentage as a number between 0 and 1 in decimals
173optCollarPctfloatMaximum user limit vs bid/ask price control - percentage as a number between 0 and 1 in decimals
174allowStkOddLotsenum : YesNoAllow parent stock orders with an order size below 100
109allowLimitOnCloseenum : YesNoAllow limit on close orders - similar to MOC order, with the addition of a price limit
106allowMarketOnCloseenum : YesNoAllow market on close orders - special order type which is executed as close to the close of trading as possible
115allowInterMarketSweepenum : YesNoAllow intermarket sweep orders
175blockShortSalesenum : YesNoBlock all short sales
151modifiedBystring(24)User that last modified this record
154modifiedInenum : SysEnvironmentEnvironment this record was last updated in
157timestampDateTimeTimestamp of this record

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

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

# 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 = 'stkEnabled|optEnabled|futEnabled|futOptEnabled|marginLimitAcc|marginLimitDay|openExposureLimit|orderMaxStkQty|orderMaxOptQty|orderMaxStkDDelta|orderMaxOptDDelta|stkCollarPct|optCollarPct|allowStkOddLots|allowLimitOnClose|allowMarketOnClose|allowInterMarketSweep|blockShortSales|modifiedBy|modifiedIn|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 = 'riskFirm: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 = 'MarRiskControl'

# Replace with your desired view. A "|" separated list of views can be provided
# If no view is provided, all views will be returned
VIEW = 'stkEnabled|optEnabled|futEnabled|futOptEnabled|marginLimitAcc|marginLimitDay|openExposureLimit|orderMaxStkQty|orderMaxOptQty|orderMaxStkDDelta|orderMaxOptDDelta|stkCollarPct|optCollarPct|allowStkOddLots|allowLimitOnClose|allowMarketOnClose|allowInterMarketSweep|blockShortSales|modifiedBy|modifiedIn|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 = 'riskFirm: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 = 'stkEnabled: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 = 'MarRiskControl'

# Replace with fields you want to see aggregate values for. A "|" separated list of measures should be provided
MEASURE = 'stkEnabled|optEnabled|futEnabled|futOptEnabled|marginLimitAcc|marginLimitDay|openExposureLimit|orderMaxStkQty|orderMaxOptQty|orderMaxStkDDelta|orderMaxOptDDelta|stkCollarPct|optCollarPct|allowStkOddLots|allowLimitOnClose|allowMarketOnClose|allowInterMarketSweep|blockShortSales|modifiedBy|modifiedIn|timestamp'

# Replace with fields you want to see aggregated. A "|" separated list of fields should be provided
GROUP = 'stkEnabled|optEnabled|futEnabled|futOptEnabled|allowStkOddLots|allowLimitOnClose|allowMarketOnClose|allowInterMarketSweep|blockShortSales|modifiedIn'

# 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 = 'riskFirm: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 = 'MarRiskControl'

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

payload = {
"header": {
"mTyp": "MarRiskControl"
},
"message": {
"pkey": {
"riskFirm": "exampleString", // string
"riskGroup": "exampleString", // string
"isTestAccnt": "enumValue", // enum(YesNo) - None, Yes, No
"riskLevel": "enumValue" // enum(MarRiskLevel) - None ExsOnSpons ExsOnCore SponsOnCore CoreOnCore CoreOnSub CoreOnAccnt SubOnAccnt CoreOnCustom SubOnCustom CFirmOnCore
},
"stkEnabled": "enumValue", // enum(MarState) - None, Enable, Disabled, CloseOnly
"optEnabled": "enumValue", // enum(MarState) - None, Enable, Disabled, CloseOnly
"futEnabled": "enumValue", // enum(MarState) - None, Enable, Disabled, CloseOnly
"futOptEnabled": "enumValue", // enum(MarState) - None, Enable, Disabled, CloseOnly
"marginLimitAcc": 0, // float. Default=0
"marginLimitDay": 1.0, // float
"openExposureLimit": 0, // float. Default=0
"orderMaxStkQty": 1, // int
"orderMaxOptQty": 1, // int
"orderMaxStkDDelta": 1.0, // float
"orderMaxOptDDelta": 1.0, // float
"stkCollarPct": 1.0, // float
"optCollarPct": 1.0, // float
"allowStkOddLots": "enumValue", // enum(YesNo) - None, Yes, No
"allowLimitOnClose": "enumValue", // enum(YesNo) - None, Yes, No
"allowMarketOnClose": "enumValue", // enum(YesNo) - None, Yes, No
"allowInterMarketSweep": "enumValue", // enum(YesNo) - None, Yes, No
"blockShortSales": "enumValue", // enum(YesNo) - None, Yes, No
"modifiedBy": "exampleString", // string
"modifiedIn": "enumValue", // enum(SysEnvironment) - None, Neptune, Pluto, V7_Stable, V7_Latest, Saturn, Venus, Mars, SysTest, V7_Current
"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)