public int amendOrder(ref OrderStruct os) { if (!isOrderAmendPossible(os.OrderStatus)) { return(-1); } OrderDAO ord = new OrderDAO(); int ordNo = ord.amendOrder(ref os); Console.WriteLine("TODO: Send FIX - cancel for os.LinkedOrderID ; Send FIX - New for os.ID"); //Send FIX - cancel for os.LinkedOrderID //Send FIX - New for os.ID return(ordNo); }
public int amendOrder(ref OrderStruct os) { if (!isOrderAmendPossible(os.OrderStatus)) { return(-1); } OrderDAO ord = new OrderDAO(); int newOrdID = ord.amendOrder(ref os); // OrderID is the last FixAccepted version Console.WriteLine("TODO: Send FIX - cancel for os.LinkedOrderID ; Send FIX - New for os.ID"); OrigClOrdID origCLOrdID = new OrigClOrdID(Convert.ToString(os.ID)); ClOrdID OrdId = new ClOrdID(Convert.ToString(newOrdID)); string symboldata = sanitiseField(os.symbol); Symbol symbol = new Symbol(symboldata); Side side = new Side(Side.BUY); if (os.direction == 'S') { side = new Side(Side.SELL); } OrdType ordType = new OrdType(OrdType.LIMIT); if (os.orderType == 1) { ordType = new OrdType(OrdType.MARKET); } var orderMod = new QuickFix.FIX42.OrderCancelReplaceRequest(origCLOrdID, OrdId, new HandlInst('1'), symbol, side, new TransactTime(DateTime.Now.ToUniversalTime()), ordType); int Qty = (int)os.quantity; orderMod.Price = new Price((decimal)os.price); orderMod.SetField(new OrderQty(Qty)); Console.WriteLine("Modifying origOrdId/FixAcceptedID : " + os.ID + " newOrderID : " + newOrdID); Console.WriteLine("symboldata : " + symboldata + " side : " + side + " Price : " + os.price + " qty : " + os.quantity); Session.SendToTarget(orderMod, FixClient.MySess); return(os.OrderNo); }