Quantib floating-bond pricing using Python

I am trying to evaluate a very basic floating rate relationship in python using the SWIG Quantlib chip (v1.2). I changed the example included in the documentation.

My bond has 4 years. Libor is set at 10% and the bond spread is 0. My question is that if I discount at a rate of 10%, why is there no 100 PV bond? I get a value of 99.54.

Thank!

from QuantLib import *

frequency_enum, settle_date = 4, Date(5, 1, 2010)
maturity_date = Date(5, 1, 2014)
face_amount = 100.0
settlement_days = 0
fixing_days = 0

calendar = NullCalendar()
settle_date = calendar.adjust(settle_date)
todays_date = calendar.advance(settle_date, -fixing_days, Days)
Settings.instance().evaluationDate = todays_date

rate = 10.0 / 100.0

flat_forward = FlatForward(settle_date,
                           rate,
                           Thirty360(),
                           Compounded,
                           frequency_enum)

discounting_term_structure = RelinkableYieldTermStructureHandle(flat_forward)
index_term_structure = RelinkableYieldTermStructureHandle(flat_forward)

index = USDLibor(Period(3, Months), index_term_structure)

schedule = Schedule(settle_date,
                    maturity_date, Period(frequency_enum),
                    NullCalendar(),
                    Unadjusted, Unadjusted,
                    DateGeneration.Forward, False)

floating_bond = FloatingRateBond(settlement_days,
                                 face_amount,
                                 schedule,
                                 index,
                                 Thirty360(),
                                 Unadjusted,
                                 fixing_days,
                                 [],   # Gearings
                                 [0],  # Spreads
                                 [],      # Caps
                                 [],      # Floors
                                 False,    # Fixing in arrears
                                 face_amount,
                                 settle_date)

bond_engine = DiscountingBondEngine(discounting_term_structure)
floating_bond.setPricingEngine(bond_engine)

# coupon pricers
pricer = BlackIborCouponPricer()

volatility = 0.0
vol = ConstantOptionletVolatility(settlement_days,
                                  calendar,
                                  Unadjusted,
                                  volatility,
                                  Thirty360())

pricer.setCapletVolatility(OptionletVolatilityStructureHandle(vol))
setCouponPricer(floating_bond.cashflows(), pricer)

print floating_bond.NPV(), floating_bond.cleanPrice(), floating_bond.dirtyPrice()
+5
source share
1 answer

Coupon rates are fixed using the USDLibor daily counter (i.e. Actual / 360), which does not correspond to the payment day account provided by you (30/360). You can see this by checking the coupons:

cfs = floating_bond.cashflows()
coupons = [ as_coupon(c) for c in cfs[:-1] ] # the last one is the redemption
print [ (c.rate(), c.accrualPeriod()) for c in coupons ]

which gives you T = 0.25 for all coupons, but the rates are below 10%.

, . - Actual360() , 100.002 ( , LIBOR, USD ). - LIBOR 30/360 ; , , IborIndex.

+4

All Articles