Skip to main content
Version: Staging

Schema: SpdrParentBrkrState (ID: 4070)

SpdrParentBrkrState records are created/published by SpiderRock Execution Engines. Each record describes the current state of one (or more) parent orders. If a parent order is canceled/replaced then entire chain is represented by a single broker state record.

METADATA

AttributeValue
Topic3985-parent-orders
MLink TokenClientTrading
SRSE ProductSRTrade

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

BODY

#FieldTypeComment
10=accntstring(16)
11=secKeyOptionKey
12=secTypeenum : SpdrKeyType
13=spdrSourceenum : SpdrSource
14=groupingCodelong
15=orderSideenum : BuySell
16=clientFirmstring(16)SR client firm
100userNamestring(24)SR user name string
106parentNumberlongSR parent number
109baseParentNumberlong
596modifyNumberlongmost recent parent number affecting this order (AddReplace or Modify)
604noticeNumberlongSR noticeNumber [required when parentOrderHandling = BlockAuction
112riskGroupIdlongall orders with the same riskGroupId share a common set of risk counters;.Grp. risk limits apply to these shared counters
115triggerGroupIdlong
118strategystring(36)parent order strategy string (can be user supplied)
606execBrkrCodestring(16)execBrkrCode attached to parent order (if any)
121altOrderIdtext1alternate order ID (usually clOrdId from client)
124packageIdlonggroups related order/brokers together (eg. Legger w/MLeg Parent)
127altAccnttext1alternate (client assigned) "long" account string (optional)
130altUserNamestring(24)alternate (client assigned) user name (optional)
133stageTypeenum : SpdrStageTypeparent is a staged order [ToolVisible]
136isFlaggedenum : YesNobroker state records is flagged for action (user alert only)
139tickerTickerKeyunderlier ticker
142uPrcdoubleunderlier price (usually mid-market)
145uPrcOrderdoubleunderlier price at the time of last parent order arrival
148nbboBiddoublecurrent option nbbo bid (at time of record publish)
151nbboAskdoublecurrent option nbbo ask (at time of record publish)
154nbboBidSzintcurrent option nbbo cum bid size (at time of record publish)
157nbboAskSzintcurrent option nbbo cum ask size (at time of record publish)
160surfacePrcfloatSR surface price @ record publish
163surfaceVolfloatSR surface volatility @ record publish
166orderRefSDivfloat
169orderRefSDivTypeenum : RefSDivType
172spdrBrokerStatusenum : SpdrBrokerStatus
175spdrOrderStatusenum : SpdrOrderStatusstatus of the most recent parent order handled by this broker
178spdrCloseReasonenum : SpdrCloseReasonclose reason of most recent parent order
181spdrRejectReasonenum : SpdrRejectReasonreject reason (if any) of most recent parent order
599spdrRejectLevelenum : SpdrRiskLevelreject level (if any) of most recent parent order
184isPermanentlyClosedenum : YesNoindicates that this broker is permanently closed (cannot be cxl/replaced or re-opened) [auto-hedge orders only]
187numExternRiskHoldintnum external risk management rejects received
190lastExternRiskTexttext1last external (exch?) risk management reject
193lastExternRiskRejectDateTime
196spdrCommenttext1
199orderSizeintorder size of most recent parent order
202orderActiveSizeinttotal activated size (total size released for execution) (-1 = all available size)
600activeDurationint[optional] (number of seconds)
205updateDttmDateTime
208goodTillDttmDateTimeorder expiration date/time (most recent parent order in cxl/replace chain)
211leavesQuantityintcurrent child order leaves quantity (quantity actively working in the market;all child orders)
214avgFillPricedoubleaverage fill price
217avgFillUPricedoubleaverage fill underlier price
220cumFillQuantityintcumulative fill quantity
223avgFillVolfloataverage fill volatility
226cumFillVegafloatcumulative fill vega
229cumFillThetafloatcumulative fill theta
232cumFillDDeltafloatcumulative fill $Delta
235cumExchFeefloatcumulative fill exch fee
238cumM10Pnlfloat
241cumArrivalPnlfloat
244lastFillDttmDateTime
247riskLimitSizeintrisk limit size (maximum size to nearest risk limit)
250riskLimitDescenum : SpdrRiskreason for size reduction
601riskLimitLevelenum : SpdrRiskLevelrisk limit level responsible for reduction
602riskLimitDetailtext1risk limit detail
253limitPricedoublesimple limit
605limitRefUPrcdouble
256limitErrenum : LimitError
259limitErrDesctext1
262bestLimitOffsetfloat(possible price improvement) (gap between best price and init/limit price) (Face/Matrix orders)
265makeProbLimitfloat
268makeSurfOffsetfloat
271makeLimitPricedoublemake limit
274makeLimitErrenum : LimitError
277takeProbLimitfloat
280takeSurfOffsetfloat
283takeLimitPricedoubletake limit
286takeLimitErrenum : LimitError
289autoHedgeenum : AutoHedge
292hedgeInstrumentenum : HedgeInstauto-hedge instrument (from parent order)
295hedgeSecKeyExpiryKeyauto-hedge sec key (if any)
298hedgeSecTypeenum : SpdrKeyTypeauto-hedge sec type (Stock or Future)
301hedgeBetaRatiofloatauto-hedge ratio [from parent order (if supplied) or computed by SR]
304hedgeScopeenum : HedgeScopehedge group scope [RiskGroup or Accnt]
603hedgeSessionenum : MarketSessionmarket session for the autohedge order
310externHedgeExDeststring(16)external broker exDest (only used if orderHandling=Extern) # Should match FixRoutingTable.destination type (eg. #Nighthawk)
313externHedgeParamstext1external algo names/parameters (usually just an algo name) # usually copied from the FixRoutingTable.externParams
316userData1text1client supplied data field; passes through to parent and child executions and reports as well as FIX drops
319userData2text1client supplied data field; passes through to parent and child executions and reports as well as FIX drops
322maxProgressenum : MaxProgressmaximum point of progress for most recent parent order
325maxProgressDetailtext1additional detail on point of maximum progress
328maxProgressTimeDateTimetime of last max progress advance
331brokerStateenum : BrokerStatebroker monitor state
334brokerCounterintnumber of times order checked by broker monitor (note: most checks result in no action)]
337makeStateenum : AlgoState[enum] current state of non-marketable order handler (maker)
340makeCounterintnumber of times order checked by post handler (note: most checks result in no action)
343takeStateenum : AlgoState[enum] current state of marketable order handler (taker)
346takeCounterintnumber of times order checked by take handler (note: most checks result in no action)
349mktRespStateenum : MktRespState[enum] current state of response handler (if any)
352mktRespCounterintnumber of times order checked by market response handler (note: most checks result in no action)
355mktCrossStateenum : MktCrossState[enum] current state of mkt cross handler (if any)
358mktCrossCounterintnumber of times order checked by market cross handler (note: most checks result in no action)
361progressRuleDetailtext1Twap/Vwap progress detail
364lastChildEventenum : ChildEvent[enum] last event code from broker/child order handler(s)
367lastChildRejectDttmDateTimelast child order reject dttm (if any)
370lastChildRejectTexttext1last child order reject reason/text (if any)
373spdrMktStateenum : SpdrMarketState[enum] market state
376cpx1floatchild price level #1
379csz1intcumulative size represented at this price
382cex1uintbit mask of all exchanges where we are at this price
385cnt1bytenumber of child orders at price level #1
388cpx2floatchild price level #2
391csz2intcumulative size represented at this price
394cex2uintbit mask of all exchanges where we are at this price
397cnt2bytenumber of child orders at price level #2
400cMorebytenumber of additional child orders at inferior prices (if any)
403expiryKeystring(6)
406cnVolfloat
409cnYrsfloat
412cnUPrcfloat
415cnDefloatdelta per contract
418cnDdfloat$delta per contract
421cnVefloatvega per contract
424cnGafloat
427cnThfloat
430cnPrfloatpremium per contract
433ddMultfloat
436priceFormatenum : PriceFormatoption price format code
439uPriceFormatenum : PriceFormatunderlier price format code
442underliersPerCnintoption delivery underliers per contract
445underlierTypeenum : UnderlierTypetype of underlier (affects $greek calculations)
448tickValuefloat$NLV value of a single tick change in display premium (pointValue = tickValue / tickSize)
451pointValuefloat$NLV value of a single point change in display premium (pointValue = tickValue / tickSize)
454pointCurrencyenum : Currency
511theoVolfloat
514theoPrcfloat
517numNewOrdersintnumber of child orders generated by this broker (all parent orders)
520numParentLimitsushortnumber of parent limit messages received for this broker
523brokerVwapMarkfloattrade weighted average price (duration of parent order)
526brokerVwapUMarkfloatoption-trade weighted average underlier price (duration of parent order)
529brokerQwapMarkfloataverage quote mid-market (duration of parent order)
532brokerQwapUMarkfloataverage underlier quote mid-market (duration of parent order)
535vwapPnLfloatdir * qty * (brokerVwapMark - avgFillPrice)
538vwapDnPnLfloatvwapPnL - uDriftVwapPnL
541uDriftVwapPnLfloat(dir * (de * qty * (brokerVwapUMark - avgFillUPrice)))
544qwapPnLfloatdir * qty * (brokerQwapMark - avgFillPrice)
547qwapDnPnLfloatqwapPnL - uDriftQwapPnL
550uDriftQwapPnLfloat(dir * (de * qty * (brokerQwapUMark - avgFillUPrice)))
553numImprvChldintnumber of child orders that improved an existing market
556activeSecondsfloatnumber of seconds that the parent order was active
559withSecondsfloatnumber of seconds with one or more working child orders that are with of nbbo
562aloneSecondsfloatnumber of seconds with one or more working child orders that make up 100% of nbbo
565workingSecondsfloatnumber of child order seconds (can be greater than activeSeconds if working on more than one exchange)
568numRiskCancelsintnumber of child orders cancels for risk reasons
571riskHoldSecondsfloatnumber of seconds with parent order active but on risk hold (zero child order risk size)
574riskThrtlSecondsfloatnumber of seconds with parent order active but in risk throttle condition (temporary hold after fast/mass risk cancel)
577numMakeThrottleSkipsintnumber of childs orders not send to market dues to outbound lines being in a queued/throttled state
580sumMakeThrottleDelayfloatcumulative seconds of queue skip delay (seconds that a child order was not in the market dues to outbound lines being in a queued/throttled state)
583uPrcDriftfloatunderlier drift (since parent order start)
586sVolDriftfloatsurface vol drift (since parent order start)
589updateSrcenum : UpdateSource
592numUpdatesintnumber of record updates (cumulative for the day)
595timestampDateTimeSR system timestamp

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

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

# 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 = 'userName|parentNumber|baseParentNumber|modifyNumber|noticeNumber|riskGroupId|triggerGroupId|strategy|execBrkrCode|altOrderId|packageId|altAccnt|altUserName|stageType|isFlagged|ticker|uPrc|uPrcOrder|nbboBid|nbboAsk|nbboBidSz|nbboAskSz|surfacePrc|surfaceVol|orderRefSDiv|orderRefSDivType|spdrBrokerStatus|spdrOrderStatus|spdrCloseReason|spdrRejectReason|spdrRejectLevel|isPermanentlyClosed|numExternRiskHold|lastExternRiskText|lastExternRiskReject|spdrComment|orderSize|orderActiveSize|activeDuration|updateDttm|goodTillDttm|leavesQuantity|avgFillPrice|avgFillUPrice|cumFillQuantity|avgFillVol|cumFillVega|cumFillTheta|cumFillDDelta|cumExchFee|cumM10Pnl|cumArrivalPnl|lastFillDttm|riskLimitSize|riskLimitDesc|riskLimitLevel|riskLimitDetail|limitPrice|limitRefUPrc|limitErr|limitErrDesc|bestLimitOffset|makeProbLimit|makeSurfOffset|makeLimitPrice|makeLimitErr|takeProbLimit|takeSurfOffset|takeLimitPrice|takeLimitErr|autoHedge|hedgeInstrument|hedgeSecKey|hedgeSecType|hedgeBetaRatio|hedgeScope|hedgeSession|externHedgeExDest|externHedgeParams|userData1|userData2|maxProgress|maxProgressDetail|maxProgressTime|brokerState|brokerCounter|makeState|makeCounter|takeState|takeCounter|mktRespState|mktRespCounter|mktCrossState|mktCrossCounter|progressRuleDetail|lastChildEvent|lastChildRejectDttm|lastChildRejectText|spdrMktState|cpx1|csz1|cex1|cnt1|cpx2|csz2|cex2|cnt2|cMore|expiryKey|cnVol|cnYrs|cnUPrc|cnDe|cnDd|cnVe|cnGa|cnTh|cnPr|ddMult|priceFormat|uPriceFormat|underliersPerCn|underlierType|tickValue|pointValue|pointCurrency|theoVol|theoPrc|numNewOrders|numParentLimits|brokerVwapMark|brokerVwapUMark|brokerQwapMark|brokerQwapUMark|vwapPnL|vwapDnPnL|uDriftVwapPnL|qwapPnL|qwapDnPnL|uDriftQwapPnL|numImprvChld|activeSeconds|withSeconds|aloneSeconds|workingSeconds|numRiskCancels|riskHoldSeconds|riskThrtlSeconds|numMakeThrottleSkips|sumMakeThrottleDelay|uPrcDrift|sVolDrift|updateSrc|numUpdates|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 = 'accnt: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 = 'SpdrParentBrkrState'

# Replace with your desired view. A "|" separated list of views can be provided
# If no view is provided, all views will be returned
VIEW = 'userName|parentNumber|baseParentNumber|modifyNumber|noticeNumber|riskGroupId|triggerGroupId|strategy|execBrkrCode|altOrderId|packageId|altAccnt|altUserName|stageType|isFlagged|ticker|uPrc|uPrcOrder|nbboBid|nbboAsk|nbboBidSz|nbboAskSz|surfacePrc|surfaceVol|orderRefSDiv|orderRefSDivType|spdrBrokerStatus|spdrOrderStatus|spdrCloseReason|spdrRejectReason|spdrRejectLevel|isPermanentlyClosed|numExternRiskHold|lastExternRiskText|lastExternRiskReject|spdrComment|orderSize|orderActiveSize|activeDuration|updateDttm|goodTillDttm|leavesQuantity|avgFillPrice|avgFillUPrice|cumFillQuantity|avgFillVol|cumFillVega|cumFillTheta|cumFillDDelta|cumExchFee|cumM10Pnl|cumArrivalPnl|lastFillDttm|riskLimitSize|riskLimitDesc|riskLimitLevel|riskLimitDetail|limitPrice|limitRefUPrc|limitErr|limitErrDesc|bestLimitOffset|makeProbLimit|makeSurfOffset|makeLimitPrice|makeLimitErr|takeProbLimit|takeSurfOffset|takeLimitPrice|takeLimitErr|autoHedge|hedgeInstrument|hedgeSecKey|hedgeSecType|hedgeBetaRatio|hedgeScope|hedgeSession|externHedgeExDest|externHedgeParams|userData1|userData2|maxProgress|maxProgressDetail|maxProgressTime|brokerState|brokerCounter|makeState|makeCounter|takeState|takeCounter|mktRespState|mktRespCounter|mktCrossState|mktCrossCounter|progressRuleDetail|lastChildEvent|lastChildRejectDttm|lastChildRejectText|spdrMktState|cpx1|csz1|cex1|cnt1|cpx2|csz2|cex2|cnt2|cMore|expiryKey|cnVol|cnYrs|cnUPrc|cnDe|cnDd|cnVe|cnGa|cnTh|cnPr|ddMult|priceFormat|uPriceFormat|underliersPerCn|underlierType|tickValue|pointValue|pointCurrency|theoVol|theoPrc|numNewOrders|numParentLimits|brokerVwapMark|brokerVwapUMark|brokerQwapMark|brokerQwapUMark|vwapPnL|vwapDnPnL|uDriftVwapPnL|qwapPnL|qwapDnPnL|uDriftQwapPnL|numImprvChld|activeSeconds|withSeconds|aloneSeconds|workingSeconds|numRiskCancels|riskHoldSeconds|riskThrtlSeconds|numMakeThrottleSkips|sumMakeThrottleDelay|uPrcDrift|sVolDrift|updateSrc|numUpdates|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 = 'accnt: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 = 'userName: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 = 'SpdrParentBrkrState'

# Replace with fields you want to see aggregate values for. A "|" separated list of measures should be provided
MEASURE = 'userName|parentNumber|baseParentNumber|modifyNumber|noticeNumber|riskGroupId|triggerGroupId|strategy|execBrkrCode|altOrderId|packageId|altAccnt|altUserName|stageType|isFlagged|ticker|uPrc|uPrcOrder|nbboBid|nbboAsk|nbboBidSz|nbboAskSz|surfacePrc|surfaceVol|orderRefSDiv|orderRefSDivType|spdrBrokerStatus|spdrOrderStatus|spdrCloseReason|spdrRejectReason|spdrRejectLevel|isPermanentlyClosed|numExternRiskHold|lastExternRiskText|lastExternRiskReject|spdrComment|orderSize|orderActiveSize|activeDuration|updateDttm|goodTillDttm|leavesQuantity|avgFillPrice|avgFillUPrice|cumFillQuantity|avgFillVol|cumFillVega|cumFillTheta|cumFillDDelta|cumExchFee|cumM10Pnl|cumArrivalPnl|lastFillDttm|riskLimitSize|riskLimitDesc|riskLimitLevel|riskLimitDetail|limitPrice|limitRefUPrc|limitErr|limitErrDesc|bestLimitOffset|makeProbLimit|makeSurfOffset|makeLimitPrice|makeLimitErr|takeProbLimit|takeSurfOffset|takeLimitPrice|takeLimitErr|autoHedge|hedgeInstrument|hedgeSecKey|hedgeSecType|hedgeBetaRatio|hedgeScope|hedgeSession|externHedgeExDest|externHedgeParams|userData1|userData2|maxProgress|maxProgressDetail|maxProgressTime|brokerState|brokerCounter|makeState|makeCounter|takeState|takeCounter|mktRespState|mktRespCounter|mktCrossState|mktCrossCounter|progressRuleDetail|lastChildEvent|lastChildRejectDttm|lastChildRejectText|spdrMktState|cpx1|csz1|cex1|cnt1|cpx2|csz2|cex2|cnt2|cMore|expiryKey|cnVol|cnYrs|cnUPrc|cnDe|cnDd|cnVe|cnGa|cnTh|cnPr|ddMult|priceFormat|uPriceFormat|underliersPerCn|underlierType|tickValue|pointValue|pointCurrency|theoVol|theoPrc|numNewOrders|numParentLimits|brokerVwapMark|brokerVwapUMark|brokerQwapMark|brokerQwapUMark|vwapPnL|vwapDnPnL|uDriftVwapPnL|qwapPnL|qwapDnPnL|uDriftQwapPnL|numImprvChld|activeSeconds|withSeconds|aloneSeconds|workingSeconds|numRiskCancels|riskHoldSeconds|riskThrtlSeconds|numMakeThrottleSkips|sumMakeThrottleDelay|uPrcDrift|sVolDrift|updateSrc|numUpdates|timestamp'

# Replace with fields you want to see aggregated. A "|" separated list of fields should be provided
GROUP = 'stageType|isFlagged|orderRefSDivType|spdrBrokerStatus|spdrOrderStatus|spdrCloseReason|spdrRejectReason|spdrRejectLevel|isPermanentlyClosed|riskLimitDesc|riskLimitLevel|limitErr|makeLimitErr|takeLimitErr|autoHedge|hedgeInstrument|hedgeSecType|hedgeScope|hedgeSession|maxProgress|brokerState|makeState|takeState|mktRespState|mktCrossState|lastChildEvent|spdrMktState|priceFormat|uPriceFormat|underlierType|pointCurrency|updateSrc'

# 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 = 'accnt: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 = 'SpdrParentBrkrState'

# 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 = 'accnt: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)