Simple POCO class that represents a simple trade response
コード例 #1
0
 public void UpdateTrade(TradeResponse trade)
 {
     Invoke(new MethodInvoker(
                delegate
                {
                    tradeRequestStatusTextBox.Text = "Confirmed. " + trade.Ticker + " " + trade.Price;
                }));
 }
コード例 #2
0
        public TradeResponse ExecuteTradeRequest(TradeRequest request)
        {
            TradeResponse response = new TradeResponse();
            response.OrderType = request.OrderType;
            response.Price = CalculatePrice(request.Ticker, request.Quantity, request.OrderType, request.Price, request.UserName);
            response.Quantity = request.Quantity;
            response.Ticker = request.Ticker;
            response.ConfirmationNumber = new Guid().ToString();

            logger.Info("Sleeping 2 seconds to simulate processing...");
            Thread.Sleep(2000);
            return response;
        }
コード例 #3
0
        public TradeResponse Handle(TradeRequest tradeRequest)
        {
            logger.Info("Recieved trade request");
            TradeResponse tradeResponse;
            ArrayList errors = new ArrayList();
            if (creditCheckService.CanExecute(tradeRequest, errors))
            {
                tradeResponse = executionVenueService.ExecuteTradeRequest(tradeRequest);
            }
            else
            {
                tradeResponse = new TradeResponse();
                tradeResponse.Error = true;
                tradeResponse.ErrorMessage = StringUtils.ArrayToCommaDelimitedString(errors.ToArray());

            }
            tradingService.ProcessTrade(tradeRequest, tradeResponse);
            return tradeResponse;
        }
コード例 #4
0
 public void Handle(TradeResponse tradeResponse)
 {
     log.Info(string.Format("Received trade resonse.  Ticker = {0}, Price = {1}", tradeResponse.Ticker, tradeResponse.Price));
     // forward to controller to update view
     _stockController.UpdateTrade(tradeResponse);
 }
コード例 #5
0
 public void UpdateTrade(TradeResponse tradeResponse)
 {
     stockForm.UpdateTrade(tradeResponse);
 }
コード例 #6
0
 public void ProcessTrade(TradeRequest request, TradeResponse response)
 {
     //do nothing implementation, typical implementations would persist state to the database.
 }