Example #1
0
        public void testGetCotation()
        {
            DataGestion dg   = new DataGestion();
            DateTime    date = new DateTime(2010, 1, 1);
            double      d    = dg.getCotation("AC FP", date);

            Console.WriteLine(d);
        }
Example #2
0
        public void pick_a_name()
        {
            DataGestion dataConn = new DataGestion();
            string      accor    = dataConn.getName("AC FP");

            if (!accor.Contains("ACCOR SA"))
            {
                throw new ArgumentOutOfRangeException("Le nom récupéré ne correspond pas à l'ID saisi: " + accor);
            }
        }
Example #3
0
        public void listingNAMES()
        {
            DataGestion   dataConn = new DataGestion();
            List <String> liste    = dataConn.getListofNames();

            if (liste.Count != 14)
            {
                throw new ArgumentOutOfRangeException("La liste d'ID contiens " + liste.Count + " éléments au lieu de 14");
            }
        }
Example #4
0
        public void testGetID()
        {
            DataGestion dataConn = new DataGestion();
            String      id       = dataConn.getID("ALSTOM");

            if (!id.Contains("ALO FP"))
            {
                throw new ArgumentOutOfRangeException("l'ID récupéré n'est pas bon :" + id);
            }
        }
Example #5
0
        public void testFakeGetID()
        {
            DataGestion dataConn = new DataGestion();
            String      id       = dataConn.getID("test");

            if (id != null)
            {
                throw new ArgumentOutOfRangeException("id non null dans tastFakeGetId");
            }
        }
Example #6
0
        public void testTailleTableauCotation()
        {
            DataGestion dataConn = new DataGestion();

            double[] tabCote = dataConn.getCotation("CA FP", 10);
            if (tabCote.Length != 10)
            {
                throw new ArgumentOutOfRangeException("le tableau de cotation n'a pas la bonne taille");
            }
            Debug.Assert(tabCote.Length == 10);
        }
Example #7
0
        public void testVolatility()
        {
            DataGestion             dg   = new DataGestion();
            VanillaCallPricingModel vcpm = new VanillaCallPricingModel();
            Share share = new Share("ACCOR SA", "AC FP     ");

            vcpm.oShares    = new Share[1];
            vcpm.oShares[0] = share;
            List <DataFeed> ldf = dg.getListDataField(new DateTime(2013, 10, 10), new DateTime(2014, 10, 10), vcpm.oShares);

            vcpm.calculVolatility(ldf);
        }
Example #8
0
        public void testValeurTableauCotation()
        {
            DataGestion dataConn = new DataGestion();

            double[] tabCote = dataConn.getCotation("CA FP", 10);
            if (tabCote[0] != 29.4250 ||
                tabCote[1] != 29.5050 ||
                tabCote[2] != 30.2000 ||
                tabCote[3] != 30.2800)
            {
                throw new ArgumentOutOfRangeException("une des valeurs n'est pas bonne dans le tableau de  cotation");
            }
        }
Example #9
0
        public void getTable()
        {
            DataGestion dataConn = new DataGestion();

            string[,] tableB = dataConn.getIDNames();
            if (tableB.Length != 28)
            {
                throw new ArgumentOutOfRangeException("Le tableau n'a pas la bonne  dimension : " + tableB.Length);
            }
            if (!tableB[3, 0].Contains("AIR FP") || !tableB[3, 1].Contains("AIRBUS GROUP SE"))
            {
                throw new ArgumentOutOfRangeException("les valeurs du tableau ne sont pas correctes");
            }
        }
Example #10
0
        public void TestGenHistOptionForward()
        {
            String      VanillaCallName = "FistOptionName";
            DataGestion dataConn        = new DataGestion();

            Share[] underlyingShares = new Share[dataConn.numberOfAssets()];

            var listeID = dataConn.getListofID();

            for (int i = 0; i < dataConn.numberOfAssets(); i++)
            {
                underlyingShares[i] = new Share(dataConn.getName(listeID.ToArray()[i]), listeID.ToArray()[i]);
            }
            DateTime endTime   = new DateTime(2016, 1, 1);
            DateTime startDate = new DateTime(2015, 10, 10);
            double   strike    = 100.0;

            double[] weight = new double[dataConn.numberOfAssets()];
            for (int i = 0; i < dataConn.numberOfAssets(); i++)
            {
                weight[i] = 1 / dataConn.numberOfAssets();
            }


            IGenerateHistory test = new ForwardTestGenerate();

            test.endTime          = endTime;          //
            test.strike           = strike;           //
            test.underlyingShares = underlyingShares; //
            test.vanillaCallName  = VanillaCallName;  //
            test.weight           = weight;           //
            test.startDate        = startDate;        //
            List <DataFeed> ret = test.generateHistory();

            Console.WriteLine("----");
            foreach (DataFeed dataf in ret)
            {
                List <string> keyList = new List <string> (ret.ToArray()[0].PriceList.Keys);

                foreach (var ele in keyList)
                {
                    Console.WriteLine(dataf.Date);
                    Console.WriteLine(dataf.PriceList[ele]);
                }
            }
        }
Example #11
0
        public void TestMethod1()
        {
            BasketPricingModel bpm = new BasketPricingModel();

            bpm.oMaturity = new DateTime(2015, 8, 20);
            bpm.oName     = "test";
            Share share = new Share("ACCOR SA", "AC FP     ");

            bpm.oShares    = new Share[1];
            bpm.oShares[0] = share;
            bpm.oStrike    = 45.5;
            DataGestion     dg   = new DataGestion();
            DateTime        date = new DateTime(2013, 8, 21);
            List <DataFeed> ldf  = dg.getListDataField(date, bpm.oMaturity, bpm.oShares);
            PricingResults  pR   = bpm.getPayOff(ldf);

            Console.WriteLine(pR.Price);
        }
Example #12
0
        public void TestMethod1()
        {
            VanillaCallPricingModel vcpm = new VanillaCallPricingModel();

            vcpm.oMaturity = new DateTime(2015, 8, 20);
            vcpm.oName     = "test";
            Share share = new Share("ACCOR SA", "AC FP     ");

            vcpm.oShares    = new Share[1];
            vcpm.oShares[0] = share;
            vcpm.oStrike    = 45.5;
            vcpm.oSpot      = new double[1];
            vcpm.oSpot[0]   = 48;
            DataGestion     dg   = new DataGestion();
            DateTime        date = new DateTime(2013, 8, 20);
            List <DataFeed> ldf  = dg.getListDataField(date, vcpm.oMaturity, vcpm.oShares);
            PricingResults  pR   = vcpm.getPayOff(ldf);

            Console.WriteLine(pR.Price);
        }
Example #13
0
        public void TestMethod2()
        {
            DataGestion             dg   = new DataGestion();
            VanillaCallPricingModel vcpm = new VanillaCallPricingModel();

            vcpm.oMaturity = new DateTime(2015, 8, 20);
            vcpm.oName     = "test";
            Share share = new Share("ACCOR SA", "AC FP     ");

            vcpm.oShares    = new Share[1];
            vcpm.oShares[0] = share;
            vcpm.oStrike    = 10;
            vcpm.oSpot      = new double[1];
            DateTime date = new DateTime(2015, 1, 12);

            vcpm.oSpot[0] = dg.getCotation("AC FP", date);
            List <DataFeed>       ldf = dg.getListDataField(date, vcpm.oMaturity, vcpm.oShares);
            List <PricingResults> LpR = vcpm.pricingUntilMaturity(ldf);

            foreach (PricingResults pr in LpR)
            {
                Console.WriteLine(pr.Price);
            }
        }
Example #14
0
        /**
         * Transmet la liste des dataFeed venant de la base de données
         * en précisant certains paramètres passés comme attributs de la classe
         *
         * */
        public List <DataFeed> generateHistory()
        {
            DataGestion dg = new DataGestion();

            return(dg.getListDataField(startDate, endTime, underlyingShares));
        }