Пример #1
0
        //no constructor

        //method to retrieve an array of price (decimal) values given ticker and time range (inclusive)
        public static decimal[] getPriceArray(String ticker, DateTime start, DateTime end)
        {
            using (StocksEntities context = new StocksEntities())
            {
                //sql script to extract price
                var query = from record in context.TickerDatas
                            where
                            record.Ticker == ticker &&
                            record.Date >= start &&
                            record.Date <= end

                            select record.Price;

                decimal[] priceArray = query.ToArray();

                return(priceArray);
            }
        }
Пример #2
0
        public decimal[] getPriceArray(String ticker, DateTime start, DateTime end)
        {
            decimal[] priceArray;
            
            using (StocksEntities context = new StocksEntities())
            {
                //sql script to extract price
                var query = from record in context.TickerDatas
                            where
                                record.Ticker == ticker &&
                                record.Date >= start &&
                                record.Date <= end
                            orderby  record.Date
                            select record.Price;

                priceArray = query.ToArray();
            
            }
             
            Console.WriteLine("Received Request for {0} from {1} to {2}", ticker, start, end);
            return priceArray;
       
        }