Beispiel #1
0
        public ActionResult CandlestickChartAverageBuyingPriceByStockId(Guid id)
        {
            var prices = _queryDispatcher.Execute(new AverageBuyingPricesByStockIdQuery(id));

            var averageBuyingPrices = prices.ToList();

            if (_transactionBook.GetOpenPositions().Any(o => o.ProductId.Equals(id)))
            {
                averageBuyingPrices.Add(new AverageBuyingPrice(DateTime.Now, averageBuyingPrices.Last().AveragePrice));
            }

            return(Json(averageBuyingPrices.Select(
                            t => new object[]
            {
                _dateCalculationService.ConvertToEpochTimeInMilliseconds(t.OrderDate), t.AveragePrice
            })
                        .ToArray(), JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
 /// <summary>
 /// Executes the specified query.
 /// </summary>
 /// <param name="query">The query.</param>
 /// <returns></returns>
 public IEnumerable <IOpenPosition> Execute(OpenPositionsAllQuery query)
 {
     return(_transactionBook.GetOpenPositions());
 }