예제 #1
0
        public object CancelOrder([FromBody] CancelOrderRequest cancelOrderRequest)
        {
            ServiceResult result = new ServiceResult();

            try
            {
                result.Success = new DLOrder().CancelOrder(cancelOrderRequest);
            }
            catch (Exception ex)
            {
                CommonFunction.WriteLog(ex, SerializeUtil.Serialize(cancelOrderRequest.ToString()), Request.RequestUri.ToString());
                result.Success   = false;
                result.ErrorCode = ex.Message;
            }
            return(result);
        }
예제 #2
0
            public void OnMessage(object obj)
            {
                if (!(obj is ISpecificRecord))
                {
                    return;
                }
                ISpecificRecord avroObj = (ISpecificRecord)obj;
                ObjectType      type    = (ObjectType)avroObj.Get(0);

                switch (type)
                {
                case ObjectType.AmendOrderRequest:
                {
                    AmendOrderRequest req = (AmendOrderRequest)avroObj;
                    logger.Info("Get AmendOrderRequest: " + req.ToString());
                    IDownStreamAdaptor adaptor = _manager.downStreamManager.getAdaptorById(req.exchangeAccount);
                    processAmendOrder(adaptor, req);

                    break;
                }

                case ObjectType.CancelOrderRequest:
                {
                    CancelOrderRequest req = (CancelOrderRequest)avroObj;
                    logger.Info("Get CancelOrderRequest: " + req.ToString());
                    IDownStreamAdaptor adaptor = _manager.downStreamManager.getAdaptorById(req.exchangeAccount);
                    processCancelOrder(adaptor, req);

                    break;
                }

                case ObjectType.NewOrderRequest:
                {
                    NewOrderRequest req = (NewOrderRequest)avroObj;
                    logger.Info("Get NewOrderRequest: " + req.ToString());
                    IDownStreamAdaptor adaptor = _manager.downStreamManager.getAdaptorById(req.exchangeAccount);
                    processNewOrder(adaptor, req);

                    break;
                }

                case ObjectType.SubscribeQuote:
                {
                    SubscribeQuote req = (SubscribeQuote)avroObj;

                    break;
                }

                case ObjectType.UnsubscribeQuote:
                {
                    break;
                }

                default:
                {
                    //Log Error
                    logger.Error("Undefined ObjectType: " + type);
                    return;
                }
                }
            }