CREATE TABLE `SRRisk`.`MsgRiskCubeDetailV5` (
`accnt` VARCHAR(16) NOT NULL DEFAULT '' COMMENT 'SR Accnt',
`secKey_at` ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') NOT NULL DEFAULT 'None',
`secKey_ts` ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','ESX','ANY','CXE','DXE','NXAM','NXBR','NXDUB','NXLS','NXLDN','NXML','NXMLT','NXOS','NXP','EUREX','CEDX','ICEFE') NOT NULL DEFAULT 'None',
`secKey_tk` VARCHAR(12) NOT NULL DEFAULT '',
`secKey_yr` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`secKey_mn` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`secKey_dy` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`secKey_xx` DOUBLE NOT NULL DEFAULT 0,
`secKey_cp` ENUM('Call','Put','Pair') NOT NULL DEFAULT 'Call',
`secType` ENUM('None','Call','Put','Stock','Future','Cash') NOT NULL DEFAULT 'None' COMMENT '[Call, Put, Stock, Future, Cash]',
`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',
`version` ENUM('None','Live','EarlyArchive','LateArchive') NOT NULL DEFAULT 'None',
`clearingFirm` VARCHAR(8) NOT NULL DEFAULT '' COMMENT 'Clearing Firm',
`clearingAccnt` VARCHAR(16) NOT NULL DEFAULT '' COMMENT 'Clearing Firm Accnt',
`riskServerCode` VARCHAR(6) NOT NULL DEFAULT '' COMMENT 'SR RiskServer (server that published this record)',
`viewGroup1` VARCHAR(12) NOT NULL DEFAULT '' COMMENT 'Client defined view group #1 (can be fitered/aggregated)',
`viewGroup2` VARCHAR(12) NOT NULL DEFAULT '' COMMENT 'Client defined view group #2 (can be fitered/aggregated)',
`viewGroup3` VARCHAR(12) NOT NULL DEFAULT '' COMMENT 'Client defined view group #3 (can be fitered/aggregated)',
`ticker_at` ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') NOT NULL DEFAULT 'None' COMMENT 'Risk Symbol (underlier for equities; product group for future/option complexes)',
`ticker_ts` ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','ESX','ANY','CXE','DXE','NXAM','NXBR','NXDUB','NXLS','NXLDN','NXML','NXMLT','NXOS','NXP','EUREX','CEDX','ICEFE') NOT NULL DEFAULT 'None' COMMENT 'Risk Symbol (underlier for equities; product group for future/option complexes)',
`ticker_tk` VARCHAR(12) NOT NULL DEFAULT '' COMMENT 'Risk Symbol (underlier for equities; product group for future/option complexes)',
`riskClass` VARCHAR(8) NOT NULL DEFAULT '' COMMENT 'Symbol risk class (from SymbolControl record)',
`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' COMMENT 'Symbol type',
`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',
`sector` VARCHAR(16) NOT NULL DEFAULT '' COMMENT 'Client defined sector (from SymbolControl record)',
`indNum` INT NOT NULL DEFAULT 0 COMMENT 'Ind Num (00)',
`subNum` INT NOT NULL DEFAULT 0 COMMENT 'Sub Num (0000)',
`grpNum` INT NOT NULL DEFAULT 0 COMMENT 'Grp Num (000000)',
`nbrNum` INT NOT NULL DEFAULT 0 COMMENT 'Nbr Num (00000000)',
`eDays` SMALLINT NOT NULL DEFAULT 0 COMMENT 'days to next earnings [-5, +30]',
`dDays` SMALLINT NOT NULL DEFAULT 0 COMMENT 'days to next dividend [-5, +30]',
`xDelta` FLOAT NOT NULL DEFAULT 0 COMMENT 'calls = +0.5 - delta; puts = -0.5 - delta',
`expCode` ENUM('None','W1','W2','M1','M2','M34','M56','M7C','Y1','Y2') NOT NULL DEFAULT 'None' COMMENT 'Time-to-expiry code (W1, W2, M1, M2, M34, M56, M7C, Y1, Y2)',
`skewCode` ENUM('None','DD','DN','AT','UP','DU') NOT NULL DEFAULT 'None' COMMENT 'Skew bucket code (Dd=Deep DownSide, Dn = DownSide, At = ATM, Up = UpSide, DU = FarUpSide)',
`eDaysCode` ENUM('None','Past','eDay_0','eDay_1','eDays_2_3','eDays_4_5','eDays_6_10','eDays_11_25','eDays_26_65') NOT NULL DEFAULT 'None' COMMENT 'Days to next earnings event (if any)',
`iVolRange` ENUM('None','iVolRng_01_03','iVolRng_03_06','iVolRng_06_09','iVolRng_09_12','iVolRng_12_15','iVolRng_15_20','iVolRng_20_25','iVolRng_25_35','iVolRng_35_50','iVolRng_50_80','iVolRng_80_up') NOT NULL DEFAULT 'None' COMMENT 'Implied ATM Vol Range',
`skewDD` FLOAT NOT NULL DEFAULT 0 COMMENT 'dd (deep downside) skew metric (xde < -0.30)',
`skewDN` FLOAT NOT NULL DEFAULT 0 COMMENT 'dn (downside) skew metric (-0.30 < xde < -0.10)',
`skewAT` FLOAT NOT NULL DEFAULT 0 COMMENT 'at (atm) skew risk metric (-0.10 < xde < +0.10)',
`skewUP` FLOAT NOT NULL DEFAULT 0 COMMENT 'up (upside) skew risk metric (+0.10 < xde < +0.30)',
`skewDU` FLOAT NOT NULL DEFAULT 0 COMMENT 'du (far upside) skew risk metric (+0.30 < xde)',
`shOpnPos` INT NOT NULL DEFAULT 0 COMMENT 'shares (start-of-day)',
`fcOpnPos` INT NOT NULL DEFAULT 0 COMMENT 'futures contracts (start-of-day)',
`cnOpnPos` INT NOT NULL DEFAULT 0 COMMENT 'options contracts (start-of-day)',
`cnAtmEquiv` FLOAT NOT NULL DEFAULT 0 COMMENT 'atm equivalent contracts; (opr.cnOpnPos + opr.cnBot - opr.cnSld) * opr.ve / opr.atmVega',
`shBot` INT NOT NULL DEFAULT 0 COMMENT 'shares bot',
`shSld` INT NOT NULL DEFAULT 0 COMMENT 'shares sld',
`shSldShrt` INT NOT NULL DEFAULT 0 COMMENT 'shares sld short',
`fcBot` INT NOT NULL DEFAULT 0 COMMENT 'future contracts bot',
`fcSld` INT NOT NULL DEFAULT 0 COMMENT 'future contracts sld',
`cnBot` INT NOT NULL DEFAULT 0 COMMENT 'option contracts bot',
`cnSld` INT NOT NULL DEFAULT 0 COMMENT 'option contracts sld',
`cnOpened` INT NOT NULL DEFAULT 0 COMMENT 'option contracts opened',
`cnClosed` INT NOT NULL DEFAULT 0 COMMENT 'option contracts closed',
`opnDir` VARCHAR(2) NOT NULL DEFAULT '' COMMENT 'open (start-of-day) direction (LN or SH)',
`posDir` VARCHAR(2) NOT NULL DEFAULT '' COMMENT 'current (start-of-day + trades) direction (LN or SH)',
`unitOpnPos` INT NOT NULL DEFAULT 0 COMMENT 'effective opening position (shares or cn * underlierPerCn) (start-of-day)',
`unitCurPos` INT NOT NULL DEFAULT 0 COMMENT 'effective current position (shares or cn * underlierPerCn) (start-of-day + trades)',
`unitQtyBot` INT NOT NULL DEFAULT 0 COMMENT 'effective shares bot (shares or cn * underlierPerCn)',
`unitQtySld` INT NOT NULL DEFAULT 0 COMMENT 'effective shares sld (shares or cn * underlierPerCn)',
`dayPnl` FLOAT NOT NULL DEFAULT 0 COMMENT 'day pnl',
`dayDnPnl` FLOAT NOT NULL DEFAULT 0 COMMENT 'day pnl (delta neutral)',
`dayTrdDelta` FLOAT NOT NULL DEFAULT 0 COMMENT 'day trade delta',
`dayTrdDDelta` FLOAT NOT NULL DEFAULT 0 COMMENT 'day trade $delta',
`dayTrdGamma` FLOAT NOT NULL DEFAULT 0 COMMENT 'day trade gamma',
`dayTrdDGamma` FLOAT NOT NULL DEFAULT 0 COMMENT 'day trade $gamma',
`dayTrdVega` FLOAT NOT NULL DEFAULT 0 COMMENT 'day trade vega',
`dayTrdWVega` FLOAT NOT NULL DEFAULT 0 COMMENT 'day trade wVega (vega * vol)',
`dayTrdTVega` FLOAT NOT NULL DEFAULT 0 COMMENT 'day trade tVega (vega / sqrt(max(0.1, years * 4)))',
`dayTrdWtVega` FLOAT NOT NULL DEFAULT 0 COMMENT 'day trade wtVega (vega * vol / sqrt(max(0.1, years * 4)))',
`dayTrdTheta` FLOAT NOT NULL DEFAULT 0 COMMENT 'day trade theta',
`dayEdgeOpened` FLOAT NOT NULL DEFAULT 0 COMMENT 'day theo option edge opened (requires a theo model)',
`dayEdgeClosed` FLOAT NOT NULL DEFAULT 0 COMMENT 'day theo option edge closed (requires a theo model)',
`dayMnyBot` DOUBLE NOT NULL DEFAULT 0 COMMENT 'day money bot',
`dayMnySld` DOUBLE NOT NULL DEFAULT 0 COMMENT 'day money sld',
`opnPnlVolMark` FLOAT NOT NULL DEFAULT 0 COMMENT '(cur.surface - pr.surface) * cnOpnClr * upc',
`opnPnlMidMark` FLOAT NOT NULL DEFAULT 0 COMMENT '(cur.mid - pr.mid) * cnOpnClr * upc',
`opnPnlClrMark` FLOAT NOT NULL DEFAULT 0 COMMENT '(cur.mid - pr.clr) * cnOpnClr * upc',
`opnMarkBrkMny` FLOAT NOT NULL DEFAULT 0 COMMENT '(cur.surface - cur.mid) * cnOpnClr * upc',
`opnTheoEdge` FLOAT NOT NULL DEFAULT 0 COMMENT 'opening edge (edge at the end of prior period) (requires a theo model)',
`posTheoEdge` FLOAT NOT NULL DEFAULT 0 COMMENT 'current edge (opening positions + trades) (requires a theo model)',
`tVolMove` FLOAT NOT NULL DEFAULT 0 COMMENT 'LN(tVol / tVolPr)',
`tEdgeMove` FLOAT NOT NULL DEFAULT 0 COMMENT 'LN(tVol / iVol) - LN(tVolPr / iVolPr)',
`tEdge` FLOAT NOT NULL DEFAULT 0 COMMENT 'LN(tVol / iVol)',
`opnPnlDe` FLOAT NOT NULL DEFAULT 0 COMMENT 'open position * mult * hedgeDe * dUPrc ( pnlSD = sum(pnlDe) [stock + futures + options] )',
`opnPnlGa` FLOAT NOT NULL DEFAULT 0 COMMENT 'open position * mult * 0.5 * optGamma * dUPrc * dUPrc',
`opnPnlTh` FLOAT NOT NULL DEFAULT 0 COMMENT 'open position * mult * optTheta * dTime',
`opnPnlVe` FLOAT NOT NULL DEFAULT 0 COMMENT 'open position * mult * optVega * dVol',
`opnPnlVo` FLOAT NOT NULL DEFAULT 0 COMMENT 'open position * mult * 0.5 * optVolga * dVol * dVol',
`opnPnlVa` FLOAT NOT NULL DEFAULT 0 COMMENT 'open position * mult * optVanna * dVol * dUPrc',
`opnPnlSl` FLOAT NOT NULL DEFAULT 0 COMMENT 'open position * mult * vol/uPrc * slope * optVega * dUPrc',
`opnPnlRate` FLOAT NOT NULL DEFAULT 0 COMMENT 'open position * mult * optRho * dRate',
`opnPnlSDiv` FLOAT NOT NULL DEFAULT 0 COMMENT 'open position * mult * optPhi * dSDv',
`opnPnlDDiv` FLOAT NOT NULL DEFAULT 0 COMMENT 'open position * mult * optPhi * dDDv',
`opnPnlErr` FLOAT NOT NULL DEFAULT 0 COMMENT 'unattributed pnl: SR Vol Pnl - opnPnlDe - opnPnlGa - opnPnlTh - opnPnlVe - opnPnlRat - opnPnlSDiv - opnPnlDDiv',
`opnEdgeChange` FLOAT NOT NULL DEFAULT 0 COMMENT 'open position * mult * (tEdge - tEdgePr) (requires a theo model)',
`posDelta` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * hedgeDe',
`posDDelta` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * hedgeDe * UPrc',
`posDBeta` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * hedgeDe * beta * UPrc',
`posGamma` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * optGamma',
`posDGamma` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * optGamma * uPrc * uPrc / 100',
`posVega` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * optVega',
`posWVega` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * optVega * iVol',
`posTVega` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * optVega / sqrt(max(0.1, years * 4))',
`posWtVega` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * optVega * iVol / sqrt(max(0.1, years * 4))',
`posVolga` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * optVolg',
`posVanna` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * optVanna',
`posTheta` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * optTheta',
`posRho` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * optRho',
`posPhi` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * optPhi',
`posNotional` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * uPrc',
`posMktValue` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * SR surface mark',
`posPremOPar` FLOAT NOT NULL DEFAULT 0 COMMENT 'live position * mult * premium over parity',
`atmVol` FLOAT NOT NULL DEFAULT 0 COMMENT 'atm volatility',
`symVol` FLOAT NOT NULL DEFAULT 0 COMMENT 'underlier symbol volatility (term.21d;censored)',
`srSlope` FLOAT NOT NULL DEFAULT 0 COMMENT 'strike veSlope (sr surface;options only)',
`prcSVol` FLOAT NOT NULL DEFAULT 0 COMMENT 'SR Surface Vol',
`prcTOpx` FLOAT NOT NULL DEFAULT 0 COMMENT 'SR Surface Price',
`prcYOpx` FLOAT NOT NULL DEFAULT 0 COMMENT 'SR Yesterday Surface Price',
`prcUPrc` FLOAT NOT NULL DEFAULT 0 COMMENT 'underlier price',
`prcYears` FLOAT NOT NULL DEFAULT 0 COMMENT 'years-to-expiry',
`prcRate` FLOAT NOT NULL DEFAULT 0 COMMENT 'discount rate-to-expiry',
`prcSdiv` FLOAT NOT NULL DEFAULT 0 COMMENT 'continuous stock div rate-to-expiry',
`prcDdiv` FLOAT NOT NULL DEFAULT 0 COMMENT 'cumulative discrete dividend paid through expiry',
`uPrcRatio` FLOAT NOT NULL DEFAULT 0 COMMENT 'stock price multiplier',
`uPrcMove` FLOAT NOT NULL DEFAULT 0 COMMENT 'Underlier price change',
`iVolMove` FLOAT NOT NULL DEFAULT 0 COMMENT 'Implied vol change (fixed strike ivol change from prior period)',
`exDivAmt` FLOAT NOT NULL DEFAULT 0 COMMENT 'estimated exDiv amount (if any)',
`borrowRate` FLOAT NOT NULL DEFAULT 0 COMMENT 'estimated stock borrow rate (if any)',
`modelType` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'SRPricingLib.CalcModelType',
`underliersPerCn` INT NOT NULL DEFAULT 0 COMMENT 'underliers per contract',
`underlierType` ENUM('None','Equity','Other','FX') NOT NULL DEFAULT 'None' COMMENT 'underlier type (used for option pricing)',
`pointValue` FLOAT NOT NULL DEFAULT 0 COMMENT 'value of one point',
`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',
`tickValue` FLOAT NOT NULL DEFAULT 0 COMMENT 'value of one tick',
`multihedge` ENUM('None','Simple','Complex','AllCash','Binary','Fragment') NOT NULL DEFAULT 'None',
`multihedgeSource_at` ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') NOT NULL DEFAULT 'None' COMMENT 'MH Ticker Key (starts with ''_'') (if exists)',
`multihedgeSource_ts` ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','ESX','ANY','CXE','DXE','NXAM','NXBR','NXDUB','NXLS','NXLDN','NXML','NXMLT','NXOS','NXP','EUREX','CEDX','ICEFE') NOT NULL DEFAULT 'None' COMMENT 'MH Ticker Key (starts with ''_'') (if exists)',
`multihedgeSource_tk` VARCHAR(12) NOT NULL DEFAULT '' COMMENT 'MH Ticker Key (starts with ''_'') (if exists)',
`multihedgePVRatio` FLOAT NOT NULL DEFAULT 0 COMMENT 'pv multiplier (fraction of underlier value (uPerCn x uPrc) / SUM(uPerCn x uPrc) associated with this fragment',
`spanPrcIncUp` FLOAT NOT NULL DEFAULT 0 COMMENT 'default (exchange) span price up increment for this asset',
`spanPrcIncDn` FLOAT NOT NULL DEFAULT 0 COMMENT 'default (exchange) span price dn increment for this asset',
`spanVolInc` FLOAT NOT NULL DEFAULT 0 COMMENT 'default (exchange) span volatility increment for this asset',
`prcSpanType` ENUM('None','Pts','Pct','Log') NOT NULL DEFAULT 'None' COMMENT 'exchange prcSpan type',
`volSpanType` ENUM('None','Pts','Pct','Log') NOT NULL DEFAULT 'None' COMMENT 'exchange volSpan type',
`spanPricingModel` ENUM('None','BS','B','M','W','WS','WB','CA','CE','I') NOT NULL DEFAULT 'None' COMMENT 'Exchange-defined model for SPAN option pricing calcs',
`marginType` ENUM('None','NMS_Equity','NMS_Index','NMS_Medium') NOT NULL DEFAULT 'None' COMMENT 'margin slide type: NMS_Equity = +/- 15%, NMS_Index = -8%/+6%, NMS_Medium = +/-10%',
`timestamp` DATETIME(6) NOT NULL DEFAULT '1900-01-01 00:00:00.000000',
PRIMARY KEY USING HASH (`accnt`,`secKey_tk`,`secKey_yr`,`secKey_mn`,`secKey_dy`,`secKey_xx`,`secKey_cp`,`secKey_at`,`secKey_ts`,`secType`,`tradeDate`,`riskSession`,`clientFirm`)
) ENGINE=SRSE DEFAULT CHARSET=LATIN1 COMMENT='RiskCubeDetail records are published by CoreRiskServers and are designed to be aggregated and analyzed over time.\nRiskCubeDetail records are published to the SpiderRock Archive Host data pipeline at the end of each trading period.';