Пример #1
0
 private void processAmendOrder(IDownStreamAdaptor adaptor, AmendOrderRequest req)
 {
     if (adaptor != null)
     {
         try
         {
             adaptor.amendOrder(req.orderId, req.price, req.quantity);
             AmendOrderReply rsp = new AmendOrderReply();
             rsp.result          = true;
             rsp.orderId         = req.orderId;
             rsp.exchangeAccount = req.exchangeAccount;
             rsp.message         = "sucess";
             _manager.Publish(rsp);
         }
         catch (Exception e)
         {
             AmendOrderReply rsp = new AmendOrderReply();
             rsp.result          = false;
             rsp.orderId         = req.orderId;
             rsp.exchangeAccount = req.exchangeAccount;
             rsp.message         = e.Message;
             _manager.Publish(rsp);
         }
     }
     else
     {
         AmendOrderReply rsp = new AmendOrderReply();
         rsp.result  = false;
         rsp.orderId = req.orderId;
         rsp.message = req.exchangeAccount + " not exist";
         _manager.Publish(rsp);
     }
 }
Пример #2
0
            public void onOrder(Order order)
            {
                OrderUpdate update = new OrderUpdate();

                update.orderId     = StringUtils.trim(order.orderId);
                update.orderSide   = (int)order.orderSide;
                update.orderType   = (int)order.orderType;
                update.ordStatus   = (int)order.ordStatus;
                update.price       = order.price;
                update.quantity    = order.quantity;
                update.symbol      = StringUtils.trim(order.symbol);
                update.timeInForce = (int)order.timeInForce;

                update.exchangeOrderId = StringUtils.trim(order.exchangeOrderId);
                update.avgPx           = order.avgPx;
                update.clOrderId       = StringUtils.trim(order.clOrderId);
                update.created         = StringUtils.trim(order.created);
                update.cumQty          = order.cumQty;
                update.exchangeAccount = order.exchangeAccount;
                update.execType        = (int)order.execType;
                update.account         = order.account;

                _manager.Publish(update);
                logger.Info("Send OrderUpdate: " + order.ToString());
            }