public static long GetOrderIdFromMessage(QuickFix.FIX44.OrderCancelRequest msg) { if (!msg.IsSetOrderID()) throw new IncorrectTagValue(msg.OrderID.Tag); var idString = msg.OrderID.getValue(); long id; if (!string.IsNullOrEmpty(idString) && long.TryParse(idString, out id)) { return id; } throw new IncorrectTagValue(msg.OrderID.Tag); }
public void OnMessage(QuickFix.FIX50.OrderCancelReplaceRequest msg, SessionID s) { string orderid = (msg.IsSetOrderID()) ? msg.OrderID.Obj : "unknown orderID"; QuickFix.FIX50.OrderCancelReject ocj = new QuickFix.FIX50.OrderCancelReject( new OrderID(orderid), msg.ClOrdID, msg.OrigClOrdID, new OrdStatus(OrdStatus.REJECTED), new CxlRejResponseTo(CxlRejResponseTo.ORDER_CANCEL_REPLACE_REQUEST)); ocj.CxlRejReason = new CxlRejReason(CxlRejReason.OTHER); ocj.Text = new Text("Executor does not support order cancel/replaces"); try { Session.SendToTarget(ocj, s); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public void OnMessage(QuickFix.FIX40.OrderCancelReplaceRequest msg, SessionID s) { string orderid = (msg.IsSetOrderID()) ? msg.OrderID.Obj : "unknown orderID"; QuickFix.FIX40.OrderCancelReject ocj = new QuickFix.FIX40.OrderCancelReject(new OrderID(orderid), msg.ClOrdID); ocj.CxlRejReason = new CxlRejReason(CxlRejReason.UNKNOWN_ORDER); ocj.Text = new Text("Executor does not support order cancel/replaces"); try { Session.SendToTarget(ocj, s); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public void HandleExecutionReport(QuickFix.FIX42.ExecutionReport msg) { try { string clOrdId = msg.ClOrdID.Obj; string status = FixEnumTranslator.Translate(msg.OrdStatus); Trace.WriteLine("OVM: Handling ExecutionReport: " + clOrdId + " / " + status); lock (_ordersLock) { foreach (OrderRecord r in Orders) { if (r.ClOrdID == clOrdId) { r.Status = status; if (msg.IsSetLastPx()) r.Price = msg.LastPx.Obj; if (msg.IsSetOrderID()) r.OrderID = msg.OrderID.Obj; return; } } } Trace.WriteLine("OVM: No order corresponds to ClOrdID '" + clOrdId + "'"); } catch (Exception e) { Trace.WriteLine(e.ToString()); } }