public void TestGuppiAlgData()
 {
     using (var provider = new TextCandleProvider())
     {
         provider.SetTextParams(@"data\si-9-17.dat", ';');
         var alg = new GuppiAlgorithm(4, 6, 9, 13, 31, 36, 41, 46, 51, 61);
         var acc = new TestAccAgregator();
         for (var i = 0; i < 61; i++)
         {
             provider.MoveNext();
             var res = alg.Check(provider.Current);
             Assert.IsTrue(res == AlgResult.Exit && !alg.Data.Last().Any());
         }
         while (provider.MoveNext())
         {
             var answer = alg.Check(provider.Current);
             if (answer == FortsRobotLib.AlgResult.Buy)
             {
                 acc.Buy(1 - acc.Assets, provider.Current);
             }
             if (answer == FortsRobotLib.AlgResult.Sell)
             {
                 acc.Sell(1 + acc.Assets, provider.Current);
             }
             if (answer == FortsRobotLib.AlgResult.Exit)
             {
                 acc.Close(provider.Current);
             }
             Assert.IsTrue(alg.Data.Last().Length == 10 + 10 + 8 + 1);
         }
     }
 }
        public void TestGuppiAlgMatrix()
        {
            var alg = new GuppiAlgorithm(4, 6, 9, 11, 13, 16, 31, 36, 41, 46, 51, 61);

            using (var provider = new FinamCandleProvider("SPFB.SI", TimePeriod.Hour,
                                                          "14", "19899", new DateTime(2013, 9, 1), new DateTime(2014, 03, 10)))
            {
                provider.Initialize();
                using (var reader = new StreamReader(@"data\guppi_data.dat"))
                {
                    var startDate = new DateTime(2014, 01, 13, 15, 0, 0);
                    while (provider.Current.TimeStamp != startDate)
                    {
                        provider.MoveNext();
                        alg.Check(provider.Current);
                    }
                    reader.ReadLine();
                    while (!reader.EndOfStream)
                    {
                        provider.MoveNext();
                        alg.Check(provider.Current);
                        var data    = reader.ReadLine().Split(';');
                        var algData = alg.Data.Last();
                        int i;
                        for (i = 0; i < 12; i++)
                        {
                            Assert.IsTrue(Math.Abs(float.Parse(data[i]) - algData[i]) <= 1);
                        }
                        for (i = 12; i < 24; i++)
                        {
                            Assert.AreEqual(int.Parse(data[i]), algData[i]);
                        }
                        Assert.IsTrue(algData[33] == algData[28] && algData[28] == -1);
                    }
                }
            }
        }