public LatestTwoTickerPrices GetTopTickerPricesByRange(int from, int to)
        {
            if (from == to)
            {
                throw new Exception("From and To cannot be same");
            }
            var dates               = TimeSeriesDaily.Keys.OrderByDescending(a => a.Date).ToList();
            var latestDate          = dates.Skip(from).Take(to).First();
            var previousClosingDate = dates.Skip(from + 1).Take(to + 1).First();

            var first    = TimeSeriesDaily[latestDate];
            var previous = TimeSeriesDaily[previousClosingDate];

            var latest2Prices = new LatestTwoTickerPrices
            {
                LatestDate    = latestDate,
                PreviousDate  = previousClosingDate,
                LatestQuote   = first,
                PreviousQuote = previous
            };

            return(latest2Prices);
        }
示例#2
0
 public ProfitLossReport(string tickerId, List <EquityTransaction> transactions, LatestTwoTickerPrices latest2Prices)
 {
     Ticker         = tickerId;
     _transactions  = transactions;
     _latest2Prices = latest2Prices;
 }