While @Baruch Youssin answers correctly in the general sense, the first part of his answer isn't what happened in the example code.
While QLNet is a port of QuantLib, it's not a direct port. Your quoted example doesn't show up in QLNet. The example in QuantLib was written in a very complicated way, in fact it's a simple example.
discountingTermStructure is simply a variable in the code. I can name it as something else. It links to bondDiscountingTermStructure, a yield-curve derived by today's market quotes. The yield-curve is derived by zero-coupon-rates and fixed-rate bonds.
// Adding the ZC bonds to the curve for the short end
bondInstruments.push_back(zc3m);
bondInstruments.push_back(zc6m);
bondInstruments.push_back(zc1y);
// Adding the Fixed rate bonds to the curve for the long end
for (Size i=0; i<numberOfBonds; i++) {
bondInstruments.push_back(bondsHelpers[i]);
}
boost::shared_ptr<YieldTermStructure> bondDiscountingTermStructure(
new PiecewiseYieldCurve<Discount,LogLinear>(
settlementDate, bondInstruments,
termStructureDayCounter,
tolerance));
This curve can be used for discounting in bond pricing.
boost::shared_ptr<PricingEngine> bondEngine(
new DiscountingBondEngine(discountingTermStructure));
DiscountingBondEngine would ask the underlying fixed-rate bond for the cash-flow amount. This amount would need to be discounted. The discount rate is supplied by the discountingTermStructure yield-curve.
Next, we'd want to price a floating-rate bond. It requires a forward curve. In particular, we need a forward curve of 3M USD LIBOR because the bond links to the 3M LIBOR index.
FloatingRateBond floatingRateBond(
settlementDays,
faceAmount,
floatingBondSchedule,
libor3m,
Actual360(),
ModifiedFollowing,
Natural(2),
// Gearings
std::vector<Real>(1, 1.0),
// Spreads
std::vector<Rate>(1, 0.001),
// Caps
std::vector<Rate>(),
// Floors
std::vector<Rate>(),
// Fixing in arrears
true,
Real(100.0),
Date(21, October, 2005));
This forward curve bootstrapped by:
// A depo-swap curve
std::vector<boost::shared_ptr<RateHelper> > depoSwapInstruments;
depoSwapInstruments.push_back(d1w);
depoSwapInstruments.push_back(d1m);
depoSwapInstruments.push_back(d3m);
depoSwapInstruments.push_back(d6m);
depoSwapInstruments.push_back(d9m);
depoSwapInstruments.push_back(d1y);
depoSwapInstruments.push_back(s2y);
depoSwapInstruments.push_back(s3y);
depoSwapInstruments.push_back(s5y);
depoSwapInstruments.push_back(s10y);
depoSwapInstruments.push_back(s15y);
boost::shared_ptr<YieldTermStructure> depoSwapTermStructure(
new PiecewiseYieldCurve<Discount,LogLinear>(
settlementDate, depoSwapInstruments,
termStructureDayCounter,
tolerance));
The relationship between zero rates and swap rates will tell us the forward rates.