|
From: jian Xu <jia...@gm...> - 2021-04-11 14:43:01
|
Can anyone help here? I think I'm already very close. There ought to be a way to bump the index, either buy relink it to a bumped curve, or by some other means. This should be a common practice when we want to calculate the interest rate sensitivity of a floating rate bond, shouldn't it? Thanks. On Fri, Apr 9, 2021 at 2:49 PM jian Xu <jia...@gm...> wrote: > > But after I get the index, how to bump the index? What I'm trying to > do is to calculate the cashflows when the index curve is bumped up, > say 0.0001, in parallel. I have the floating rate bond already > constructed, then > > bond = ql.FloatingRateBond(...) > cpn = ql.as_floating_rate_coupon(bond.cashflows()[0]) > ibor = ql.as_iborindex(cpn.index()) > forecast_curve = ibor.forwardingTermStructure() > > But how do I bump the forecast_curve? I can create a bumped forecast > curve like the following: > > forecast_curve_bumped = ql.ZeroSpreadedTermStructure(forecast_curve, > ql.QuoteHandle(ql.SimpleQuote(.0001))) > > But then how do I link the index to this bumped curve, so that the > bond's cashflow will be impacted? Thanks. > > > On Fri, Apr 9, 2021 at 11:57 AM jian Xu <jia...@gm...> wrote: > > > > I see. Thanks! > > > > On Fri, Apr 9, 2021 at 4:31 AM Luigi Ballabio <lui...@gm...> wrote: > > > > > > As David said — or you can avoid the map by selecting the first coupon before conversion: > > > > > > c = ql.as_floating_rate_coupon(bnd.cashflows()[0]) > > > myindex = c.index() > > > > > > > > > On Fri, Apr 9, 2021 at 10:25 AM David Duarte <nh...@gm...> wrote: > > >> > > >> Hi, > > >> > > >> I'm not sure the index is exposed for the bond object, but you can extract it from the cashflows. > > >> Maybe not the easiest way to go about it, but hopefully you'll get the idea: > > >> > > >> bnd = ql.FloatingRateBond(...) > > >> c = [*map(ql.as_floating_rate_coupon, bnd.cashflows())][0] > > >> myindex = c.index() > > >> > > >> Regards, > > >> David > > >> > > >> On Fri, 9 Apr 2021 at 03:03, jian Xu <jia...@gm...> wrote: > > >>> > > >>> Hi, > > >>> > > >>> An index is passed in duration the construction of a FloatingRateBond, > > >>> But after that, given the FloatingRateBond object, how do I get the > > >>> index back (in Python)? Thanks. > > >>> > > >>> Jian > > >>> > > >>> > > >>> _______________________________________________ > > >>> QuantLib-users mailing list > > >>> Qua...@li... > > >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users > > >> > > >> _______________________________________________ > > >> QuantLib-users mailing list > > >> Qua...@li... > > >> https://lists.sourceforge.net/lists/listinfo/quantlib-users |