public int FIXResponseCanModRejectHandler(Int32 OrderID, string ExchangeOrderId, Int32 origOrdID, char status, string status_msg, string other_msg) { string data = ""; OrderDAO ord = new OrderDAO(); OrderStruct os = new OrderStruct(); int iret = -1; Console.WriteLine("FIXResponseCanModRejectHandler : " + status); if (status == '1') { // rejected so move the order to originalID //iret = ord.setOrdersWithReplacedFixResponse(origOrdID, "CANCEL_REJECTED", ExchangeOrderId, ref os); iret = ord.setOrdersWithFixResponse(OrderID, "CANCEL_REJECTED", ExchangeOrderId, ref os); } else if (status == '2') { // rejected so move the order to originalID //iret = ord.setOrdersWithReplacedFixResponse(origOrdID, "MODIFY_REJECTED", ExchangeOrderId, ref os); iret = ord.setOrdersWithFixResponse(OrderID, "MODIFY_REJECTED", ExchangeOrderId, ref os); } if (iret == -1) { Console.WriteLine("Error from DB [" + data + "]"); //return -1; } else { Console.WriteLine("Order Updated"); } data = new string(os.machineID) + ":" + new string(os.userID) + ":" + os.OrderNo + ":" + new string(os.OrderStatus) + ":" + ExchangeOrderId + ":" + status + ":" + status_msg + ":" + other_msg; OMFillPub ofp = new OMFillPub(); if (ofp.zmqUpdates(data) == 0) { Console.WriteLine("Zmq update success"); } else { Console.WriteLine("Zmq update fail"); } ord.addFIXResponse(OrderID, ExchangeOrderId, status, status_msg, other_msg); return(0); }
public int FIXResponseHandler(Int32 OrderID, string ExchangeOrderId, Int32 origOrdID, char status, string status_msg, string other_msg, float price, char orderType) { string data = ""; OrderDAO ord = new OrderDAO(); OrderStruct os = new OrderStruct(); int iret = -1; if (status == 'X') // i am considering the reject of amendment. { // rejected so move the order to originalID iret = ord.setOrdersWithReplacedFixResponse(origOrdID, getExecType(status), ExchangeOrderId, ref os); } else if (status == '5') { // accepted the amendment i.e. Replaced so add the new ord no. iret = ord.setOrdersWithReplacedFixResponse(OrderID, getExecType(status), ExchangeOrderId, ref os); } // In case of Order Rejected - call DB for reject status. else if (status == 'D') { iret = ord.setOrdersWithFixResponseRestated(OrderID, getExecType(status), ExchangeOrderId, price, orderType, ref os); os.price = price; os.orderType = Convert.ToInt32(orderType); } else { iret = ord.setOrdersWithFixResponse(OrderID, getExecType(status), ExchangeOrderId, ref os); } if (iret == -1) { Console.WriteLine("Error from DB [" + data + "]"); //return -1; } else { Console.WriteLine("Order Updated"); } data = new string(os.machineID) + ":" + new string(os.userID) + ":" + os.OrderNo + ":" + new string(os.OrderStatus) + ":" + ExchangeOrderId + ":" + status + ":" + status_msg + ":" + other_msg; OMFillPub ofp = new OMFillPub(); if (ofp.zmqUpdates(data) == 0) { Console.WriteLine("Zmq update success"); } else { Console.WriteLine("Zmq update fail"); } ord.addFIXResponse(OrderID, ExchangeOrderId, status, status_msg, other_msg); return(0); }