public void testGetCotation() { DataGestion dg = new DataGestion(); DateTime date = new DateTime(2010, 1, 1); double d = dg.getCotation("AC FP", date); Console.WriteLine(d); }
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); } }
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"); } }
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); } }
public void testFakeGetID() { DataGestion dataConn = new DataGestion(); String id = dataConn.getID("test"); if (id != null) { throw new ArgumentOutOfRangeException("id non null dans tastFakeGetId"); } }
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); }
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); }
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"); } }
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"); } }
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]); } } }
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); }
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); }
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); } }
/** * 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)); }