Code Monkey home page Code Monkey logo

Comments (3)

lballabio avatar lballabio commented on June 5, 2024

Starting from release 1.34 (out later this month) it will be:

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,
)

No replacement in 1.33, unfortunately.

from quantlib.

qiubill avatar qiubill commented on June 5, 2024

Thanks @lballabio for your answer,

What about the old code that has a redemption_value 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
)

How to set up that redemption_value to the bond class in the new code?

from quantlib.

lballabio avatar lballabio commented on June 5, 2024

That would be

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,
)

cashflows = coupons + (
    ql.Redemption(self.redemption_value, self.schedule.endDate()),
)

self.bond = ql.Bond(
    self.settlement_days,
    self.schedule.calendar(),
    self.face_value,
    self.schedule.endDate(),
    self.schedule.startDate(),
    cashflows
)

from quantlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.