Skip to main content
Version: Upcoming

StockPositionRecordV5

V8 Message Definiton

StockPositionRecords are live risk records that contain start-of-day positions and all subsequent executions, including executions reported as done away.\nThese records are published by a CoreRiskServer and represent the position and risk markup detail for a single equity or ETF security.\nNew records are published immediately when a position changes and about once per minute if no position has changed.\nNote that all stock, future and option records for a single ticker are published simultaneously and records for the same chain should have consistent marks.

METADATA

AttributeValue
Topic4740-risk-v5
MLink TokenClientRisk
ProductSRRisk
accessTypeSELECT

Table Definition

FieldTypeKeyDefault ValueComment
ticker_atenum - AssetTypePRI'None'
ticker_tsenum - TickerSrcPRI'None'
ticker_tkVARCHAR(12)PRI''
accntVARCHAR(16)PRI''
tradeDateDATEPRI'1900-01-01'
riskSessionenum - RiskSessionPRI'Regular'
clientFirmVARCHAR(16)PRI''SR assigned client firm
riskServerCodeVARCHAR(6)''
priAggGroupVARCHAR(16)''primary aggregation group
secAggGroupVARCHAR(16)''secondary aggregation group
symbolTypeenum - SymbolType'None'
tickValueFLOAT0NLV value of a single tick change in display premium pointValue tickValue tickSize
pointValueFLOAT0NLV value of a single point change in display premium pointValue tickValue tickSize
pointCurrencyenum - Currency'None'
priceFormatenum - PriceFormat'None'price display format code
stkPrcFLOAT0current stock price any market session persists if market closedhalted
stkBidFLOAT0current stock bid any market session zero if market closedhalted
stkAskFLOAT0current stock ask any market session zero if market closedhalted
stkMarkDOUBLE0current stock mark freezes at SR CloseMarkTime
stkMarkErrCodesVARCHAR(255)'None'
stkMarkSourceenum - UMarkSource'None'
stkOpnMidMarkDOUBLE0startofday SR stock mark rotated from prior day record corp action adjusted
stkOpnClrMarkDOUBLE0startofday CLR stock mark supplied by clientclearing firm via clearing position load should be corp action adjusted
stkOpnPosPrvINT0startofday SR share position rotated from prior day record corp action adjusted
stkOpnPosClrINT0startofday CLR share position supplied by clientclearing firm via clearing position load should be corp action adjusted
stkOpnPosINT0start of period share position effective can be from either CLR or SR
stkOpnPosSrcenum - PositionSource'None'start of period position source
shBotINT0number of shares bot today
shSldINT0number of shares sld today
shSldShrtINT0number of shares sld short today
shBotHdgINT0number of shares bot today from hedging spdrSourceHedgeTool
shSldHdgINT0number of shares sld today from hedging spdrSourceHedgeTool
shBotTrhINT0number of shares bot today from hedging spdrSourceTradeHedge
shSldTrhINT0number of shares sld today from hedging spdrSourceTradeHedge
shBotOpnINT0number of shares bot today from hedging spdrSourceOpenHedge
shSldOpnINT0number of shares sld today from hedging spdrSourceOpenHedge
shBotTrdINT0number of shares bot today from any trade hedging source AutoHedge or Trades loop
shSldTrdINT0number of shares sld today from any trade hedging source AutoHedge or Trades loop
stkMnyBotDOUBLE0sum of settle cash for all buy executions
stkMnySldDOUBLE0sum of settle cash for all sell executions
dayPnlFLOAT0
opnPnlMidMarkFLOAT0
opnPnlClrMarkFLOAT0
exDivAmtFLOAT0amount of any dividend going ex today
borrowRateFLOAT0overnight rate required to borrow stock if known
betaFLOAT0beta usually beta to SPX see AccountConfigbetaSource
betaSourceenum - BetaSource'None'
marginUDnFLOAT0Aggregate RiskSlide uPrc dn
marginUUpFLOAT0Aggregate RiskSlide uPrc up
numExecutionsINT0number of included SpdrParentExecution records
maxExecDttmDATETIME(6)'1900-01-01 00:00:00.000000'max timestamp of included SpdrParentExecution records
timestampDATETIME(6)'1900-01-01 00:00:00.000000'

PRIMARY KEY DEFINITION (Unique)

FieldSequence
ticker_tk1
ticker_at2
ticker_ts3
accnt4
tradeDate5
riskSession6
clientFirm7

CREATE TABLE EXAMPLE QUERY

CREATE TABLE `SRRisk`.`MsgStockPositionRecordV5` (
`ticker_at` ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') NOT NULL DEFAULT 'None',
`ticker_ts` ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','EUX','ANY','CXE','DXE','NXAM','NXBR','NXLS','NXML','NXOS','NXP','EUREX','CEDX','ICEFE') NOT NULL DEFAULT 'None',
`ticker_tk` VARCHAR(12) NOT NULL DEFAULT '',
`accnt` VARCHAR(16) NOT NULL DEFAULT '',
`tradeDate` DATE NOT NULL DEFAULT '1900-01-01',
`riskSession` ENUM('Regular','PostClose') NOT NULL DEFAULT 'Regular',
`clientFirm` VARCHAR(16) NOT NULL DEFAULT '' COMMENT 'SR assigned client firm',
`riskServerCode` VARCHAR(6) NOT NULL DEFAULT '',
`priAggGroup` VARCHAR(16) NOT NULL DEFAULT '' COMMENT 'primary aggregation group',
`secAggGroup` VARCHAR(16) NOT NULL DEFAULT '' COMMENT 'secondary aggregation group',
`symbolType` ENUM('None','Equity','ADR','ETF','CashIndex','MutualFund','ShortETF','Future','Bond','DepReceipts','PreferredSec','PreferenceShare','StructuredProd','StapledSec','TradeableRights','Unit','Warrant','WhenIssued','ForeignIssue') NOT NULL DEFAULT 'None',
`tickValue` FLOAT NOT NULL DEFAULT 0 COMMENT '$NLV value of a single tick change in display premium (pointValue = tickValue / tickSize)',
`pointValue` FLOAT NOT NULL DEFAULT 0 COMMENT '$NLV value of a single point change in display premium (pointValue = tickValue / tickSize)',
`pointCurrency` ENUM('None','AUD','BRL','CAD','CHF','CNH','CNY','EUR','GBP','JPY','KRW','MXN','MYR','NOK','NZD','SEK','TRY','USD','USDCents','CZK','ZAR','HUF','USX','GBX') NOT NULL DEFAULT 'None',
`priceFormat` ENUM('None','N0','N1','N2','N3','N4','N5','N6','N7','F4','F8','Q8','F16','F32','H32','Q32','F64','H64','FullPenny','PartPenny','PartNickle','EQT','V1','V2','V3','V4','V5','V6','V7','V8','V9','V10','V11','V12','V13','V14','V15','A0','A1','A2','A3','A4','A5','A6','A7','E32') NOT NULL DEFAULT 'None' COMMENT 'price display format code',
`stkPrc` FLOAT NOT NULL DEFAULT 0 COMMENT 'current stock price (any market session) (persists if market closed/halted)',
`stkBid` FLOAT NOT NULL DEFAULT 0 COMMENT 'current stock bid (any market session) (zero if market closed/halted)',
`stkAsk` FLOAT NOT NULL DEFAULT 0 COMMENT 'current stock ask (any market session) (zero if market closed/halted)',
`stkMark` DOUBLE NOT NULL DEFAULT 0 COMMENT 'current stock mark (freezes at SR CloseMarkTime)',
`stkMarkErrCodes` VARCHAR(255) NOT NULL DEFAULT 'None',
`stkMarkSource` ENUM('None','OpenMark','CloseMark','Print','LiveQuote','QuoteBound') NOT NULL DEFAULT 'None',
`stkOpnMidMark` DOUBLE NOT NULL DEFAULT 0 COMMENT 'start-of-day SR stock mark (rotated from prior day record) [corp action adjusted]',
`stkOpnClrMark` DOUBLE NOT NULL DEFAULT 0 COMMENT 'start-of-day CLR stock mark (supplied by client/clearing firm via clearing position load) [should be corp action adjusted]',
`stkOpnPosPrv` INT NOT NULL DEFAULT 0 COMMENT 'start-of-day SR share position (rotated from prior day record) [corp action adjusted]',
`stkOpnPosClr` INT NOT NULL DEFAULT 0 COMMENT 'start-of-day CLR share position (supplied by client/clearing firm via clearing position load) [should be corp action adjusted]',
`stkOpnPos` INT NOT NULL DEFAULT 0 COMMENT 'start of period share position (effective; can be from either CLR or SR)',
`stkOpnPosSrc` ENUM('None','Zero','SR','CLR') NOT NULL DEFAULT 'None' COMMENT 'start of period position source',
`shBot` INT NOT NULL DEFAULT 0 COMMENT 'number of shares bot today',
`shSld` INT NOT NULL DEFAULT 0 COMMENT 'number of shares sld today',
`shSldShrt` INT NOT NULL DEFAULT 0 COMMENT 'number of shares sld short today',
`shBotHdg` INT NOT NULL DEFAULT 0 COMMENT 'number of shares bot today from hedging (spdrSource=HedgeTool)',
`shSldHdg` INT NOT NULL DEFAULT 0 COMMENT 'number of shares sld today from hedging (spdrSource=HedgeTool)',
`shBotTrh` INT NOT NULL DEFAULT 0 COMMENT 'number of shares bot today from hedging (spdrSource=TradeHedge)',
`shSldTrh` INT NOT NULL DEFAULT 0 COMMENT 'number of shares sld today from hedging (spdrSource=TradeHedge)',
`shBotOpn` INT NOT NULL DEFAULT 0 COMMENT 'number of shares bot today from hedging (spdrSource=OpenHedge)',
`shSldOpn` INT NOT NULL DEFAULT 0 COMMENT 'number of shares sld today from hedging (spdrSource=OpenHedge)',
`shBotTrd` INT NOT NULL DEFAULT 0 COMMENT 'number of shares bot today from any trade hedging source (AutoHedge or Trades loop)',
`shSldTrd` INT NOT NULL DEFAULT 0 COMMENT 'number of shares sld today from any trade hedging source (AutoHedge or Trades loop)',
`stkMnyBot` DOUBLE NOT NULL DEFAULT 0 COMMENT 'sum of settle cash for all buy executions',
`stkMnySld` DOUBLE NOT NULL DEFAULT 0 COMMENT 'sum of settle cash for all sell executions',
`dayPnl` FLOAT NOT NULL DEFAULT 0,
`opnPnlMidMark` FLOAT NOT NULL DEFAULT 0,
`opnPnlClrMark` FLOAT NOT NULL DEFAULT 0,
`exDivAmt` FLOAT NOT NULL DEFAULT 0 COMMENT 'amount of any dividend going ex today',
`borrowRate` FLOAT NOT NULL DEFAULT 0 COMMENT 'overnight rate required to borrow stock (if known)',
`beta` FLOAT NOT NULL DEFAULT 0 COMMENT 'beta (usually beta to SPX; see AccountConfig.betaSource)',
`betaSource` ENUM('None','betaSPX','betaQQQ','betaIWM','clientBeta') NOT NULL DEFAULT 'None',
`marginUDn` FLOAT NOT NULL DEFAULT 0 COMMENT 'Aggregate RiskSlide: uPrc dn',
`marginUUp` FLOAT NOT NULL DEFAULT 0 COMMENT 'Aggregate RiskSlide: uPrc up',
`numExecutions` INT NOT NULL DEFAULT 0 COMMENT 'number of included SpdrParentExecution records',
`maxExecDttm` DATETIME(6) NOT NULL DEFAULT '1900-01-01 00:00:00.000000' COMMENT 'max (timestamp) of included SpdrParentExecution records',
`timestamp` DATETIME(6) NOT NULL DEFAULT '1900-01-01 00:00:00.000000',
PRIMARY KEY USING HASH (`ticker_tk`,`ticker_at`,`ticker_ts`,`accnt`,`tradeDate`,`riskSession`,`clientFirm`)
) ENGINE=SRSE DEFAULT CHARSET=LATIN1 COMMENT='StockPositionRecords are live risk records that contain start-of-day positions and all subsequent executions, including executions reported as done away.\nThese records are published by a CoreRiskServer and represent the position and risk markup detail for a single equity or ETF security.\nNew records are published immediately when a position changes and about once per minute if no position has changed.\nNote that all stock, future and option records for a single ticker are published simultaneously and records for the same chain should have consistent marks.';

SELECT TABLE EXAMPLE QUERY

SELECT
`ticker_at`,
`ticker_ts`,
`ticker_tk`,
`accnt`,
`tradeDate`,
`riskSession`,
`clientFirm`,
`riskServerCode`,
`priAggGroup`,
`secAggGroup`,
`symbolType`,
`tickValue`,
`pointValue`,
`pointCurrency`,
`priceFormat`,
`stkPrc`,
`stkBid`,
`stkAsk`,
`stkMark`,
`stkMarkErrCodes`,
`stkMarkSource`,
`stkOpnMidMark`,
`stkOpnClrMark`,
`stkOpnPosPrv`,
`stkOpnPosClr`,
`stkOpnPos`,
`stkOpnPosSrc`,
`shBot`,
`shSld`,
`shSldShrt`,
`shBotHdg`,
`shSldHdg`,
`shBotTrh`,
`shSldTrh`,
`shBotOpn`,
`shSldOpn`,
`shBotTrd`,
`shSldTrd`,
`stkMnyBot`,
`stkMnySld`,
`dayPnl`,
`opnPnlMidMark`,
`opnPnlClrMark`,
`exDivAmt`,
`borrowRate`,
`beta`,
`betaSource`,
`marginUDn`,
`marginUUp`,
`numExecutions`,
`maxExecDttm`,
`timestamp`
FROM `SRRisk`.`MsgStockPositionRecordV5`
WHERE
/* Replace with a ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') */
`ticker_at` = 'None'
AND
/* Replace with a ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','EUX','ANY','CXE','DXE','NXAM','NXBR','NXLS','NXML','NXOS','NXP','EUREX','CEDX','ICEFE') */
`ticker_ts` = 'None'
AND
/* Replace with a VARCHAR(12) */
`ticker_tk` = 'Example_ticker_tk'
AND
/* Replace with a VARCHAR(16) */
`accnt` = 'Example_accnt'
AND
/* Replace with a DATE */
`tradeDate` = '2022-01-01'
AND
/* Replace with a ENUM('Regular','PostClose') */
`riskSession` = 'Regular'
AND
/* Replace with a VARCHAR(16) */
`clientFirm` = 'Example_clientFirm';

Doc Columns Query

SELECT * FROM SRRisk.doccolumns WHERE TABLE_NAME='StockPositionRecordV5' ORDER BY ordinal_position ASC;