Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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]);
                }
            }
        }