public sealed override void onMessage(QuickFix42.OrderCancelReplaceRequest message, SessionID session) { Fix.Out(new StackTrace(new StackFrame(true)).GetFrame(0).GetMethod().ToString()); }
public QuickFix42.OrderCancelReplaceRequest generateReplaceRequest(string clOrdId, int qty, double limitPx, double stopPx, int index) { string originalID = (string)LimitOrders[index]; QuickFix42.Message msg = MSGS[originalID]; //check for a recent ID string temp = limitLib.getRecentID(originalID); if (temp != null) { limitLib.add(originalID, clOrdId); //associate new Id originalID = temp; //send with most recent from previous request } else { limitLib.add(originalID, clOrdId); } Side oldSide = new Side(); msg.getField(oldSide); TransactTime uTime = new TransactTime(); msg.getField(uTime); QuickFix42.OrderCancelReplaceRequest OCRR = new QuickFix42.OrderCancelReplaceRequest( new OrigClOrdID(originalID), new ClOrdID(clOrdId), new HandlInst('1'), new Symbol(msg.getField(Symbol.FIELD)), oldSide, uTime, new OrdType(OrdType.LIMIT)); // Update prices and quantity if (limitPx > 0) // If the user specified a new limit price { OCRR.set(new Price(limitPx)); } else // Otherwise use the original limit price { OCRR.set(new Price(double.Parse(msg.getField(Price.FIELD)))); } if (stopPx > 0) // If the user specified a new stop price { OCRR.set(new StopPx(stopPx)); } else { // Otherwise use the original stop price StopPx spx = new StopPx(); if (msg.isSetField(spx)) { msg.getField(spx); OCRR.set(spx); } else { msg.setField(spx); } } if (qty > 0) // If the user specified a new qty { OCRR.set(new OrderQty(qty)); } else // Otherwise use the original qty { OCRR.set(new OrderQty(int.Parse(msg.getField(OrderQty.FIELD)))); } OrderID oid = new OrderID("x"); OCRR.setField(oid); OCRR.setField(57, msg.getField(57)); OCRR.setField(9102, msg.getField(9102)); return(OCRR); }