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 testVolatilityBasket() { ForwardTestGenerate f = new ForwardTestGenerate(); f.vanillaCallName = "Basket NAME"; Share[] under = new Share[4]; under[0] = new Share("1A", "ID1"); under[1] = new Share("2A", "ID2"); under[2] = new Share("3A", "ID3"); under[3] = new Share("4A", "ID4"); f.underlyingShares = under; f.weight = new double[4] { 0.25, 0.25, 0.25, 0.25 }; f.endTime = new DateTime(2014, 09, 09); f.startDate = new DateTime(2013, 12, 12); f.strike = 20.0; List <DataFeed> datum = f.generateHistory(); BasketPricingModel vcpm = new BasketPricingModel(); vcpm.oWeights = f.weight; vcpm.oSpot = new double[4] { 10, 10, 10, 10 }; vcpm.currentDate = f.startDate; vcpm.oStrike = 20.0; vcpm.oMaturity = f.endTime; vcpm.oShares = f.underlyingShares; vcpm.oName = f.vanillaCallName; vcpm.calculVolatility(datum); //Console.WriteLine(vcpm.oVolatility); /*for (int i = 0; i < 4; i++) * {*/ //System.Diagnostics.Debug.Assert(vcpm.oVolatility[i] > 0.3 && vcpm.oVolatility[i] < 0.5); Console.WriteLine(vcpm.oVolatility[0]); //} }