When computing figures for a ZeroCouponBond
in QuantLib, a number of the methods in BondFunctions
expect a Frequency
argument, for example yield()
:
Rate yield (
const Bond & bond,
Bond::Price price,
const DayCounter & dayCounter,
Compounding compounding,
Frequency frequency, // <<- Here
Date settlementDate = Date(),
Real accuracy = 1.0e-10,
Size maxIterations = 100,
Rate guess = 0.05
)
From my asset data, zero coupon bonds are assigned a frequency of ql.Once
, since only one payment is made (at maturity). This follows the guidance from the QuantLib Python docs here.
ql.Once
: pay interest once, common in zero-coupon bonds;
However, if this frequency is passed to yield()
or zSpread()
for example, I get the following error:
RuntimeError: frequency not allowed for this interest rate
I have also tried ql.NoFrequency
and ql.OtherFrequency
, with the same error.
My question is basically: what is the correct frequency to be passed to these BondFunctions
methods for ZeroCouponBond
s (or rather, for any bond type in general) ?
Thanks in advance for any help !