lballabio / QuantLib

The QuantLib C++ library
http://quantlib.org
Other
5k stars 1.73k forks source link

Replacement code of old ql.FixedRateBond #1961

Closed qiubill closed 2 months ago

qiubill commented 2 months ago

Hi lballabio,

Last time I was asking the replacement code for

self.bond = ql.FixedRateBond(int(self.settlement_days), self.face_value, self.schedule, [ql.InterestRate(self.coupon, self.day_count, self.compounding_scheme, self.compounding_frequency)], self.business_day_convention)

Thanks for the quick answer that you offered me the replacement in release 1.34 as below:

coupons = ql.FixedRateLeg( self.schedule, self.day_count, [self.face_value], interestRates=[ql.InterestRate(self.coupon, self.day_count, self.compounding_scheme, self.compounding_frequency)], paymentAdjustment=self.business_day_convention, )

self.bond = ql.Bond( int(self.settlement_days), self.schedule.calendar(), self.schedule.startDate(), coupons, )

I tried it, which works very well. But in our existing code, we have another place to use the same constructor with an additional redemption_value parameter, such as:

self.bond = ql.FixedRateBond(int(self.settlement_days), self.face_value, self.schedule, [ql.InterestRate(self.coupon, self.day_count, self.compounding_scheme, self.compounding_frequency)], self.business_day_convention, self.redemption_value)

what will be the replacement in release 1.34? I didn't see the ql.Bond constructor that takes redemption value, was that changed to something else?

Thanks a lot and look forward to your reply!

lballabio commented 2 months ago

Answered in #1945.