Building a QuantLib Zero Curve Directly from Rates
Summary
The document explains how to create a zero yield curve in QuantLib-Python when zero rates are already available, rather than first bootstrapping them from market quotes and rate helpers. The accepted answer describes supplying maturity dates, corresponding zero-rate values, and a day-count convention to construct a zero curve. QuantLib can then use the curve’s interpolation when valuing an instrument.
The answer also clarifies that a curve by itself does not have a net present value: NPV is calculated for a financial instrument using the curve as an input. The example in the source uses a particular evaluation date, maturities, rates, and convention, but these are illustrative inputs rather than general calibration guidance. The discussion does not cover instrument setup, interpolation choices, compounding assumptions, or validation against market prices, all of which matter when applying a curve to derivative valuation.
Key ideas
- QuantLib can construct a zero curve directly from maturity dates and zero-rate inputs.
- A day-count convention is supplied as part of curve construction.
- The curve can interpolate between provided maturities for use in valuation.
- NPV belongs to an instrument valued with the curve, not to the curve itself.
- The example does not discuss calibration choices or validation against market prices.
Tags
Full text
# Quantlib derivative valuation from zero curve # Quantlib derivative valuation from zero curve I have newly started with Quantlib-Python for valuing derivatives. In all the examples stated in this bolg or in other places, market quote is inserted and bootstrapping is done via individual rate helpers to create the zero curve. Is there a way I can directly insert the zero rates in Quantlib so that it can interpolate from the zero rates and give the final NPV. ## Answer by byouness (score 3, accepted) https://quant.stackexchange.com/a/40954 If you already have the zero rates, you can construct the zero curve using the set of maturities (dates) and zero rates values, in addition to a day count convention in this way: ``` import QuantLib as ql ql.Settings.instance().evaluationDate = ql.Date(26, 7, 2018) dates = [ql.Date(26, 7, 2019), ql.Date(26, 7, 2020), ql.Date(26, 7, 2030)] zero_rates = [0.03, 0.04, 0.06] zero_curve = ql.ZeroCurve(dates, zero_rates, ql.Actual365Fixed()) ``` I don't understand what NPV you are looking for though? The NPV will be related to an instrument, not to a zero curve.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.