public List <ForexitePriceRecord> Read(string zipFilePath, Expression <Func <ForexitePriceRecord, bool> > pred)
        {
            List <ForexitePriceRecord> priceRecs = new List <ForexitePriceRecord>();

            byte[] block = ZippedFile.ZipDataStreamBytes(zipFilePath);
            if (block.Length > 0)
            {
                priceRecs.AddRange((from f in
                                    (from f in System.Text.Encoding.Default.GetString(block, 0, block.Length).Split('\r').ToList()
                                     where !f.StartsWith("<") && f.Length > 6
                                     select f.Replace("\n", "")).ToArray()
                                    let rec = f.Split(',')
                                              select new ForexitePriceRecord()
                {
                    Symbol = rec[0],
                    PriceDateTime = Forexite.ParseDate(rec[1], rec[2]),
                    Open = double.Parse(rec[3]),
                    High = double.Parse(rec[4]),
                    Low = double.Parse(rec[5]),
                    Close = double.Parse(rec[6]),
                })
                                   .ToList().Where(pred.Compile()));
            }
            return(priceRecs);
        }
        //public List<ForexPriceRecord> Read(DateTime priceDate)
        //{
        //    return Read(Path.Combine(FileDataPath, Forexite.DateToFileName1(priceDate)), PredicateBuilder.True<ForexPriceRecord>());
        //}

        //public List<ForexPriceRecord> Read(string zipFilePath)
        //{
        //    return Read(zipFilePath, PredicateBuilder.True<ForexPriceRecord>());
        //}

        public List <ForexPriceRecord> Read(string zipFilePath)
        {
            // file must exist
            if (!File.Exists(zipFilePath))
            {
                throw new FileNotFoundException();
            }

            List <ForexPriceRecord> priceRecs = new List <ForexPriceRecord>();

            byte[] block = ZippedFile.ZipDataStreamBytes(zipFilePath);
            if (block.Length > 0)
            {
                priceRecs.AddRange((from f in
                                    (from f in System.Text.Encoding.Default.GetString(block, 0, block.Length).Split('\r').ToList()
                                     where !f.StartsWith("<") && f.Length > 6
                                     select f.Replace("\n", "")).ToArray()
                                    let rec = f.Split(',')
                                              select new ForexPriceRecord()
                {
                    Symbol = rec[0],
                    PriceDateTime = Forexite.ParseDate(rec[1], rec[2]),
                    Open = double.Parse(rec[3]),
                    High = double.Parse(rec[4]),
                    Low = double.Parse(rec[5]),
                    Close = double.Parse(rec[6]),
                })
                                   .ToList());
            }
            return(priceRecs);
        }
        public List <ForexitePriceRecord> Read(DateTime PriceDate)
        {
            return(Read(Path.Combine(FileDataPath, Forexite.DateToFileName1(PriceDate)), PredicateBuilder.True <ForexitePriceRecord>()));

            //List<string> recs;

            //try
            //{
            //    recs = ToCsvList(PriceDate);
            //    return (from r in recs
            //            let rec = r.Split(',')
            //            where r.Length > 0 && !r.StartsWith("<")
            //            select new ForexitePriceRecord()
            //            {
            //                Symbol = rec[0],
            //                PriceDateTime = Forexite.ParseDate(rec[1], rec[2]),
            //                Open = double.Parse(rec[3]),
            //                High = double.Parse(rec[4]),
            //                Low = double.Parse(rec[5]),
            //                Close = double.Parse(rec[6]),
            //            }).ToList();
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
        }
        //public static List<ForexPriceRecord> ParseBytes(byte[] block)
        //{
        //    return ParseBytes(block, PredicateBuilder.True<ForexPriceRecord>());
        //}
        public static List <ForexPriceRecord> ParseBytes(byte[] block)
        {
            List <ForexPriceRecord> priceRecs = new List <ForexPriceRecord>();

            if (block.Length > 0)
            {
                priceRecs.AddRange((from f in
                                    (from f in System.Text.Encoding.Default.GetString(block, 0, block.Length).Split('\r').ToList()
                                     where !f.StartsWith("<") && f.Length > 6
                                     select f.Replace("\n", "")).ToArray()
                                    let rec = f.Split(',')
                                              select new ForexPriceRecord()
                {
                    Symbol = rec[0],
                    PriceDateTime = Forexite.ParseDate(rec[1], rec[2]),
                    Open = double.Parse(rec[3]),
                    High = double.Parse(rec[4]),
                    Low = double.Parse(rec[5]),
                    Close = double.Parse(rec[6]),
                })
                                   .ToList());
            }
            return(priceRecs);
        }
 public byte[] ToByteArray(DateTime dt)
 {
     return(ToByteArray(Path.Combine(this.FileDataPath, Forexite.DateToFileName1(dt))));
 }
 public string ToCsvString(DateTime dt)
 {
     return(ToCsvString(Path.Combine(this.FileDataPath, Forexite.DateToFileName1(dt))));
 }
 public List <string> ToCsvList(DateTime dt)
 {
     return(ToCsvList(Path.Combine(this.FileDataPath, Forexite.DateToFileName1(dt))));
 }
 public List <ForexitePriceRecord> Read(DateTimeOffset PriceDate)
 {
     return(Read(Path.Combine(FileDataPath, Forexite.DateToFileName1(PriceDate.Date)), PredicateBuilder.True <ForexitePriceRecord>()));
 }
 public List <ForexitePriceRecord> Read(DateTimeOffset PriceDate, Expression <Func <ForexitePriceRecord, bool> > pred)
 {
     return(Read(Path.Combine(FileDataPath, Forexite.DateToFileName1(PriceDate.Date)), pred));
 }