Skip to main content
Version: 8.4.08.4

Schema: SpdrMLegBrkrState (ID: 4030)

SpdrMLegBrkrState records are published by execution engines and describe the current state of a broker that is managing a SpiderRock parent order. These records include a description of the active child orders managed by the broker. Records are updated whenever a child order changes and also at other times but are not completely live and may not always reflect current market data or limit levels for working orders.

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=tickerTickerKey
11=accntstring(16)
12=spdrSourceenum : SpdrSource
13=groupingCodelong
14=orderSideenum : BuySell
15=clientFirmstring(16)SR client firm
1037engineNamestring(32)execution engine
103parentNumberlongSPDR parent number (most recent/currently active)
106baseParentNumberlong
1038modifyNumberlongmost recent parent number affecting this order (Modify)
109altOrderIdstring(24)alternate order ID (usually clOrdId from client)
112packageIdlonggroups related order/brokers together (eg. Legger w/MLeg Parent)
118altAccntstring(32)alternate (client assigned) "long" account string (optional)
121altUserNamestring(24)alternate (client assigned) user name (optional)
124stageTypeenum : SpdrStageTypeparent is a staged order [ToolVisible]
1039startTypeenum : StartType
127isFlaggedenum : YesNobroker state records is flagged for action (user alert only)
1052noticeNumberlong
1054execBrkrCodestring(16)execBrkrCode attached to parent order (if any)
1042spreadClassenum : ToolSpreadClass
1043spreadFlavorenum : SpreadFlavor
133stockSideenum : BuySell
136ssaleFlagenum : ShortSaleFlag
139locateQuanintavailable locate quantity (if selling short) @ child order send time
142locateFirmstring(6)firm granting the locate (also locate firm used on street FIX orders)
145locatePoolstring(16)locate pool @ firm granting the locate
148stockSharesintnumber of shares included (zero if none)
151stockLegIdlong
154stockFillQuanint
157stockAvgFillPricedouble
160refUPrcfloatreference underlier price (PrcDe orders)
163liveUPrcfloat
166uPriceFormatenum : PriceFormatunderlier price format code
169stockCpxfloat[child] best price
172stockCszint[child] cumulative share represented at best price
175stockCexuint[child] bit mask of all exchanges where we are representing this order
178numLegsbytenumber of valid legs below
181secKey1OptionKeyleg #1
184secType1enum : SpdrKeyType
187ratio1ushort
190side1enum : BuySell
193positionType1enum : PositionType
196legId1long
199fillQuan1int
202avgFillPrice1double
205vega1float
208refUPrc1doublereference underlier price (PrcDe orders)
211refDelta1floatreference delta (for PrcDe order handling)
214refEarnCnt1bytereference # of earnings moves before expiration
217liveUPrc1double
220priceFormat1enum : PriceFormatoption price format code
223legCpx1float[child] best price
226legCsz1int[child] cumulative share represented at best price
229legCex1uint[child] bit mask of all exchanges where we are representing this order
232secKey2OptionKeyleg #2
235secType2enum : SpdrKeyType
238ratio2ushort
241side2enum : BuySell
244positionType2enum : PositionType
247legId2long
250fillQuan2int
253avgFillPrice2double
256vega2float
259refUPrc2doublereference underlier price (PrcDe orders)
262refDelta2floatreference delta (for PrcDe order handling)
265refEarnCnt2bytereference # of earnings moves before expiration
268liveUPrc2double
271priceFormat2enum : PriceFormatoption price format code
274legCpx2float[child] best price
277legCsz2int[child] cumulative share represented at best price
280legCex2uint[child] bit mask of all exchanges where we are representing this order
283secKey3OptionKeyleg #3
286secType3enum : SpdrKeyType
289ratio3ushort
292side3enum : BuySell
295positionType3enum : PositionType
298legId3long
301fillQuan3int
304avgFillPrice3double
307vega3float
310refUPrc3doublereference underlier price (PrcDe orders)
313refDelta3floatreference delta (for PrcDe order handling)
316refEarnCnt3bytereference # of earnings moves before expiration
319liveUPrc3double
322priceFormat3enum : PriceFormatoption price format code
325legCpx3float[child] best price
328legCsz3int[child] cumulative share represented at best price
331legCex3uint[child] bit mask of all exchanges where we are representing this order
334secKey4OptionKeyleg #4
337secType4enum : SpdrKeyType
340ratio4ushort
343side4enum : BuySell
346positionType4enum : PositionType
349legId4long
352fillQuan4int
355avgFillPrice4double
358vega4float
361refUPrc4doublereference underlier price (PrcDe orders)
364refDelta4floatreference delta (for PrcDe order handling)
367refEarnCnt4bytereference # of earnings moves before expiration
370liveUPrc4double
373priceFormat4enum : PriceFormatoption price format code
376legCpx4float[child] best price
379legCsz4int[child] cumulative share represented at best price
382legCex4uint[child] bit mask of all exchanges where we are representing this order
385secKey5OptionKeyleg #5
388secType5enum : SpdrKeyType
391ratio5ushort
394side5enum : BuySell
397positionType5enum : PositionType
400legId5long
403fillQuan5int
406avgFillPrice5double
409vega5float
412refUPrc5doublereference underlier price (PrcDe orders)
415refDelta5floatreference delta (for PrcDe order handling)
418refEarnCnt5bytereference # of earnings moves before expiration
421liveUPrc5double
424priceFormat5enum : PriceFormatoption price format code
427legCpx5float[child] best price
430legCsz5int[child] cumulative share represented at best price
433legCex5uint[child] bit mask of all exchanges where we are representing this order
436secKey6OptionKeyleg #6
439secType6enum : SpdrKeyType
442ratio6ushort
445side6enum : BuySell
448positionType6enum : PositionType
451legId6long
454fillQuan6int
457avgFillPrice6double
460vega6float
463refUPrc6doublereference underlier price (PrcDe orders)
466refDelta6floatreference delta (for PrcDe order handling)
469refEarnCnt6bytereference # of earnings moves before expiration
472liveUPrc6double
475priceFormat6enum : PriceFormatoption price format code
478legCpx6float[child] best price
481legCsz6int[child] cumulative share represented at best price
484legCex6uint[child] bit mask of all exchanges where we are representing this order
487mlegVegafloatnet vega per spread
490mlegWtVegafloatnet wt vega per spread
493mlegDeltafloatnet delta per spread
496mlegGammafloatnet gamma per spread
499mlegThetafloatnet theta per spread
502descriptionstring(24)user defined
505orderSizeintorder size of most recent parent order
508orderActiveSizeinttotal activated size (total size released for execution) (-2 = all available size)
511leavesQuantityintcurrent child order leaves quantity (quantity actively working in the market;all child orders)
514spdrOrderStatusenum : SpdrOrderStatus
517spdrCloseReasonenum : SpdrCloseReason
520spdrRejectReasonenum : SpdrRejectReason
523spdrCloseDetailTxttext1
526openLegsbyte
529cumSquareQtyintcumulative spread quantity filled (all legs received)
532avgSquarePrcdouble
535cumPartialQtyintcumulative spread quantity partially filled (at least one leg received) [expected cumFilledQty if all legs square up]
538fillVegafloatnet vega filled
541fillWtVegafloatnet wt vega filled
544fillDeltafloatnet delta filled
547fillDDeltafloatnet $delta filled
550fillGammafloatnet gamma filled
553fillThetafloatnet theta filled
556lastFillDttmDateTime
559riskLimitSizeintrisk limit size
562riskLimitDescenum : SpdrRiskreason for size reduction
1044riskLimitLevelenum : SpdrRiskLevelrisk limit level responsible for reduction
565maxProgressenum : MaxProgressmaximum point of progress for most recent parent order
568maxProgressDetailstring(48)additional detail on point of maximum progress
571maxProgressTimeDateTimetime of last max progress advance
574algoStateenum : AlgoState[enum] current state of order handler (maker)
577algoCounterintnumber of times order checked by algo handler (note: most checks result in no action)
580makeStateenum : AlgoState[enum] current state of make handler (maker)
583makeCounterintnumber of times order checked by make algo handler (note: most checks result in no action)
586mktRespStateenum : MktRespState[enum] current state of response handler (if any)
589mktRespCounterintnumber of times order checked by market response handler (note: most checks result in no action)
592brokerStateenum : BrokerStatebroker monitor state
595brokerCounterintnumber of times order checked by broker monitor (note: most checks result in no action)]
598spdrMktStateenum : SpdrMarketState[enum] market state
601spdrBrokerStatusenum : SpdrBrokerStatus
604progressRuleDetailtext1Twap/Vwap progress detail
607lastChildRejectDttmDateTimelast child order reject dttm (if any)
610lastChildRejectTexttext1last child order reject reason/text (if any)
613riskGroupIdlongautohedge risk group
616triggerGroupIdlongWaitTrigger group Id
619hedgeGroupingCodelongautohedge risk group
622autoHedgeenum : AutoHedge
625hedgeInstrumentenum : HedgeInstauto-hedge instrument (from parent order)
628hedgeSecKeyExpiryKeyauto-hedge sec key (if any)
631hedgeSecTypeenum : SpdrKeyTypeauto-hedge sec type (Stock or Future)
634hedgeBetaRatiofloatauto-hedge ratio [from parent order (if supplied) or computed by SR]
637hedgeScopeenum : HedgeScopehedge group scope [RiskGroup or Accnt]
640externHedgeExDeststring(16)external broker exDest (only used if orderHandling=Extern) # Should match FixRoutingTable.destination type (eg. #Nighthawk)
643externHedgeParamstext1external algo names/parameters (usually just an algo name) # usually copied from the FixRoutingTable.externParams
646bestWayPrcfloatcurrent leg market nbbo (at time of record publish)
649wrstWayPrcfloatcurrent leg market nbbo ask (at time of record publish)
652bestWaySzintcurrent leg market nbbo cum bid size (at time of record publish)
655wrstWaySzintcurrent leg market nbbo cum ask size (at time of record publish)
658surfacePrcfloatSR spread surface price @ record publish
661surfaceVolfloat
664surfaceUPrcfloat
667limitPricedoublespread limit price
1053limitRefUPrcdouble
670limitErrenum : LimitErrorlimit price error code
673makeLimitPricedouble
676takeLimitPricedouble
679cxlUPrcRangeenum : UPrcCxlcancel spdr order if/when outside stock price range
682minUBidfloatUsed in conjunction with minMaxType & maxUAsk. When set, implements a lower bound on the underlying price and will either suspend or cancel an order when violated.
685maxUAskfloatUsed in conjunction with minMaxType & minUBid. When set, implements an upper bound on the underlying price and will either suspend or cancel an order when violated.
688minMaxTypeenum : MinMaxTypeif Prc minUBid/maxUAsk are expressed as prices; if Pct then they are expresses as pct change since parent order arrival
691leadSideenum : BuySellfor legged orders, which side to lead with. (optional, None ok)
694maxCompletionSlippagedoublemaximum price slippage to complete an open basket or a cross auction (face side slippage)
697orderRefPremiumfloatreference premium (mleg orders only)
700strategystring(36)parent order strategy (description only)
703userNamestring(24)user that entered the most recent parent order
709spdrCommenttext1
712takeReachRuleenum : ReachRuleImmediate = reach room immediately available; Delayed = available after [1-3] seconds; Passive = available if contra side aggresses; WeakOnly = only take if available size < avgMarketSize; ISOSweep = Intermarket Sweep [requires WaitTrigger]
715maxExposureSizeintmaximum simultaneous cumulative child order public size exposure (-2 = orderActiveSize) [order can overfill if > orderActiveSize and numMakeExchanges > 2]
718numMakeExchangesbytenumber of exchanges (2 - 4) on which to publish public making orders. Effective number might be less than requested number if sufficient exchanges are not available.
721publicSizeenum : PublicSizeHandlingpublic order size handling
724progressRuleenum : ProgressRuleImmediate = all size immediately available;TWAP = size released in time intervals;VWAP = size released in volume intervals;
727progressSliceCntbytenumber of progress slices to use (default = 4 or 8) [max 20]
730progressExposeTimeintminimum time (secs) to expose order (0 = no minimum; used to guarantee that the order is exposed at mid-market for some time before actively taking)
733maxChildOrdersintmaximum number of child orders that can be generated by this parent order [order will terminate if/when this cap is reached;zero or neg = unlimited]
736exchMaskuinteligible exchanges (0 = all)
1045marketSessionenum : MarketSession
742startDttmDateTime[optional] (parent order start time)
745orderDurationint[optional] (number of seconds)
1046activeDurationint[optional] (number of seconds)
748goodTillDttmDateTime[optional] (default: 2099-02-02)
1047expireDttmDateTimeexpected order expiration dttm
751parentOrderHandlingenum : ParentOrderHandling
754parentBalanceHandlingenum : ParentBalanceHandling
757blockVisibilityenum : BlockVisibility
760orderLimitTypeenum : SpdrLimitType
763orderPrcLimitdoubleApplies if LimitType = Prc[]
766orderRefUPrcdoublereference uPrc (PrcDe orders)
769orderRefDefloatreference delta (PrcDe orders)
772orderRefGafloatreference gamma (PrcDe orders)
775orderPrcOffsetdoubledefault=0
778takeLimitClassenum : SpdrLimitClassSimple = LimitPrice, Surface = BEST(LimitPrice, SurfLimit), Probability = BEST(LimitPrice, ProbLimit)
781takeAlphaTypeenum : AlphaTypeApplies if limitClass = Probability
784takeAlphaFactorfloat[-2,+2] ProbLimit = MAX(alphaProbability, ProbAvg + AlphaFactor * ProbStd) [if AlphaType = Relative]
787takeAlphaProbabilityfloatProbLimit = alphaProbability [if AlphaType = Static]
790takeSurfPrcOffsetdoubledefault=0
793takeSurfVolOffsetfloatdefault=0
796takeSurfWidOffsetfloatdefault=0
799makeLimitClassenum : SpdrLimitClassSimple = LimitPrice, Surface = BEST(LimitPrice, SurfLimit), Probability = BEST(LimitPrice, ProbLimit)
802makeAlphaTypeenum : AlphaTypeApplies if limitClass = Probability
805makeAlphaFactorfloat[-2,+2] ProbLimit = MAX(alphaProbability, ProbAvg + AlphaFactor * ProbStd) [if AlphaType = Relative]
808makeAlphaProbabilityfloatProbLimit = alphaProbability [if AlphaType = Static]
811makeSurfPrcOffsetdoubledefault=0
814makeSurfVolOffsetfloatdefault=0
817makeSurfWidOffsetfloatdefault=0
820orderRefEventMultfloat
823orderRefEventDttmDateTime
826mlegProbLimitfloatlive prob limit
829mlegSurfOffsetfloatlive surface offset (in premium)
832externExDeststring(12)
835orderDttmDateTimeorder entry date/time
838minSurfVolfloat(minimum) SR spread surface vol [vega weighted] while parent order was working
841maxSurfVolfloat(maximum) SR spread surface vol [vega weighted] while parent order was working
844minSurfPrcfloat(minimum) SR spread surface price while parent order was working
847maxSurfPrcfloat(maximum) SR spread surface price while parent order was working
850minSurfUPrcfloat(minimum) SR spread surface uPrc while parent order was working
853maxSurfUPrcfloat(maximum) SR spread surface uPrc while parent order was working
856minQteWidthfloatminimum quote width during active order window
859avgQteWidthfloataverage quote width (during active order window)
862cntQteWidthint
865arriveBiddouble
868arriveAskdouble
871totalSecondsfloatnumber of seconds that the parent order was active
874workingSecondsfloatnumber of seconds with one or more working child orders in an exchange order book
877prtActiveCntinttotal print events while parent order was active
880prtQtyActiveinttotal quantity printed while parent order was active
883cumExchFeefloatcumulative fill exch fee
886cumM10Pnlfloat
889cumArrivalPnlfloat
892uPrcDriftfloatunderlier drift (since parent order start)
895sVolDriftfloatsurface vol drift (since parent order start)
946maxGrpDayDDeltaLnfloatmax acct+riskGroup day $delta long (positive number;-1=no limit);risk limit = max limit - current net counter
949maxGrpDayDDeltaShfloatmax acct+riskGroup day $delta short (positive number;-1=no limit);risk limit = max limit + current net counter
979maxGrpDayContractsLnintmax acct+riskGroup day opt contracts long (positive number;-1=no limit);risk limit = max limit - current net counter
982maxGrpDayContractsShintmax acct+riskGroup day opt contracts short (positive number;-1=no limit);risk limit = max limit + current net counter
985maxGrpDayContractsAbsintmax acct+riskGroup day opt contracts abs (positive number;-1=no limit);risk limit = max limit - abs(current net counter)
955maxGrpDayVegaLnfloatmax acct+riskGroup day vega long (positive number;-1=no limit);risk limit = max limit - current net counter
958maxGrpDayVegaShfloatmax acct+riskGroup day vega short (positive number;-1=no limit);risk limit = max limit + current net counter
961maxGrpDayVegaAbsfloatmax acct+riskGroup day vega abs (positive number;-1=no limit);risk limit = max limit - abs(current net counter)
964grpDayVegaRatiofloattarget bot / sld ratio (eg ratio=2.0 means that neutral is bot vega = 2x sld vega)
1048maxGrpDayRMetric1Lnfloatmax acct+riskGroup day rMetric1 long (positive number;-1=no limit);risk limit = max limit - current net counter
1049maxGrpDayRMetric1Shfloatmax acct+riskGroup day rMetric1 short (positive number;-1=no limit);risk limit = max limit + current net counter
1050maxGrpDayRMetric1Absfloatmax acct+riskGroup day rMetric1 abs (positive number;-1=no limit);risk limit = max limit - abs(current net counter)
1051grpDayRMetric1Ratiofloattarget bot / sld ratio (eg ratio=0.5 means that neutral is bot rMetric1 = 0.5x sld rMetric1)
1000cpx1float
1003csz1intcumulative size represented at this price
1006cex1uintbit mask of all exchanges where we are representing this order
1009cpx2float
1012csz2intcumulative size represented at this price
1015cex2uintbit mask of all exchanges where we are representing this order
1018cMorebyte
1021numNewOrdersintnumber of new child orders
1024numParentLimitsushortnumber of parent limit messages received for this broker
1027userData1text1user supplied additional detail (255 char);supplied via FIX or SRSE when entering order
1030userData2text1user supplied additional detail (255 char);supplied via FIX or SRSE when entering order
1033numUpdatesintnumber of record updates (cumulative for the day)
1036timestampDateTime

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

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

# 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 = 'engineName|parentNumber|baseParentNumber|modifyNumber|altOrderId|packageId|altAccnt|altUserName|stageType|startType|isFlagged|noticeNumber|execBrkrCode|spreadClass|spreadFlavor|stockSide|ssaleFlag|locateQuan|locateFirm|locatePool|stockShares|stockLegId|stockFillQuan|stockAvgFillPrice|refUPrc|liveUPrc|uPriceFormat|stockCpx|stockCsz|stockCex|numLegs|secKey1|secType1|ratio1|side1|positionType1|legId1|fillQuan1|avgFillPrice1|vega1|refUPrc1|refDelta1|refEarnCnt1|liveUPrc1|priceFormat1|legCpx1|legCsz1|legCex1|secKey2|secType2|ratio2|side2|positionType2|legId2|fillQuan2|avgFillPrice2|vega2|refUPrc2|refDelta2|refEarnCnt2|liveUPrc2|priceFormat2|legCpx2|legCsz2|legCex2|secKey3|secType3|ratio3|side3|positionType3|legId3|fillQuan3|avgFillPrice3|vega3|refUPrc3|refDelta3|refEarnCnt3|liveUPrc3|priceFormat3|legCpx3|legCsz3|legCex3|secKey4|secType4|ratio4|side4|positionType4|legId4|fillQuan4|avgFillPrice4|vega4|refUPrc4|refDelta4|refEarnCnt4|liveUPrc4|priceFormat4|legCpx4|legCsz4|legCex4|secKey5|secType5|ratio5|side5|positionType5|legId5|fillQuan5|avgFillPrice5|vega5|refUPrc5|refDelta5|refEarnCnt5|liveUPrc5|priceFormat5|legCpx5|legCsz5|legCex5|secKey6|secType6|ratio6|side6|positionType6|legId6|fillQuan6|avgFillPrice6|vega6|refUPrc6|refDelta6|refEarnCnt6|liveUPrc6|priceFormat6|legCpx6|legCsz6|legCex6|mlegVega|mlegWtVega|mlegDelta|mlegGamma|mlegTheta|description|orderSize|orderActiveSize|leavesQuantity|spdrOrderStatus|spdrCloseReason|spdrRejectReason|spdrCloseDetailTxt|openLegs|cumSquareQty|avgSquarePrc|cumPartialQty|fillVega|fillWtVega|fillDelta|fillDDelta|fillGamma|fillTheta|lastFillDttm|riskLimitSize|riskLimitDesc|riskLimitLevel|maxProgress|maxProgressDetail|maxProgressTime|algoState|algoCounter|makeState|makeCounter|mktRespState|mktRespCounter|brokerState|brokerCounter|spdrMktState|spdrBrokerStatus|progressRuleDetail|lastChildRejectDttm|lastChildRejectText|riskGroupId|triggerGroupId|hedgeGroupingCode|autoHedge|hedgeInstrument|hedgeSecKey|hedgeSecType|hedgeBetaRatio|hedgeScope|externHedgeExDest|externHedgeParams|bestWayPrc|wrstWayPrc|bestWaySz|wrstWaySz|surfacePrc|surfaceVol|surfaceUPrc|limitPrice|limitRefUPrc|limitErr|makeLimitPrice|takeLimitPrice|cxlUPrcRange|minUBid|maxUAsk|minMaxType|leadSide|maxCompletionSlippage|orderRefPremium|strategy|userName|spdrComment|takeReachRule|maxExposureSize|numMakeExchanges|publicSize|progressRule|progressSliceCnt|progressExposeTime|maxChildOrders|exchMask|marketSession|startDttm|orderDuration|activeDuration|goodTillDttm|expireDttm|parentOrderHandling|parentBalanceHandling|blockVisibility|orderLimitType|orderPrcLimit|orderRefUPrc|orderRefDe|orderRefGa|orderPrcOffset|takeLimitClass|takeAlphaType|takeAlphaFactor|takeAlphaProbability|takeSurfPrcOffset|takeSurfVolOffset|takeSurfWidOffset|makeLimitClass|makeAlphaType|makeAlphaFactor|makeAlphaProbability|makeSurfPrcOffset|makeSurfVolOffset|makeSurfWidOffset|orderRefEventMult|orderRefEventDttm|mlegProbLimit|mlegSurfOffset|externExDest|orderDttm|minSurfVol|maxSurfVol|minSurfPrc|maxSurfPrc|minSurfUPrc|maxSurfUPrc|minQteWidth|avgQteWidth|cntQteWidth|arriveBid|arriveAsk|totalSeconds|workingSeconds|prtActiveCnt|prtQtyActive|cumExchFee|cumM10Pnl|cumArrivalPnl|uPrcDrift|sVolDrift|maxGrpDayDDeltaLn|maxGrpDayDDeltaSh|maxGrpDayContractsLn|maxGrpDayContractsSh|maxGrpDayContractsAbs|maxGrpDayVegaLn|maxGrpDayVegaSh|maxGrpDayVegaAbs|grpDayVegaRatio|maxGrpDayRMetric1Ln|maxGrpDayRMetric1Sh|maxGrpDayRMetric1Abs|grpDayRMetric1Ratio|cpx1|csz1|cex1|cpx2|csz2|cex2|cMore|numNewOrders|numParentLimits|userData1|userData2|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 = 'SpdrMLegBrkrState'

# Replace with your desired view. A "|" separated list of views can be provided
# If no view is provided, all views will be returned
VIEW = 'engineName|parentNumber|baseParentNumber|modifyNumber|altOrderId|packageId|altAccnt|altUserName|stageType|startType|isFlagged|noticeNumber|execBrkrCode|spreadClass|spreadFlavor|stockSide|ssaleFlag|locateQuan|locateFirm|locatePool|stockShares|stockLegId|stockFillQuan|stockAvgFillPrice|refUPrc|liveUPrc|uPriceFormat|stockCpx|stockCsz|stockCex|numLegs|secKey1|secType1|ratio1|side1|positionType1|legId1|fillQuan1|avgFillPrice1|vega1|refUPrc1|refDelta1|refEarnCnt1|liveUPrc1|priceFormat1|legCpx1|legCsz1|legCex1|secKey2|secType2|ratio2|side2|positionType2|legId2|fillQuan2|avgFillPrice2|vega2|refUPrc2|refDelta2|refEarnCnt2|liveUPrc2|priceFormat2|legCpx2|legCsz2|legCex2|secKey3|secType3|ratio3|side3|positionType3|legId3|fillQuan3|avgFillPrice3|vega3|refUPrc3|refDelta3|refEarnCnt3|liveUPrc3|priceFormat3|legCpx3|legCsz3|legCex3|secKey4|secType4|ratio4|side4|positionType4|legId4|fillQuan4|avgFillPrice4|vega4|refUPrc4|refDelta4|refEarnCnt4|liveUPrc4|priceFormat4|legCpx4|legCsz4|legCex4|secKey5|secType5|ratio5|side5|positionType5|legId5|fillQuan5|avgFillPrice5|vega5|refUPrc5|refDelta5|refEarnCnt5|liveUPrc5|priceFormat5|legCpx5|legCsz5|legCex5|secKey6|secType6|ratio6|side6|positionType6|legId6|fillQuan6|avgFillPrice6|vega6|refUPrc6|refDelta6|refEarnCnt6|liveUPrc6|priceFormat6|legCpx6|legCsz6|legCex6|mlegVega|mlegWtVega|mlegDelta|mlegGamma|mlegTheta|description|orderSize|orderActiveSize|leavesQuantity|spdrOrderStatus|spdrCloseReason|spdrRejectReason|spdrCloseDetailTxt|openLegs|cumSquareQty|avgSquarePrc|cumPartialQty|fillVega|fillWtVega|fillDelta|fillDDelta|fillGamma|fillTheta|lastFillDttm|riskLimitSize|riskLimitDesc|riskLimitLevel|maxProgress|maxProgressDetail|maxProgressTime|algoState|algoCounter|makeState|makeCounter|mktRespState|mktRespCounter|brokerState|brokerCounter|spdrMktState|spdrBrokerStatus|progressRuleDetail|lastChildRejectDttm|lastChildRejectText|riskGroupId|triggerGroupId|hedgeGroupingCode|autoHedge|hedgeInstrument|hedgeSecKey|hedgeSecType|hedgeBetaRatio|hedgeScope|externHedgeExDest|externHedgeParams|bestWayPrc|wrstWayPrc|bestWaySz|wrstWaySz|surfacePrc|surfaceVol|surfaceUPrc|limitPrice|limitRefUPrc|limitErr|makeLimitPrice|takeLimitPrice|cxlUPrcRange|minUBid|maxUAsk|minMaxType|leadSide|maxCompletionSlippage|orderRefPremium|strategy|userName|spdrComment|takeReachRule|maxExposureSize|numMakeExchanges|publicSize|progressRule|progressSliceCnt|progressExposeTime|maxChildOrders|exchMask|marketSession|startDttm|orderDuration|activeDuration|goodTillDttm|expireDttm|parentOrderHandling|parentBalanceHandling|blockVisibility|orderLimitType|orderPrcLimit|orderRefUPrc|orderRefDe|orderRefGa|orderPrcOffset|takeLimitClass|takeAlphaType|takeAlphaFactor|takeAlphaProbability|takeSurfPrcOffset|takeSurfVolOffset|takeSurfWidOffset|makeLimitClass|makeAlphaType|makeAlphaFactor|makeAlphaProbability|makeSurfPrcOffset|makeSurfVolOffset|makeSurfWidOffset|orderRefEventMult|orderRefEventDttm|mlegProbLimit|mlegSurfOffset|externExDest|orderDttm|minSurfVol|maxSurfVol|minSurfPrc|maxSurfPrc|minSurfUPrc|maxSurfUPrc|minQteWidth|avgQteWidth|cntQteWidth|arriveBid|arriveAsk|totalSeconds|workingSeconds|prtActiveCnt|prtQtyActive|cumExchFee|cumM10Pnl|cumArrivalPnl|uPrcDrift|sVolDrift|maxGrpDayDDeltaLn|maxGrpDayDDeltaSh|maxGrpDayContractsLn|maxGrpDayContractsSh|maxGrpDayContractsAbs|maxGrpDayVegaLn|maxGrpDayVegaSh|maxGrpDayVegaAbs|grpDayVegaRatio|maxGrpDayRMetric1Ln|maxGrpDayRMetric1Sh|maxGrpDayRMetric1Abs|grpDayRMetric1Ratio|cpx1|csz1|cex1|cpx2|csz2|cex2|cMore|numNewOrders|numParentLimits|userData1|userData2|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 = 'engineName: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 = 'SpdrMLegBrkrState'

# Replace with fields you want to see aggregate values for. A "|" separated list of measures should be provided
MEASURE = 'engineName|parentNumber|baseParentNumber|modifyNumber|altOrderId|packageId|altAccnt|altUserName|stageType|startType|isFlagged|noticeNumber|execBrkrCode|spreadClass|spreadFlavor|stockSide|ssaleFlag|locateQuan|locateFirm|locatePool|stockShares|stockLegId|stockFillQuan|stockAvgFillPrice|refUPrc|liveUPrc|uPriceFormat|stockCpx|stockCsz|stockCex|numLegs|secKey1|secType1|ratio1|side1|positionType1|legId1|fillQuan1|avgFillPrice1|vega1|refUPrc1|refDelta1|refEarnCnt1|liveUPrc1|priceFormat1|legCpx1|legCsz1|legCex1|secKey2|secType2|ratio2|side2|positionType2|legId2|fillQuan2|avgFillPrice2|vega2|refUPrc2|refDelta2|refEarnCnt2|liveUPrc2|priceFormat2|legCpx2|legCsz2|legCex2|secKey3|secType3|ratio3|side3|positionType3|legId3|fillQuan3|avgFillPrice3|vega3|refUPrc3|refDelta3|refEarnCnt3|liveUPrc3|priceFormat3|legCpx3|legCsz3|legCex3|secKey4|secType4|ratio4|side4|positionType4|legId4|fillQuan4|avgFillPrice4|vega4|refUPrc4|refDelta4|refEarnCnt4|liveUPrc4|priceFormat4|legCpx4|legCsz4|legCex4|secKey5|secType5|ratio5|side5|positionType5|legId5|fillQuan5|avgFillPrice5|vega5|refUPrc5|refDelta5|refEarnCnt5|liveUPrc5|priceFormat5|legCpx5|legCsz5|legCex5|secKey6|secType6|ratio6|side6|positionType6|legId6|fillQuan6|avgFillPrice6|vega6|refUPrc6|refDelta6|refEarnCnt6|liveUPrc6|priceFormat6|legCpx6|legCsz6|legCex6|mlegVega|mlegWtVega|mlegDelta|mlegGamma|mlegTheta|description|orderSize|orderActiveSize|leavesQuantity|spdrOrderStatus|spdrCloseReason|spdrRejectReason|spdrCloseDetailTxt|openLegs|cumSquareQty|avgSquarePrc|cumPartialQty|fillVega|fillWtVega|fillDelta|fillDDelta|fillGamma|fillTheta|lastFillDttm|riskLimitSize|riskLimitDesc|riskLimitLevel|maxProgress|maxProgressDetail|maxProgressTime|algoState|algoCounter|makeState|makeCounter|mktRespState|mktRespCounter|brokerState|brokerCounter|spdrMktState|spdrBrokerStatus|progressRuleDetail|lastChildRejectDttm|lastChildRejectText|riskGroupId|triggerGroupId|hedgeGroupingCode|autoHedge|hedgeInstrument|hedgeSecKey|hedgeSecType|hedgeBetaRatio|hedgeScope|externHedgeExDest|externHedgeParams|bestWayPrc|wrstWayPrc|bestWaySz|wrstWaySz|surfacePrc|surfaceVol|surfaceUPrc|limitPrice|limitRefUPrc|limitErr|makeLimitPrice|takeLimitPrice|cxlUPrcRange|minUBid|maxUAsk|minMaxType|leadSide|maxCompletionSlippage|orderRefPremium|strategy|userName|spdrComment|takeReachRule|maxExposureSize|numMakeExchanges|publicSize|progressRule|progressSliceCnt|progressExposeTime|maxChildOrders|exchMask|marketSession|startDttm|orderDuration|activeDuration|goodTillDttm|expireDttm|parentOrderHandling|parentBalanceHandling|blockVisibility|orderLimitType|orderPrcLimit|orderRefUPrc|orderRefDe|orderRefGa|orderPrcOffset|takeLimitClass|takeAlphaType|takeAlphaFactor|takeAlphaProbability|takeSurfPrcOffset|takeSurfVolOffset|takeSurfWidOffset|makeLimitClass|makeAlphaType|makeAlphaFactor|makeAlphaProbability|makeSurfPrcOffset|makeSurfVolOffset|makeSurfWidOffset|orderRefEventMult|orderRefEventDttm|mlegProbLimit|mlegSurfOffset|externExDest|orderDttm|minSurfVol|maxSurfVol|minSurfPrc|maxSurfPrc|minSurfUPrc|maxSurfUPrc|minQteWidth|avgQteWidth|cntQteWidth|arriveBid|arriveAsk|totalSeconds|workingSeconds|prtActiveCnt|prtQtyActive|cumExchFee|cumM10Pnl|cumArrivalPnl|uPrcDrift|sVolDrift|maxGrpDayDDeltaLn|maxGrpDayDDeltaSh|maxGrpDayContractsLn|maxGrpDayContractsSh|maxGrpDayContractsAbs|maxGrpDayVegaLn|maxGrpDayVegaSh|maxGrpDayVegaAbs|grpDayVegaRatio|maxGrpDayRMetric1Ln|maxGrpDayRMetric1Sh|maxGrpDayRMetric1Abs|grpDayRMetric1Ratio|cpx1|csz1|cex1|cpx2|csz2|cex2|cMore|numNewOrders|numParentLimits|userData1|userData2|numUpdates|timestamp'

# Replace with fields you want to see aggregated. A "|" separated list of fields should be provided
GROUP = 'stageType|startType|isFlagged|spreadClass|spreadFlavor|stockSide|ssaleFlag|uPriceFormat|secType1|side1|positionType1|priceFormat1|secType2|side2|positionType2|priceFormat2|secType3|side3|positionType3|priceFormat3|secType4|side4|positionType4|priceFormat4|secType5|side5|positionType5|priceFormat5|secType6|side6|positionType6|priceFormat6|spdrOrderStatus|spdrCloseReason|spdrRejectReason|riskLimitDesc|riskLimitLevel|maxProgress|algoState|makeState|mktRespState|brokerState|spdrMktState|spdrBrokerStatus|autoHedge|hedgeInstrument|hedgeSecType|hedgeScope|limitErr|cxlUPrcRange|minMaxType|leadSide|takeReachRule|publicSize|progressRule|marketSession|parentOrderHandling|parentBalanceHandling|blockVisibility|orderLimitType|takeLimitClass|takeAlphaType|makeLimitClass|makeAlphaType'

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

# 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)