There is a mismatch in the Quantlib documentation instructions and Quantlib GitHub, on pricing simple bonds and term structure building, ql.Schedule
I believe IssueDate should go in ql.schedule not a settlement date as shown in the Quantlib documentation? hence, the documentation seems to be wrong, to me?
QuantLib-SWIG/Python/examples/bonds.py
bondsHelpers = []
for issueDate, maturity, couponRate, marketQuote in bondQuotes:
*****schedule = ql.Schedule(
issueDate,*****
maturity,
ql.Period(ql.Semiannual),
ql.UnitedStates(ql.UnitedStates.GovernmentBond),
ql.Unadjusted,
ql.Unadjusted,
ql.DateGeneration.Backward,
False,
)
bondsHelpers.append(
ql.FixedRateBondHelper(
ql.QuoteHandle(ql.SimpleQuote(marketQuote)),
settlementDays,
100.0,
schedule,
[couponRate],
ql.ActualActual(ql.ActualActual.Bond),
ql.Unadjusted,
redemption,
issueDate,
)
)
instruments = []
for idx, row in pgbs.iterrows():
maturity = ql.Date(row.maturity, '%d-%m-%Y')
***schedule = ql.Schedule(
bondSettlementDate,***
maturity,
ql.Period(frequency),
calendar,
accrualConvention,
accrualConvention,
ql.DateGeneration.Backward,
False)
helper = ql.FixedRateBondHelper(
ql.QuoteHandle(ql.SimpleQuote(row.px)),
bondSettlementDays,
100.0,
schedule,
[row.coupon / 100],
dc,
convention,
redemption)
instruments.append(helper)