|
From: David S. <da...@el...> - 2021-07-20 18:13:33
|
Hi, Could you just derive MyFixedRateBond from FixedRateBond and modify the constructor to remember the payment convention? Best David Sent from my iPhone > On 20 Jul 2021, at 18:33, mat...@gm... wrote: > > Hello Jian, > > You probably cannot: The Bond c'tor consumes a Leg, a dynamic array of cash flows. To get those, the payment convention has already been applied. Essentially no reason to keep memorizing it. > > Maybe there is even a case where the convention can change over time, say for a bond with two coupon periods: one fixed, one structured. Not sure if it makes sense and it probably needs some extension to actually properly price the structure, but let us leave that aside. I do think, multiple Legs for one bond are possible in ORE though: https://github.com/OpenSourceRisk/Engine/blob/347f7d81b1991b5b88522e6e4793e82ddfe9be09/OREData/ored/portfolio/bond.cpp#L186 > > Similar can be said for the day counter, which may also be an interesting feature to obtain from a bond instance (and which also may not be unique). > > So I suggest to create a wrapper around the QuantLib bond instance and store those properties if required somewhere downstream in the program flow. > > > HTH > Matthias > > > -----Original Message----- > From: jian Xu <jia...@gm...> > Sent: Friday, 16 July, 2021 23:01 > To: QuantLib users <qua...@li...> > Subject: [Quantlib-users] How to get the payment convention given a FixedRateBond? > > Hi, > > I'm using the Python interface of the QuantLib. The FixedRateBond constructor can take in a payment convention (Unadjusted, ModifiedFollowing, etc). And inside the C++ code, I can see the paymentConvention is used to construct the cashflows. My question is, given a FixedRateBond object in Python (or more generally a Bond object), how do I get the paymentConvention out of it? Thanks a lot. > > 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 |