Re: Asset swap spread calculation
Posted by
MDecau on
Apr 10, 2015; 3:48pm
URL: http://quantlib.414.s1.nabble.com/Asset-swap-spread-calculation-tp16457p16459.html
Sure. But I should first let you know that I am not using the real QuantLib, but QLNet instead, which is just the C# version of Quantlib. I guess you're also familiar with it, it is almost always exactly the same structures and function names.
Here is a link to download the code of my small test program (only 4 small files, but don't forget to add a reference to QLNet dll) :
Bond_pricer_test.zipAnd here is the part that does not work (at the far end of the FixedRateBondProcess class) :
IPricingEngine assetSwapEngine = new DiscountingSwapEngine(Program.currentYieldCurves.discountingTermStructure);
AssetSwap assSwap = new AssetSwap(true, fixedRateBond, fixedRateBond.cleanPrice(yield, dc, Compounding.Compounded, Frequency.Annual), new Euribor6M(Program.currentYieldCurves.discountingTermStructure), 0);
assSwap.setPricingEngine(assetSwapEngine);
Console.WriteLine("Asset Swap Spread = " + assSwap.fairSpread());