Beispiel #1
0
        private void ReadFromFile(string pathChosen)
        {
            strCurrentFilePath = pathChosen;

            Tuple <Stream, string, double> tuple = ReadToStream(strCurrentFilePath);

            if (tuple == null)
            {
                return;
            }

            Stream stream = tuple.Item1;

            try
            {
                QuantBox.Data.Serializer.PbTickSerializer pts = new QuantBox.Data.Serializer.PbTickSerializer();
                listTickData = pts.Read(stream).ToList();

                strCurrentFileName = string.Format("{0} ({1}/{2}={3})",
                                                   tuple.Item2, tuple.Item3, listTickData.Count(), tuple.Item3 / listTickData.Count());

                ValueChanged(false);

                PbTickCodec Codec = new PbTickCodec();

                listTickView       = Codec.Data2View(this.listTickData, true);
                dgvTick.DataSource = this.listTickView;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #2
0
        private static List <PbTickView> ReadFromFile(string pathChosen)
        {
            Tuple <Stream, string, double> tuple = ReadToStream(pathChosen);

            IEnumerable <PbTick> listTickData;
            List <PbTickView>    listTickView;

            if (tuple == null)
            {
                return(null);
            }

            Stream stream = tuple.Item1;

            try
            {
                QuantBox.Data.Serializer.PbTickSerializer pts = new QuantBox.Data.Serializer.PbTickSerializer();
                listTickData = pts.Read(stream);

                PbTickCodec Codec = new PbTickCodec();

                listTickView = Codec.Data2View(listTickData, true);

                return(listTickView);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(null);
            }
        }
 public void TestRead()
 {
     var file = new FileInfo("TickDataV1_1");
     using (var stream = new MemoryStream())
     using (var fileStream = file.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
     using (var zip = new SevenZipExtractor(fileStream)) {
         zip.ExtractFile(0, stream);
         stream.Seek(0, SeekOrigin.Begin);
         var serializer = new PbTickSerializer();
         var codec = new PbTickCodec();
         foreach (var tick in serializer.Read(stream)) {
         }
     }
 }
        public void TestRead()
        {
            var file = new FileInfo("TickDataV1_1");

            using (var stream = new MemoryStream())
                using (var fileStream = file.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    using (var zip = new SevenZipExtractor(fileStream)) {
                        zip.ExtractFile(0, stream);
                        stream.Seek(0, SeekOrigin.Begin);
                        var serializer = new PbTickSerializer();
                        var codec      = new PbTickCodec();
                        foreach (var tick in serializer.Read(stream))
                        {
                        }
                    }
        }
Beispiel #5
0
        private void ReadFromFile(string pathChosen)
        {
            strCurrentFilePath = pathChosen;

            Tuple<Stream, string, double> tuple = ReadToStream(strCurrentFilePath);
            
            if (tuple == null)
            {
                return;
            }

            Stream stream = tuple.Item1;
            try
            {
                QuantBox.Data.Serializer.PbTickSerializer pts = new QuantBox.Data.Serializer.PbTickSerializer();
                listTickData = pts.Read(stream).ToList();

                strCurrentFileName = string.Format("{0} ({1}/{2}={3})",
                    tuple.Item2, tuple.Item3, listTickData.Count(), tuple.Item3 / listTickData.Count());

                ValueChanged(false);

                PbTickCodec Codec = new PbTickCodec();

                listTickView = Codec.Data2View(this.listTickData, true);
                dgvTick.DataSource = this.listTickView;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #6
0
        private static List<PbTickView> ReadFromFile(string pathChosen)
        {
            Tuple<Stream, string, double> tuple = ReadToStream(pathChosen);

            IEnumerable<PbTick> listTickData;
            List<PbTickView> listTickView;

            if (tuple == null)
            {
                return null;
            }

            Stream stream = tuple.Item1;
            try
            {
                QuantBox.Data.Serializer.PbTickSerializer pts = new QuantBox.Data.Serializer.PbTickSerializer();
                listTickData = pts.Read(stream);

                PbTickCodec Codec = new PbTickCodec();

                listTickView = Codec.Data2View(listTickData, true);

                return listTickView;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return null;
            }
        }