[Python] Quantlib CallableFixedRateBond yield on a call Date

Discussão em 'Python' iniciado por Stack, Janeiro 23, 2025.

  1. Stack

    Stack Membro Participativo

    I have a rather simple example of a fixed rate callable bond that I would like to go from price to YTC. Let's just assume it can only be called on the one specified date to make it easier.

    I can get the YTM as follows

    import QuantLib as ql
    ql.Settings.instance().evaluationDate = ql.Date(23,1,2025)

    schedule = ql.MakeSchedule(
    effectiveDate=ql.Date(20,2,2024),
    terminationDate=ql.Date(20,2,2031),
    frequency=ql.Semiannual
    )

    settlement_days = 1
    face_amt = 100
    coupons = [.05834]
    payment_day_counter = ql.Thirty360(ql.Thirty360.BondBasis)

    call_schedule = ql.CallabilitySchedule()
    call_schedule.append(ql.Callability(ql.BondPrice(100,ql.BondPrice.Clean), ql.Callability.Call, ql.Date(20,12,2030)))


    bond = ql.CallableFixedRateBond(1, face_amt, schedule,coupons,payment_day_counter,ql.Following,100,ql.Date(20,2,2024),call_schedule)

    bond.bondYield(102,payment_day_counter,ql.Compounded, ql.Semiannual)


    Is there an easy way to get the YTC? I can't pass in a different date to the bondYield function since the schedule will be wrong. I'm hoping I don't need to create a new schedule for the bond assuming it will be called?

    Continue reading...

Compartilhe esta Página