Exemplo n.º 1
0
        public void OnMessage(NewOrderSingle n, SessionID sessionID)
        {
            var execID = _execIdGenerator();

            try
            {
                var orderData = TranslateFixMessages.Translate(n);
                _commandFactory.EnqueueAddOrder(_messageGenerator, sessionID, orderData, execID);
            }
            catch (QuickFIXException e)
            {
                var rejectMessage = "Unable to add order: " + e.Message;
                var message       = CreateFix42Message.CreateRejectNewOrderExecutionReport(n,
                                                                                           execID,
                                                                                           rejectMessage);
                _fixFacade.SendToTarget(message, sessionID);
            }
        }
Exemplo n.º 2
0
        public void OnMessage(OrderCancelRequest msg, SessionID sessionID)
        {
            var execID = _execIdGenerator();

            try
            {
                var orderID = TranslateFixMessages.GetOrderIdFromMessage(msg);
                _commandFactory.EnqueueCancelOrder(_messageGenerator,
                                                   sessionID,
                                                   orderID,
                                                   msg.ClOrdID.getValue(),
                                                   msg.OrigClOrdID.getValue(),
                                                   execID);
            }
            catch (QuickFIXException e)
            {
                var reply = CreateFix42Message.CreateOrderCancelReject(msg,
                                                                       CxlRejReason
                                                                       .OTHER,
                                                                       e.Message);
                _fixFacade.SendToTarget(reply, sessionID);
            }
        }