public override void onMessage(QuickFix42.SecurityDefinition securityDefinition, SessionID sessionID) { //Console.WriteLine("securityDefinition " + securityDefinition); try { SecurityType securityType = new SecurityType(); securityDefinition.getField(securityType); SecurityID securityID = new SecurityID(); securityDefinition.getField(securityID); //Create the object in the spreadmatrix; if(securityType.getValue() == SecurityType.MULTILEGINSTRUMENT) { string longUnderlyingMaturityMonthYear=null; string shortUnderlyingMaturityMonthYear=null; NoRelatedSym noRelatedSym = securityDefinition.getNoRelatedSym(); uint SubContractCount = (uint)noRelatedSym.getValue(); if (SubContractCount != 2) { //Console.WriteLine("I don't know how to handle an MLEG with " + SubContractCount + " legs."); return; } SecurityDefinition.NoRelatedSym group = new SecurityDefinition.NoRelatedSym(); for (uint i = 0; i < SubContractCount; i++) { securityDefinition.getGroup(i + 1, group); UnderlyingMaturityMonthYear underlyingMaturityMonthYear = new UnderlyingMaturityMonthYear(); group.getField(underlyingMaturityMonthYear); Side side = new Side(); group.getField(side); if (side.getValue() == QuickFix.Side.SELL) { shortUnderlyingMaturityMonthYear = underlyingMaturityMonthYear.getValue(); } else if (side.getValue() == QuickFix.Side.BUY) { longUnderlyingMaturityMonthYear = underlyingMaturityMonthYear.getValue(); } else { Console.WriteLine("Unsupport MLEG side: " + side.getValue()); return; } } spreadMatrix.CreateSpread(securityID.getValue(), longUnderlyingMaturityMonthYear, shortUnderlyingMaturityMonthYear); } else if (securityType.getValue() == SecurityType.FUTURE) { MaturityMonthYear maturityMonthYear = new MaturityMonthYear(); securityDefinition.getField(maturityMonthYear); spreadMatrix.CreateOutright(securityID.ToString(), maturityMonthYear.ToString()); } else { Console.WriteLine("Unsupport security type: " + securityType.getField()); return; } MarketDataRequest(securityDefinition, sessionID); } catch (Exception exception) { Console.WriteLine(exception.Message); } }