Пример #1
0
        public void TestAppendStream_NoData()
        {
            var quoteCapture = new QuoteCapture("DAG_2", 5, new List <long>(), new List <double>(), new List <double>());

            using (var stream = File.OpenWrite(fileName))
                quoteCapture.AppendStream(stream);

            using (var stream = File.OpenRead(fileName))
                quoteCapture.LoadStream(stream);
        }
Пример #2
0
        public void TestLoad_PipFactorNotMatch()
        {
            var str = @"  Symbol:DAG_2;PipFactor:51
                        Time;   Price;

                        1465235480;3531
                        1465235485;3532";

            var quoteCapture = new QuoteCapture("DAG_2", 5, new List <long>(), new List <double>(), new List <double>());

            File.WriteAllText(fileName, str);

            using (var stream = File.OpenRead(fileName))
                quoteCapture.LoadStream(stream);
        }
Пример #3
0
        public void TestLoad_IllegalContent()
        {
            //test robutstness to empty line, tab, space etc.
            var str = @" 
                        Symbol:DAG_2;PipFactor:5   
                        Time;   Price;

                        1465235480;3531
                        1465235485;3532_illegal";

            var quoteCapture = new QuoteCapture("DAG_2", 5, new List <long>(), new List <double>(), new List <double>());

            File.WriteAllText(fileName, str);

            using (var stream = File.OpenRead(fileName))
                quoteCapture.LoadStream(stream);
        }
Пример #4
0
        public void TestLoad_Space()
        {
            //test robutstness to empty line, tab, space etc.
            var str = @" Symbol:DAG_2;PipFactor:5   
                        Time;   Price;Volume;

                        1465235480;3531;0
                        1465235485;3532;0";

            var quoteCapture = new QuoteCapture("DAG_2", 5, new List <long>(), new List <double>(), new List <double>());

            File.WriteAllText(fileName, str);

            using (var stream = File.OpenRead(fileName))
                quoteCapture.LoadStream(stream);
            Assert.AreEqual(quoteCapture.Count, 2);
            Assert.AreEqual(quoteCapture.Time[0], 1465235480);
            Assert.AreEqual(quoteCapture.Price[0], 3531);
            Assert.AreEqual(quoteCapture.Time[1], 1465235485);
            Assert.AreEqual(quoteCapture.Price[1], 3532);
        }