public void MarketDataRequest(QuickFix42.SecurityDefinition securityDefinition) { QuickFix42.MarketDataRequest marketDataRequest = new QuickFix42.MarketDataRequest(new MDReqID(DateTime.Now.ToString()), new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES), new MarketDepth(1)); marketDataRequest.setField(new MDUpdateType(MDUpdateType.FULL_REFRESH)); marketDataRequest.setField(new AggregatedBook(true)); QuickFix42.MarketDataRequest.NoMDEntryTypes marketDataEntyGroupBid = new QuickFix42.MarketDataRequest.NoMDEntryTypes(); marketDataEntyGroupBid.set(new MDEntryType(MDEntryType.BID)); marketDataRequest.addGroup(marketDataEntyGroupBid); QuickFix42.MarketDataRequest.NoMDEntryTypes marketDataEntyGroupOffer = new QuickFix42.MarketDataRequest.NoMDEntryTypes(); marketDataEntyGroupOffer.set(new MDEntryType(MDEntryType.OFFER)); marketDataRequest.addGroup(marketDataEntyGroupOffer); /** Create Component Block NoRelatedSym */ QuickFix42.MarketDataRequest.NoRelatedSym noRelatedSym = new QuickFix42.MarketDataRequest.NoRelatedSym(); SecurityExchange securityExchange = new SecurityExchange(); securityDefinition.getField(securityExchange); noRelatedSym.setField(securityExchange); SecurityType securityType = new SecurityType(); securityDefinition.getField(securityType); noRelatedSym.setField(securityType); Symbol symbol = new Symbol(); securityDefinition.getField(symbol); noRelatedSym.setField(symbol); //MaturityMonthYear maturityMonthYear = new MaturityMonthYear(); //securityDefinition.getField(maturityMonthYear); //noRelatedSym.setField(maturityMonthYear); SecurityID securityId = new SecurityID(); securityDefinition.getField(securityId); noRelatedSym.setField(securityId); marketDataRequest.addGroup(noRelatedSym); Session.sendToTarget(marketDataRequest, GetPriceSession()); }
public override void onMessage(QuickFix42.OrderCancelReject message, SessionID session) { OrderCancelReject reject = new OrderCancelReject(); // required fields reject.TransactTime = Clock.Now; reject.OrderID = message.getOrderID().getValue(); reject.ClOrdID = message.getClOrdID().getValue(); reject.OrigClOrdID = message.getOrigClOrdID().getValue(); (reject as FIXOrderCancelReject).OrdStatus = message.getOrdStatus().getValue(); (reject as FIXOrderCancelReject).CxlRejResponseTo = message.getCxlRejResponseTo().getValue(); (reject as FIXOrderCancelReject).CxlRejReason = message.getCxlRejReason().getValue(); // optional fields if (message.isSetSecondaryOrderID()) reject.SecondaryOrderID = message.getSecondaryOrderID().getValue(); if (message.isSetAccount()) reject.Account = message.getAccount().getValue(); if (message.isSetText()) reject.Text = message.getText().getValue(); // event provider.EmitOrderCancelReject(reject); }
public void Send(QuickFix42.Message message) { Session.sendToTarget(message, _ssnid); }
public void Send(QuickFix42.OrderStatusRequest message) { Session.sendToTarget(message, _ssnid); }
public void Send(QuickFix42.NewOrderSingle message) { Session.sendToTarget(message, _ssnid); }
public override void onMessage(QuickFix42.ExecutionReport report, SessionID sessionID) { if (ExecutionReport != null) { ExecutionReport(sessionID, new ExecutionReportEventArgs(report)); } }
// Methods public OrderCancelRejectEventArgs(QuickFix42.OrderCancelReject reject) { this.reject = reject; }
public override void onMessage(QuickFix42.NewOrderSingle message, SessionID sessionID) { process(message, sessionID); }
public override sealed void onMessage(QuickFix42.SettlementInstructions message, SessionID session) { Fix.Out(new StackTrace(new StackFrame(true)).GetFrame(0).GetMethod().ToString()); }
public override sealed void onMessage(QuickFix42.SecurityDefinitionRequest message, SessionID session) { Fix.Out(new StackTrace(new StackFrame(true)).GetFrame(0).GetMethod().ToString()); }
public override sealed void onMessage(QuickFix42.Reject message, SessionID session) { Fix.Out(new StackTrace(new StackFrame(true)).GetFrame(0).GetMethod().ToString()); MsgReject(message, session); }
public override sealed void onMessage(QuickFix42.QuoteCancel message, SessionID session) { Fix.Out(new StackTrace(new StackFrame(true)).GetFrame(0).GetMethod().ToString()); }
public override sealed void onMessage(QuickFix42.MarketDataSnapshotFullRefresh message, SessionID session) { Fix.Out(new StackTrace(new StackFrame(true)).GetFrame(0).GetMethod().ToString()); }
public override sealed void onMessage(QuickFix42.IndicationofInterest message, SessionID session) { Fix.Out(new StackTrace(new StackFrame(true)).GetFrame(0).GetMethod().ToString()); }
public override void onMessage(QuickFix42.ExecutionReport report, QuickFix.SessionID sessionID) { if (report.getExecType().getValue() == QuickFix.ExecType.PENDING_CANCEL || report.getExecType().getValue() == QuickFix.ExecType.CANCELED || report.getExecType().getValue() == QuickFix.ExecType.PENDING_REPLACE || report.getExecType().getValue() == QuickFix.ExecType.REPLACE) { object request = cancelRequests[report.getClOrdID().getValue()]; if (request == null) report.set(new OrigClOrdID(report.getClOrdID().getValue())); else { if (request is FIXOrderCancelRequest) report.set(new OrigClOrdID((request as FIXOrderCancelRequest).OrigClOrdID)); if (request is FIXOrderCancelReplaceRequest) report.set(new OrigClOrdID((request as FIXOrderCancelReplaceRequest).OrigClOrdID)); } } ExecutionReport Report = new ExecutionReport(); if (report.isSetOrderID()) Report.OrderID = report.getOrderID().getValue(); ////if (report.isSetSecondaryOrderID()) Report.SecondaryOrderID = report.getSecondaryOrderID().getValue(); if (report.isSetClOrdID()) Report.ClOrdID = report.getClOrdID().getValue(); if (report.isSetOrigClOrdID()) Report.OrigClOrdID = report.getOrigClOrdID().getValue(); ////if (report.isSetListID()) Report.ListID = report.getListID().getValue(); if (report.isSetExecID()) Report.ExecID = report.getExecID().getValue(); ////if (report.isSetExecRefID()) Report.ExecRefID = report.getExecRefID().getValue(); if (report.isSetExecType()) (Report as FIXExecutionReport).ExecType = report.getExecType().getValue(); if (report.isSetOrdStatus()) (Report as FIXExecutionReport).OrdStatus = report.getOrdStatus().getValue(); if (report.isSetOrdRejReason()) Report.OrdRejReason = report.getOrdRejReason().getValue(); ////if (report.isSetExecRestatementReason()) Report.ExecRestatementReason = report.getExecRestatementReason().getValue(); ////if (report.isSetAccount()) Report.Account = report.getAccount().getValue(); ////if (report.isSetSettlmntTyp()) Report.SettlType = report.getSettlmntTyp().getValue(); //if (report.isSetFutSettDate ()) Report.FutSettDate = report.getFutSettDate ().getValue(); if (report.isSetSymbol()) Report.Symbol = report.getSymbol().getValue(); ////if (report.isSetSymbolSfx()) Report.SymbolSfx = report.getSymbolSfx().getValue(); ////if (report.isSetSecurityID()) Report.SecurityID = report.getSecurityID().getValue(); //if (report.isSetIDSource ()) Report.IDSource = report.getIDSource ().getValue(); ////if (report.isSetSecurityType()) Report.SecurityType = report.getSecurityType().getValue(); ////if (report.isSetMaturityMonthYear()) Report.MaturityMonthYear = report.getMaturityMonthYear().getValue(); //if (report.isSetMaturityDay ()) Report.MaturityDate = DateTime.Parse(report.getMaturityDay ().getValue()); //if (report.isSetPutOrCall ()) Report.PutOrCall = report.getPutOrCall ().getValue(); ////if (report.isSetStrikePrice()) Report.StrikePrice = report.getStrikePrice().getValue(); ////if (report.isSetOptAttribute()) Report.OptAttribute = report.getOptAttribute().getValue(); ////if (report.isSetContractMultiplier()) Report.ContractMultiplier = report.getContractMultiplier().getValue(); ////if (report.isSetCouponRate()) Report.CouponRate = report.getCouponRate().getValue(); ////if (report.isSetSecurityExchange()) Report.SecurityExchange = report.getSecurityExchange().getValue(); ////if (report.isSetIssuer()) Report.Issuer = report.getIssuer().getValue(); ////if (report.isSetEncodedIssuerLen()) Report.EncodedIssuerLen = report.getEncodedIssuerLen().getValue(); ////if (report.isSetEncodedIssuer()) Report.EncodedIssuer = report.getEncodedIssuer().getValue(); ////if (report.isSetSecurityDesc()) Report.SecurityDesc = report.getSecurityDesc().getValue(); ////if (report.isSetEncodedSecurityDescLen()) Report.EncodedSecurityDescLen = report.getEncodedSecurityDescLen().getValue(); ////if (report.isSetEncodedSecurityDesc()) Report.EncodedSecurityDesc = report.getEncodedSecurityDesc().getValue(); if (report.isSetSide()) (Report as FIXExecutionReport).Side = report.getSide().getValue(); if (report.isSetOrderQty()) Report.OrderQty = report.getOrderQty().getValue(); ////if (report.isSetCashOrderQty()) Report.CashOrderQty = report.getCashOrderQty().getValue(); if (report.isSetOrdType()) (Report as FIXExecutionReport).OrdType = report.getOrdType().getValue(); if (report.isSetPrice()) Report.Price = report.getPrice().getValue(); ////if (report.isSetStopPx()) Report.StopPx = report.getStopPx().getValue(); //if (report.isSetPegDifference ()) Report.PegDifference = report.getPegDifference ().getValue(); ////if (report.isSetDiscretionInst()) Report.DiscretionInst = report.getDiscretionInst().getValue(); ////if (report.isSetDiscretionOffset()) Report.DiscretionOffsetValue = report.getDiscretionOffset().getValue(); ////if (report.isSetCurrency()) Report.Currency = report.getCurrency().getValue(); ////if (report.isSetComplianceID()) Report.ComplianceID = report.getComplianceID().getValue(); //if (report.isSetSolicitedFlag ()) Report.SolicitedFlag = report.getSolicitedFlag ().getValue(); ////if (report.isSetTimeInForce()) (Report as FIXExecutionReport).TimeInForce = report.getTimeInForce().getValue(); ////if (report.isSetEffectiveTime()) Report.EffectiveTime = report.getEffectiveTime().getValue(); ////if (report.isSetExpireDate()) Report.ExpireDate = DateTime.Parse(report.getExpireDate().getValue()); ////if (report.isSetExpireTime()) Report.ExpireTime = report.getExpireTime().getValue(); ////if (report.isSetExecInst()) Report.ExecInst = report.getExecInst().getValue(); //if (report.isSetRule80A ()) Report.Rule80A = report.getRule80A ().getValue(); if (report.isSetLastShares()) Report.LastQty = report.getLastShares().getValue(); if (report.isSetLastPx()) Report.LastPx = report.getLastPx().getValue(); ////if (report.isSetLastSpotRate()) Report.LastSpotRate = report.getLastSpotRate().getValue(); ////if (report.isSetLastForwardPoints()) Report.LastForwardPoints = report.getLastForwardPoints().getValue(); ////if (report.isSetLastMkt()) Report.LastMkt = report.getLastMkt().getValue(); ////if (report.isSetTradingSessionID()) Report.TradingSessionID = report.getTradingSessionID().getValue(); ////if (report.isSetLastCapacity()) Report.LastCapacity = report.getLastCapacity().getValue(); if (report.isSetLeavesQty()) Report.LeavesQty = report.getLeavesQty().getValue(); if (report.isSetCumQty()) Report.CumQty = report.getCumQty().getValue(); if (report.isSetAvgPx()) Report.AvgPx = report.getAvgPx().getValue(); ////if (report.isSetDayOrderQty()) Report.DayOrderQty = report.getDayOrderQty().getValue(); ////if (report.isSetDayCumQty()) Report.DayCumQty = report.getDayCumQty().getValue(); ////if (report.isSetDayAvgPx()) Report.DayAvgPx = report.getDayAvgPx().getValue(); ////if (report.isSetGTBookingInst()) Report.GTBookingInst = report.getGTBookingInst().getValue(); ////if (report.isSetTradeDate()) Report.TradeDate = DateTime.Parse(report.getTradeDate().getValue()); if (report.isSetTransactTime()) Report.TransactTime = report.getTransactTime().getValue(); //if (report.isSetReportToExch ()) Report.ReportToExch = report.getReportToExch ().getValue(); ////if (report.isSetCommission()) Report.Commission = report.getCommission().getValue(); ////if (report.isSetCommType()) (Report as FIXExecutionReport).CommType = report.getCommType().getValue(); ////if (report.isSetGrossTradeAmt()) Report.GrossTradeAmt = report.getGrossTradeAmt().getValue(); ////if (report.isSetSettlCurrAmt()) Report.SettlCurrAmt = report.getSettlCurrAmt().getValue(); ////if (report.isSetSettlCurrency()) Report.SettlCurrency = report.getSettlCurrency().getValue(); ////if (report.isSetHandlInst()) Report.HandlInst = report.getHandlInst().getValue(); ////if (report.isSetMinQty()) Report.MinQty = report.getMinQty().getValue(); ////if (report.isSetMaxFloor()) Report.MaxFloor = report.getMaxFloor().getValue(); //if (report.isSetOpenClose ()) Report.OpenClose = report.getOpenClose ().getValue(); ////if (report.isSetMaxShow()) Report.MaxShow = report.getMaxShow().getValue(); if (report.isSetText()) Report.Text = report.getText().getValue(); ////if (report.isSetEncodedTextLen()) Report.EncodedTextLen = report.getEncodedTextLen().getValue(); ////if (report.isSetEncodedText()) Report.EncodedText = report.getEncodedText().getValue(); //if (report.isSetFutSettDate2 ()) Report.FutSettDate2 = report.getFutSettDate2 ().getValue(); ////if (report.isSetOrderQty2()) Report.OrderQty2 = report.getOrderQty2().getValue(); //if (report.isSetClearingFirm ()) Report.ClearingFirm = report.getClearingFirm ().getValue(); //if (report.isSetClearingAccount ()) Report.ClearingAccount = report.getClearingAccount ().getValue(); ////if (report.isSetMultiLegReportingType()) Report.MultiLegReportingType = report.getMultiLegReportingType().getValue(); // SingleOrder order; if (Report.ExecType == SmartQuant.FIX.ExecType.PendingCancel || Report.ExecType == SmartQuant.FIX.ExecType.Cancelled || Report.ExecType == SmartQuant.FIX.ExecType.PendingReplace || Report.ExecType == SmartQuant.FIX.ExecType.Replace) order = OrderManager.Orders.All[Report.OrigClOrdID] as SingleOrder; else order = OrderManager.Orders.All[Report.ClOrdID] as SingleOrder; Instrument instrument = order.Instrument; Report.Symbol = instrument.Symbol; Report.TransactTime = Clock.Now; // emit execution report EmitExecutionReport(Report); }
public override void onMessage(QuickFix42.MarketDataRequestReject marketDataRequestReject, SessionID sessionID) { Console.WriteLine("marketDataRequestReject " + marketDataRequestReject); }
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); } }
public override sealed void onMessage(QuickFix42.TradingSessionStatusRequest message, SessionID session) { Fix.Out(new StackTrace(new StackFrame(true)).GetFrame(0).GetMethod().ToString()); }
public override void onMessage(QuickFix42.SecurityDefinition message, SessionID sessionID) { QuickFix42.SecurityDefinition echo = message; try { Session.sendToTarget(echo, sessionID); } catch (SessionNotFound) { } }
public override void onMessage(QuickFix42.ExecutionReport executionReport, SessionID sessionID) { AddText("executionReport " + executionReport + Environment.NewLine); OrderController.Instance.UpdateOrderStatus(executionReport); if (ExecutionReportRecieved != null) ExecutionReportRecieved(this, executionReport); }
// Methods public ExecutionReportEventArgs(QuickFix42.ExecutionReport report) { this.report = report; }
public override void onMessage(QuickFix42.SecurityDefinition securityDefinition, SessionID sessionID) { AddText("securityDefinition " + securityDefinition + Environment.NewLine); try { SecurityExchange securityExchange = new SecurityExchange(); securityDefinition.getField(securityExchange); Symbol symbol = new Symbol(); securityDefinition.getField(symbol); SecurityType securityType = new SecurityType(); securityDefinition.getField(securityType); SpreadMatrixData smd = SpreadMatrixCollection.Get(securityExchange.getValue(), symbol.getValue()); if (smd != null) { SecurityEntry entry = new SecurityEntry(securityDefinition); smd.Add(entry); MarketDataRequest(securityDefinition); } } catch (Exception exception) { AddText(exception.Message + Environment.NewLine); throw; } }
public override void onMessage(QuickFix42.OrderCancelReject message, SessionID SessionID) { if (OrderCancelReject != null) { OrderCancelReject(SessionID, new OrderCancelRejectEventArgs(message)); } }
public override void onMessage(QuickFix42.MarketDataSnapshotFullRefresh marketDataSnapshotFullRefresh, SessionID sessionID) { //AddText("marketDataSnapshotFullRefresh " + marketDataSnapshotFullRefresh + Environment.NewLine); string exchange = marketDataSnapshotFullRefresh.getSecurityExchange().ToString(); string symbol = marketDataSnapshotFullRefresh.getSymbol().ToString(); SpreadMatrixData smd = SpreadMatrixCollection.Get(exchange, symbol); if (smd == null) return; SpreadMatrixCollection.ProcessMessage(exchange, symbol, marketDataSnapshotFullRefresh); SecurityEntry entry = smd.Get(marketDataSnapshotFullRefresh.getSecurityID().getValue()); //testing order //if (entry != null) // ProccessOrder(entry); }
public void Send(QuickFix42.OrderCancelRequest message) { string ClOrdID = message.getClOrdID().getValue(); if (!fCancelRequests.ContainsKey(ClOrdID)) { this.fCancelRequests.Add(ClOrdID, message); Session.sendToTarget(message, _ssnid); } else { Console.WriteLine("Order " + ClOrdID + " already pending cancel process"); } }
public override void onMessage(QuickFix42.MarketDataRequestReject marketDataRequestReject, SessionID sessionID) { AddText("marketDataRequestReject " + marketDataRequestReject + Environment.NewLine); }
public void Send(QuickFix42.DontKnowTrade message) { Session.sendToTarget(message, _ssnid); }
public override void onMessage(QuickFix42.MarketDataSnapshotFullRefresh marketDataSnapshotFullRefresh, SessionID sessionID) { //Console.WriteLine("marketDataSnapshotFullRefresh " + marketDataSnapshotFullRefresh); uint numberOfEntries = (uint)marketDataSnapshotFullRefresh.getNoMDEntries().getValue(); if (numberOfEntries > 2) { Console.WriteLine("I don't know what to do with more than two price entries. I got " + numberOfEntries + "."); return; } string securityID = marketDataSnapshotFullRefresh.getSecurityID().getValue(); double bidPrice = 0; double bidSize = 0; double askPrice = 0; double askSize = 0; MarketDataSnapshotFullRefresh.NoMDEntries group = new MarketDataSnapshotFullRefresh.NoMDEntries(); for (uint i = 0; i < numberOfEntries; i++) { marketDataSnapshotFullRefresh.getGroup(i + 1, group); if (group.getMDEntryType().getValue() == MDEntryType.BID) { bidPrice = group.getMDEntryPx().getValue(); bidSize = group.getMDEntrySize().getValue(); } if (group.getMDEntryType().getValue() == MDEntryType.OFFER) { askPrice = group.getMDEntryPx().getValue(); askSize = group.getMDEntrySize().getValue(); } } spreadMatrix.Update(securityID, bidPrice, bidSize, askPrice, askSize); }
public override void onMessage( QuickFix42.NewOrderSingle order, SessionID sessionID ) { Symbol symbol = new Symbol(); Side side = new Side(); OrdType ordType = new OrdType(); OrderQty orderQty = new OrderQty(); Price price = new Price(); ClOrdID clOrdID = new ClOrdID(); order.get( ordType ); if ( ordType.getValue() != OrdType.LIMIT ) throw new IncorrectTagValue( ordType.getField() ); order.get( symbol ); order.get( side ); order.get( orderQty ); order.get( price ); order.get( clOrdID ); QuickFix42.ExecutionReport executionReport = new QuickFix42.ExecutionReport ( genOrderID(), genExecID(), new ExecTransType( ExecTransType.NEW ), new ExecType( ExecType.FILL ), new OrdStatus( OrdStatus.FILLED ), symbol, side, new LeavesQty( 0 ), new CumQty( orderQty.getValue() ), new AvgPx( price.getValue() ) ); executionReport.set( clOrdID ); executionReport.set( orderQty ); executionReport.set( new LastShares( orderQty.getValue() ) ); executionReport.set( new LastPx( price.getValue() ) ); if( order.isSetAccount() ) executionReport.set( order.getAccount() ); try { Session.sendToTarget( executionReport, sessionID ); } catch ( SessionNotFound ) {} }
public override void onMessage(QuickFix42.MarketDataIncrementalRefresh refresh, QuickFix.SessionID sessionID) { if (refresh.isSetNoMDEntries()) { string reqID = refresh.getMDReqID().getValue(); Instrument instrument = (provider as GSFIX).GetInstrument(reqID); if (instrument == null) return; QuickFix42.MarketDataIncrementalRefresh.NoMDEntries group = new QuickFix42.MarketDataIncrementalRefresh.NoMDEntries(); int position; double price; int size; SmartQuant.Data.MarketDepth depth; SmartQuant.Data.Quote quote; for (uint i = 1; i <= refresh.getNoMDEntries().getValue(); i++) { refresh.getGroup(i, group); switch (group.getMDUpdateAction().getValue()) { // new case QuickFix.MDUpdateAction.NEW: { switch (group.getMDEntryType().getValue()) { case QuickFix.MDEntryType.BID: //Console.WriteLine("NEW BID"); price = group.getMDEntryPx().getValue(); size = (int)group.getMDEntrySize().getValue(); // market depth depth = new SmartQuant.Data.MarketDepth(Clock.Now, "", -1, MDOperation.Insert, MDSide.Bid, price, size); provider.EmitMarketDepth(depth, instrument); // quote, best bid if (price > instrument.Quote.Bid) { quote = new Quote(instrument.Quote); quote.DateTime = Clock.Now; quote.Bid = price; quote.BidSize = size; provider.EmitQuote(quote, instrument); } break; case QuickFix.MDEntryType.OFFER: //Console.WriteLine("NEW ASK"); price = group.getMDEntryPx().getValue(); size = (int)group.getMDEntrySize().getValue(); // market depth depth = new SmartQuant.Data.MarketDepth(Clock.Now, "", -1, MDOperation.Insert, MDSide.Ask, price, size); provider.EmitMarketDepth(depth, instrument); // quote, best ask if (price < instrument.Quote.Ask) { quote = new Quote(instrument.Quote); quote.DateTime = Clock.Now; quote.Ask = price; quote.AskSize = size; provider.EmitQuote(quote, instrument); } break; case QuickFix.MDEntryType.TRADE: provider.EmitTrade(new Trade(Clock.Now, group.getMDEntryPx().getValue(), (int)group.getMDEntrySize().getValue()), instrument); break; } } break; // change case QuickFix.MDUpdateAction.CHANGE: { switch (group.getMDEntryType().getValue()) { case QuickFix.MDEntryType.BID: //Console.WriteLine("CHANGE BID!"); position = group.getMDEntryPositionNo().getValue() - 1; size = (int)group.getMDEntrySize().getValue(); // market depth depth = new SmartQuant.Data.MarketDepth(Clock.Now, "", position, MDOperation.Update, MDSide.Bid, 0, size); provider.EmitMarketDepth(depth, instrument); // quote, best bid if (position == 0) { quote = new Quote(instrument.Quote); quote.DateTime = Clock.Now; quote.BidSize = (int)group.getMDEntrySize().getValue(); provider.EmitQuote(quote, instrument); } break; case QuickFix.MDEntryType.OFFER: //Console.WriteLine("CHANGE ASK!"); position = group.getMDEntryPositionNo().getValue() - 1; size = (int)group.getMDEntrySize().getValue(); // market depth depth = new SmartQuant.Data.MarketDepth(Clock.Now, "", position, MDOperation.Update, MDSide.Ask, 0, size); provider.EmitMarketDepth(depth, instrument); // quote, best bid if (position == 0) { quote = new Quote(instrument.Quote); quote.DateTime = Clock.Now; quote.AskSize = (int)group.getMDEntrySize().getValue(); provider.EmitQuote(quote, instrument); } break; } } break; // delete case QuickFix.MDUpdateAction.DELETE: { switch (group.getMDEntryType().getValue()) { case QuickFix.MDEntryType.BID: //Console.WriteLine("DELETE BID"); position = group.getMDEntryPositionNo().getValue() - 1; // market depth depth = new SmartQuant.Data.MarketDepth(Clock.Now, "", position, MDOperation.Delete, MDSide.Bid, 0, 0); provider.EmitMarketDepth(depth, instrument); // quote if (position == 0) { Quote newQuote = instrument.OrderBook.GetQuote(0); newQuote.DateTime = Clock.Now; provider.EmitQuote(newQuote, instrument); } break; case QuickFix.MDEntryType.OFFER: //Console.WriteLine("DELETE ASK"); position = group.getMDEntryPositionNo().getValue() - 1; // market depth depth = new SmartQuant.Data.MarketDepth(Clock.Now, "", position, MDOperation.Delete, MDSide.Ask, 0, 0); provider.EmitMarketDepth(depth, instrument); // quote if (position == 0) { Quote newQuote = instrument.OrderBook.GetQuote(0); newQuote.DateTime = Clock.Now; provider.EmitQuote(newQuote, instrument); } break; } } break; } } group.Dispose(); } }