public SimulationResultQuote( IReadOnlyList<double> tickerQuantity, double cash, Observation observation) { this.TickerQuantity = tickerQuantity; this.Cash = cash; this.Observation = observation; }
private Observation NextValidObservation(Observation observation) { DateTime nextObservationDate; if (observation == null) { observation = new Observation(new int[tickers.Count].AsReadOnlyList(), from); nextObservationDate = from; } else nextObservationDate = Min(observation.Date + stepSpan, to); int[] nextQuoteCount = UpToDate(nextObservationDate, observation.CurrentQuoteCount); if (nextQuoteCount.SequenceEqual(observation.CurrentQuoteCount)) { var nextDates = nextQuoteCount .Select((iQCount, iT) => iQCount < tickers[iT].Count ? (DateTime?)tickers[iT][iQCount].Date : null) .Where(d => d != null) .ToArray(); if (nextDates.Length == 0 || (nextObservationDate = nextDates.Min().Value) > to) return null; nextQuoteCount = UpToDate(nextObservationDate, observation.CurrentQuoteCount); } return new Observation(nextQuoteCount.AsReadOnlyList(), nextObservationDate); }