public void Start()
        {
            // Get all the stocks we know about
            var stocks = this._stockDataProvider.GetStocks();

            // Determine which ones look interesting
            var potentialCandidates = this._stockFilter.GetInvestmentCandidates(stocks);

            // Update final stock price from live data feed#
            this._priceUpdate.Update(potentialCandidates);

            // Rerun process for potential candiadtes only
            var candidates = this._stockFilter.GetInvestmentCandidates(potentialCandidates);

            // Determine what the bets might look like
            var bets = this._investDecider.GetInvestmentDescisions(candidates);

            foreach (var bet in bets)
            {
                // Create a command to represent an update to the domain
                var command = new PlaceBetCommand
                {
                    BidAmount       = bet.BidAmount,
                    ExitPrice       = bet.ExitPrice,
                    InitialLoss     = bet.InitialLoss,
                    IsIncrease      = (bet.Direction == Domain.Direction.Increase),
                    OpeningPosition = bet.OpeningPosition,
                    StockIdentifier = bet.Stock.Identifier
                };

                // Send the command for processing
                this._commandBus.Send(command);
            }
        }
        public IHttpActionResult Post(BetRequestModel requestModel)
        {
            if (ModelState.IsValid)
            {
                PlaceBetCommand placeBetCommand            = Mapper.Map <PlaceBetCommand>(requestModel);
                IEnumerable <ValidationResult> validations = commandDispatcher.Validate(placeBetCommand);

                ModelState.AddModelErrors(validations);

                if (ModelState.IsValid)
                {
                    BetResponseModel responseModel = new BetResponseModel();
                    responseModel.TicketId = commandDispatcher.Dispatch <PlaceBetCommand, string>(placeBetCommand);

                    return(Ok(responseModel));
                }
            }

            return(BadRequest(ModelState));
        }