CREATE TABLE `SRTrade`.`MsgSRStrategyOrderLeggerX` (
`strategyNumber` BIGINT NOT NULL DEFAULT 0 COMMENT 'strategy order number',
`spdrSource` ENUM('None','SpdrTicket','SpdrSingle','SRSE','FIX','HedgeTool','TradeHedge','OpenHedge','AutoHedge','Orphan','RiskManager','OrderManager','ManagedOrder','RFQRespSrvr','Legger','SRSEDrop','FixDrop','TicketDrop','SysTest','RFRResponse','AllocOmni','AllocClient','CertGateway','MLegResponse','LeggerX','DropManager','AutoHedgeSrvr','AuctionStrategySrvr','AllocBlockFace','AllocBlockCust','IceChatGateway','EXS2SRC','MLinkResponse','AutoResponderVD','AutoResponderRC','AutoResponderSN','AutoResponderBX','MLink') NOT NULL DEFAULT 'None',
`accnt` VARCHAR(16) NOT NULL DEFAULT '' COMMENT 'SR trading account',
`clientFirm` VARCHAR(16) NOT NULL DEFAULT '' COMMENT 'SR client firm',
`strategyStatus` ENUM('None','Active','Hold','Closed') NOT NULL DEFAULT 'None',
`execBrkrCode` VARCHAR(16) NOT NULL DEFAULT '' COMMENT '(optional) override the default execBrkrCode for this order',
`externExDest` VARCHAR(16) NOT NULL DEFAULT '' COMMENT 'routing code for orders directed to an external order router (default = null); should match FixRoutingTable.destination (in SR accnt config)',
`externParams` TINYTEXT NOT NULL DEFAULT '' COMMENT 'external algo names/parameters (usually just an algo name)',
`strategy` VARCHAR(36) NOT NULL DEFAULT '' COMMENT 'client-supplied strategy string; visible on SpiderRock GUI tools and other order reports.',
`userName` VARCHAR(24) NOT NULL DEFAULT '' COMMENT 'name of the user entering the order',
`orderSize` INT NOT NULL DEFAULT 0 COMMENT 'strategy size (number of complete spreads)',
`leggerLimit` DOUBLE NOT NULL DEFAULT 0 COMMENT 'strategy limit',
`leggerLimitType` ENUM('None','Prc','PrcDe','PrcDeX') NOT NULL DEFAULT 'None' COMMENT 'strategy limit type',
`leggerAlgo` ENUM('None','LegCrossOnly','LegOutLoud') NOT NULL DEFAULT 'None',
`balanceHandling` ENUM('None','PostWith','PostTurn','PostImprove','PostLimit','MaxIntern','PostWthF','PostImprvR','PostFlash','PostFlashW','PostPeg','PostFlashI') NOT NULL DEFAULT 'None' COMMENT 'base parent order balance handling [make style algo]',
`legExposurePct` FLOAT NOT NULL DEFAULT 0 COMMENT 'percentage of legger order than can be exposed on a single leg without completing related legs',
`legCompletionSlippage` DOUBLE NOT NULL DEFAULT 0 COMMENT 'maximum leg price slippage to complete an open strategy order',
`marketSession` ENUM('None','PreMkt','RegMkt','PostMkt','PreRegMkt','RegPostMkt','AllDay') NOT NULL DEFAULT 'None',
`startDttm` DATETIME(6) NOT NULL DEFAULT '1900-01-01 00:00:00.000000' COMMENT '[optional] (parent order start time)',
`orderDuration` INT NOT NULL DEFAULT 0 COMMENT '[optional] (number of seconds)',
`goodTillDttm` DATETIME(6) NOT NULL DEFAULT '1900-01-01 00:00:00.000000' COMMENT '[optional] (default: 2099-01-01)',
`autoHedge` ENUM('None','Static','AutoMid','AutoCrx','AutoTrn','SpdrAuto','Spdr10S','Spdr30S','Spdr90S','Spdr5M','Spdr30M','SpdrDay','SmartFast','SmartNorm','FastCrx','FastDark','SlowDark','AlphaVwap1pct','AlphaVwap2pct','AlphaVwap5pct','AlphaVwap25pct','Custom','AwayAlgo') NOT NULL DEFAULT 'None',
`hedgeInstrument` ENUM('None','Default','FrontMonth','Stock','Future') NOT NULL DEFAULT 'None',
`hedgeSecKey_at` ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') NOT NULL DEFAULT 'None' COMMENT 'autohedge instrument (can be a TickerKey (stock) or ExpiryKey (future)) [required for Stock and Future]',
`hedgeSecKey_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' COMMENT 'autohedge instrument (can be a TickerKey (stock) or ExpiryKey (future)) [required for Stock and Future]',
`hedgeSecKey_tk` VARCHAR(12) NOT NULL DEFAULT '' COMMENT 'autohedge instrument (can be a TickerKey (stock) or ExpiryKey (future)) [required for Stock and Future]',
`hedgeSecKey_yr` SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'autohedge instrument (can be a TickerKey (stock) or ExpiryKey (future)) [required for Stock and Future]',
`hedgeSecKey_mn` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'autohedge instrument (can be a TickerKey (stock) or ExpiryKey (future)) [required for Stock and Future]',
`hedgeSecKey_dy` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'autohedge instrument (can be a TickerKey (stock) or ExpiryKey (future)) [required for Stock and Future]',
`hedgeBetaRatio` FLOAT NOT NULL DEFAULT 0 COMMENT 'portion of executed $money to auto-hedge (can be 1.0 / Beta for beta hedging) [-4.0 to +4.0]',
`hedgeScope` ENUM('None','Accnt','RiskGroup') NOT NULL DEFAULT 'None' COMMENT 'hedge group scope [RiskGroup or Accnt]',
`hedgeSession` ENUM('None','PreMkt','RegMkt','PostMkt','PreRegMkt','RegPostMkt','AllDay') NOT NULL DEFAULT 'None',
`externHedgeExDest` VARCHAR(16) NOT NULL DEFAULT '' COMMENT 'external broker exDest (only used if orderHandling=Extern) # Should match FixRoutingTable.destination type',
`externHedgeParams` TINYTEXT NOT NULL DEFAULT '' COMMENT 'external algo names/parameters (usually just an algo name)',
`userData1` TINYTEXT NOT NULL DEFAULT '' COMMENT 'client supplied data field; passes through to parent and child executions and reports as well as FIX drops',
`userData2` TINYTEXT NOT NULL DEFAULT '' COMMENT 'client supplied data field; passes through to parent and child executions and reports as well as FIX drops',
`childData` TINYTEXT NOT NULL DEFAULT '' COMMENT 'client supplied data field; passes through to down stream child orders',
`timestamp` DATETIME(6) NOT NULL DEFAULT '1900-01-01 00:00:00.000000',
`LegsList` JSON NOT NULL DEFAULT JSON_ARRAY() CHECK(JSON_VALID(LegsList)),
PRIMARY KEY USING HASH (`strategyNumber`)
) ENGINE=SRSE DEFAULT CHARSET=LATIN1 COMMENT='';