/// <summary> /// /// </summary> /// <param name="message">Market data snapshot full refresh message</param> /// <param name="session">Session ID</param> private void OnMessage(QuickFix.FIX43.MarketDataSnapshotFullRefresh message, QuickFix.SessionID session) { try { int numberOfMarketDataEntries = message.NoMDEntries.getValue(); for (int i = 1; i <= numberOfMarketDataEntries; i++) { Tick tick = new Tick(new Security() { Symbol = message.Symbol.getValue() }, _provider); tick.DateTime = message.Header.GetDateTime(QuickFix.Fields.Tags.SendingTime); QuickFix.Group group = message.GetGroup(i, QuickFix.Fields.Tags.NoMDEntries); if (group.GetField(QuickFix.Fields.Tags.MDEntryType).Equals("0")) { tick.BidPrice = Convert.ToDecimal(group.GetField(QuickFix.Fields.Tags.MDEntryPx)); tick.BidSize = Convert.ToDecimal(group.GetField(QuickFix.Fields.Tags.MDEntrySize)); tick.BidExchange = group.GetField(QuickFix.Fields.Tags.MDEntryOriginator); } if (group.GetField(QuickFix.Fields.Tags.MDEntryType).Equals("1")) { tick.AskPrice = Convert.ToDecimal(group.GetField(QuickFix.Fields.Tags.MDEntryPx)); tick.AskSize = Convert.ToDecimal(group.GetField(QuickFix.Fields.Tags.MDEntrySize)); tick.AskExchange = group.GetField(QuickFix.Fields.Tags.MDEntryOriginator); } if (TickArrived != null) { TickArrived(tick); } } } catch (Exception exception) { Logger.Error(exception.ToString(), _type.FullName, "OnMessage"); } }
public static List <QuickFix.FIX44.ExecutionReport> Fix44Rejection2ExecutionReportNOC(QuickFix.Message msgReject, QuickFix.FIX44.NewOrderCross noc) { try { QuickFix.FIX44.ExecutionReport er1 = new QuickFix.FIX44.ExecutionReport(); QuickFix.FIX44.ExecutionReport er2 = new QuickFix.FIX44.ExecutionReport(); er1.Set(new OrderID("NONE")); er2.Set(new OrderID("NONE")); if (noc.IsSetNoSides() && noc.NoSides.getValue() == 2) { QuickFix.Group grpNoSides = noc.GetGroup(1, Tags.NoSides); if (grpNoSides.IsSetField(Tags.ClOrdID)) { er1.Set(new ClOrdID(grpNoSides.GetField(Tags.ClOrdID))); } er1.Set(new ExecID(DateTime.Now.ToString("yyyyMMddHHmmssfff"))); er1.Set(new ExecType(ExecType.REJECTED)); er1.Set(new OrdStatus(OrdStatus.REJECTED)); if (grpNoSides.IsSetField(Tags.Account)) { er1.Set(new Account(grpNoSides.GetField(Tags.Account))); } er1.Set(new Symbol(noc.GetField(Tags.Symbol))); if (noc.IsSetField(Tags.SecurityID)) { er1.Set(new SecurityID(noc.GetField(Tags.SecurityID))); } if (noc.IsSetField(Tags.SecurityIDSource)) { er1.Set(new SecurityIDSource(noc.GetField(Tags.SecurityIDSource))); } er1.Set(new Side(grpNoSides.GetChar(Tags.Side))); er1.Set(new OrderQty(grpNoSides.GetDecimal(Tags.OrderQty))); if (noc.IsSetField(Tags.OrdType)) { er1.Set(new OrdType(noc.GetChar(Tags.OrdType))); } if (noc.IsSetField(Tags.Price)) { er1.Set(new Price(noc.GetDecimal(Tags.Price))); } er1.Set(new LeavesQty(0)); er1.Set(new CumQty(0)); er1.Set(new AvgPx(Decimal.Zero)); DateTime transact1 = DateTime.UtcNow; er1.Set(new TransactTime(transact1)); if (msgReject.IsSetField(Tags.Text)) { er1.Set(new Text(msgReject.GetField(Tags.Text))); } grpNoSides = noc.GetGroup(2, Tags.NoSides); if (grpNoSides.IsSetField(Tags.ClOrdID)) { er2.Set(new ClOrdID(grpNoSides.GetField(Tags.ClOrdID))); } er2.Set(new ExecID(DateTime.Now.ToString("yyyyMMddHHmmssfff"))); er2.Set(new ExecType(ExecType.REJECTED)); er2.Set(new OrdStatus(OrdStatus.REJECTED)); if (grpNoSides.IsSetField(Tags.Account)) { er2.Set(new Account(grpNoSides.GetField(Tags.Account))); } er2.Set(new Symbol(noc.GetField(Tags.Symbol))); if (noc.IsSetField(Tags.SecurityID)) { er2.Set(new SecurityID(noc.GetField(Tags.SecurityID))); } if (noc.IsSetField(Tags.SecurityIDSource)) { er2.Set(new SecurityIDSource(noc.GetField(Tags.SecurityIDSource))); } er2.Set(new Side(grpNoSides.GetChar(Tags.Side))); er2.Set(new OrderQty(grpNoSides.GetDecimal(Tags.OrderQty))); if (noc.IsSetField(Tags.OrdType)) { er2.Set(new OrdType(noc.GetChar(Tags.OrdType))); } if (noc.IsSetField(Tags.Price)) { er2.Set(new Price(noc.GetDecimal(Tags.Price))); } er2.Set(new LeavesQty(0)); er2.Set(new CumQty(0)); er2.Set(new AvgPx(Decimal.Zero)); DateTime transact2 = DateTime.UtcNow; er2.Set(new TransactTime(transact2)); if (msgReject.IsSetField(Tags.Text)) { er2.Set(new Text(msgReject.GetField(Tags.Text))); } } List <QuickFix.FIX44.ExecutionReport> ret = new List <QuickFix.FIX44.ExecutionReport>(); ret.Add(er1); ret.Add(er2); return(ret); } catch (Exception ex) { logger.Error("Fix44Rejection2ExecutionReportNOC(): " + ex.Message, ex); return(null); } }