コード例 #1
0
        public HistoricalPriceVolume ParseHistoricalData(string res)
        {
            string[] lines             = res.Split('\n');
            HistoricalPriceVolume data = new HistoricalPriceVolume(lines.Take(lines.Length - 1)
                                                                   .TakeWhile(line => line != null)
                                                                   .Select(StockUtils.ParseCsvRow).Select(line => new HistoricalPriceVolumeEntry
            {
                Date   = DateTime.Parse(line[0]),
                Open   = NumberUtils.ParseDecimal(line[1]),
                High   = NumberUtils.ParseDecimal(line[2]),
                Low    = NumberUtils.ParseDecimal(line[3]),
                Close  = NumberUtils.ParseDecimal(line[4]),
                Volume = NumberUtils.ParseInt(line[5])
            }) /*.Reverse()*/.ToList());


            return(data);
        }
コード例 #2
0
 public IEnumerable <Tuple <string, decimal, int, decimal, int> > GetBidAskQuote(string[] symbols)
 {
     return(GetDataFromYahoo(symbols, "bb6aa5").Select(pair => new Tuple <string, decimal, int, decimal, int>(pair.Key, NumberUtils.ParseDecimal(pair.Value[0]), NumberUtils.ParseInt(pair.Value[1]), NumberUtils.ParseDecimal(pair.Value[2]), NumberUtils.ParseInt(pair.Value[3]))));
 }