Questions tagged [quantlib]
Quantlib is an open-source C++ library for quantitative finance.
478
questions
0
votes
1
answer
39
views
Pillar Date of Overnight Interest Swap Helper
I am not being able to set the pillar date of an overnight interest swap helper to its maturity date.
I have the following code:
...
0
votes
0
answers
26
views
Computation of CouponLegNPV using IsdaCdsEngine
I've recently been trying to work on and understand the concepts around CDS. By making simplifications (flat hazard rate, flat forward rate), I wanted to compare the values I could obtain by manual ...
4
votes
2
answers
241
views
Calculation of Cashflows Using ISMA Day Count in Fixed-Rate Bond
I'm working with a fixed-rate bond in QuantLib, and I have set the day count convention to ISMA, but I would like to understand how this specific day count convention is used in the calculation of the ...
0
votes
1
answer
370
views
Using QuantLib to get all holidays currently published by an exchange in multiyears without specifying a range
Is there a way to get a list of all the holidays published in an exchange calendar without specifying a date range? For example, NYSE has published their holiday calendar up to 2024 and I want to see ...
0
votes
1
answer
182
views
QuantLib Python currency conversion
A simple code below to do currency conversion copied from QuantLib-Python Documentation. This is failing in the EUR to GBP conversion (in the last line of code). Thank you for looking into this.
The ...
1
vote
2
answers
126
views
QuantLib: How to bootstrap Yield Curve using 3M futures - Python
I need to bootstrap a yieldcurve with 3M futures, using a cubic spline if possible.
Using, for example 3M Euribor, how do I bootstrap the yield curve using python?
I have a vector of dates and a ...
2
votes
1
answer
241
views
Actual360 convention in quantlib schedule
I'm trying to make a payment schedule for different bonds in quantlib. For example, I made such a schedule:
...
6
votes
2
answers
249
views
Best practice in QuantLib Python to include borrow rate
When pricing a vanilla option, there are at a minimum 3 yield curves to consider:
risk free yield curve = YC
dividend yield curve = DC (or discrete dividends for American options but not the topic ...
1
vote
1
answer
161
views
Unable to match quantlib examples
I'm currently learning Quantlib using C++ and am following the very good instructions here:
https://www.quantlib.org/slides/dima-ql-intro-2.pdf
Specifically on building piecewise yieldcurves (slide ...
1
vote
1
answer
479
views
SOLVED Manually Recomputing Forward Rates from QuantLib Python
I have used QuantLib Python to compute 1-month forward rates from zero rates as at 05 December 2019.
My codes can be found below:
...
1
vote
1
answer
50
views
PV different from Dirty Price in QuantLib
As far as I understand, dirty price is the sum of clean price and accrued amount and should be equal to the Present Value (PV) of a bond at a certain yield rate. However, I can't replicate this ...
2
votes
1
answer
746
views
Quantlib Black Model for Commodity Options (Interest Rate Options) is extremely light on gamma and price vs BBG, is model incorrect?
I am using the QuantLib developers example to try and price a TY option. The Delta is pretty close but the price and gamma are way off (almost by a factor of 2).
Am I using the model wrong or is the ...
2
votes
2
answers
334
views
Quantlib SOFR swap repricing across 2 different dates
I am trying to price SOFR swaps in two different dates (the same swaps, just different curves and dates)
This are my initial parameters:
...
1
vote
1
answer
229
views
Understanding SOFR Fixing Rate Retrieval for Future Dates in QuantLib
I am using QuantLib to calculate the SOFR index for a bond's (ISIN : US025816CL12) cash flows. My objective is to understand how QuantLib computes the SOFR fixing rate for future dates. Here is my ...
0
votes
1
answer
205
views
Canada House Trust Floater pricing
I am using python quantlib, according to one of the Quantlib sample code to evaluate the CHT (Canada Housing Trust) Floaters, and the index I am using is CDOR, and somehow the price I got is always ...
6
votes
2
answers
170
views
Replicating QuantLib plain vanilla Interest Rate Swap valuation
I'm learning QuantLib-Python and trying to replicate an Interest Rate Swap valuation on a custom curve constructed by passing lists of dates and discounting factors. Please see my code below
...
3
votes
1
answer
88
views
Quantlib: Is linking the curve to the discount curve important in vanilla swaps?
Below are steps I followed to value a few swaps. Just want to know if I have included the key steps in the below definitions. In some examples I found that we are also adding indexcurve.linkTo(). I ...
2
votes
1
answer
93
views
Generating normally distributed random numbers using Sobol generator in QuantLib
I am trying use low discrepancy Sobol RNG to generate normally distributed random numbers and fill an Eigen matrix with those random numbers. The matrix represents a basket of 5 assets (rows) each ...
1
vote
1
answer
67
views
QuantLib Python: How to print each caplet/floorlet value, intrinsic value and time value at each fixing date?
I have the following code to price a floor (can also be used for cap), and have been computing the payoff myself, but I think QL can already do this. Since the cashflows I print out aren't correct as ...
1
vote
1
answer
73
views
Zero Curve Interpolation Does Not recover Node point input rates
I having an issue with interpolation in QuantLib Python. Please see the code below for a minimum working example
...
0
votes
1
answer
424
views
Bootstrapping the 6m Sterling Libor curve
I am trying to bootstrap the 6m sterling swap curve using the depos and swap rates codes are below. I am a newbie and have been following (or at least trying to!) the python cookbook. I wanted to know ...
4
votes
1
answer
3k
views
Quantlib: Greeks of FX option in Python
I'm using Quantlib in Python to price an FX option.
I'm comparing the result to Bloomberg, to make sure the code is working correct.
I also want to calculate all the Greeks, and eventually use those ...
3
votes
1
answer
858
views
Quantlib: day-by-day evaluation of option value
I'm using Quantlib in Python to price an FX option. I'm comparing the result to Bloomberg, to make sure the code is working correct.
I want to calculate the P&L of a certain option trading ...
0
votes
1
answer
81
views
Quantlib Vanilla Swap Amount not based on Forwards
I have the following code:
...
0
votes
0
answers
115
views
Building a forward curve for multiple tenors - Quantlib python
I am attempting to build a forward curve for multiple tenors (1M / 3M / 6M / 12M) using the quantlib library. The input to my model are sofr swaps(1W through 50Y). It appears I am building my curve ...
2
votes
1
answer
198
views
Why is the NPV of this FX Forward 0?
I've checked similar questions and answers but even after setting the evaluation date in ql.settings I still get zero. Like another poster, I also have the QL cookbook and have read everything I could ...
0
votes
1
answer
396
views
Configuring barrier option in Quantlib-Python
Is there a possibility to configure the period the barrier is active, using Quantlib for python? Namely to set up the start and the end dates we compare the spot vs the barrier.
If we look at quantlib-...
0
votes
1
answer
479
views
Bootstrapping SOFR curve and Swap Payment Lag
Can someone provide me an intuitive explanation of how discount factors are bootstrapped for SOFR when Swaps are trading with payment delay/ lag (e.g. of 2 business days).
I can intuitively derive the ...
2
votes
2
answers
126
views
Use `LocalVolTermStructureHandle` in Python QuantLib
I would like to simulate a local volatility underlying
$$ dS_t = S_t\sigma(t, S_t)dW_t $$
and have looked at QuantLib's LocalVolTermStructureHandle to do so.
So far:...
1
vote
1
answer
140
views
Pricing an American FX Option using Quantlib
I need some guidance on valuing American style FX options (spots and forwards) using quantlib in Python. Given the following parameters:
Domestic and foreign risk-free rates
Current market spot and ...
3
votes
1
answer
158
views
QuantLib: Analytical Greeks and Numerical Greeks do not match?
I use the Black Scholes Merton (BSM) model from QuantLib to calculate Call options price and its analytical Greeks. I also manually calculate its Numerical Greeks (Theta, Vega), but the results do not ...
0
votes
1
answer
105
views
QuantLib Yield Curve Bootstrapping Fails with Bracketing Error
I'm trying to build the yield curve simply using Treasury yields one would get by querying the FRED API, but as my code below will show, I'm told on the 1st iteration that there was failure at the 4th ...
0
votes
2
answers
848
views
QuantLib Compounded vs CompoundedThenSimple and Simple vs SimpleThenCompounded
I was experimenting on a FixedRateBond on QuantLib python port and have a question on the use of Compounded vs. CompoundedThenSimple methods of discounting.
I am using the FixedRateBond.dirtyPrice() ...
0
votes
1
answer
115
views
Constructing a Custom Schedule in QuantLib for Long/Short Coupons
I am currently using QuantLib for some bond pricing tasks and I have run into a problem which I hope someone here can help me with.
In my current project, I am required to model bond schedules that ...
0
votes
0
answers
44
views
How do I obtain the RMSE from a QuantLib curve estimation?
I'm estimating yield curves in Python using the QuantLib package and the included Nelson Siegel, Svensson, specifications. I can get the estimated parameters, but I would like to see a measure of the ...
1
vote
1
answer
301
views
Central Bank Meeting Date Curve in QuantLib
Is it possible to construct a central bank meeting date curve, using futures prices & OIS rates, in QuantLib?
Specifically, I mean a yield curve with flat (constant) forward rates in between ...
1
vote
2
answers
316
views
How can I extract the strike price from a Quantlib option object?
I am trying to write a Python function that performs some calculations using a list of Quantlib options, and I would like to pass only that list without other information. In particular, the strike of ...
2
votes
2
answers
2k
views
Calculating the greeks for Quantlib Python Swaptions
So I have created a Swaption object and can get the premium with the NPV() function. However, I would also like to calculate the greeks (eg. delta, vega).
From some searching, I found that vega can ...
0
votes
1
answer
61
views
Time Dependent Heston model yields a runtime error in Quantlib (Python)
I am trying to fit a time dependent Heston model using Quantlib Python. I'm getting the following runtime error: Boost assertion failed : px !=0.
Can somebody help in this or is there an example of ...
2
votes
0
answers
79
views
Quantlib: Problem with discount curve with different settlement days than the swap curve
When pricing a interest rate swap, I use the swap curve to price the instrument and the corresponding OIS curve to discount it. However, for some countries (eg Canada), the IRS curve settles on the ...
0
votes
1
answer
101
views
Issue with QuantLib's BondFunctions.zSpread using RelinkableYieldTermStructureHandle in Python
I'm using QuantLib in Python to calculate the z-spread of a bond. I have a RelinkableYieldTermStructureHandle for the yield curve, but I'm getting a TypeError when ...
2
votes
3
answers
1k
views
In quantlib (python), is there a way to specify settlementdays for a swapratehelper without having to also give discountCurve?
Using the following Python code I am setting USD LIBOR Swap quotes. I found that by default settlementdays uses whatever is associated with the Index (in C++:
...
3
votes
0
answers
55
views
CDS Runtime Error: Issue changing evaluation date using UpfrontCdsHelper in Python
If I run the below CDS pricing example (from https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/examples/cds.py) using the UpfrontCdsHelper instead of the SpreadCdsHelper, I get the ...
1
vote
1
answer
99
views
Quantlib - bond with capped coupons
Using QuantLib I want to price a Floating rate bond whose coupons are capped at some rate.
I understand I could price the coupon caps separately and then add that to a zero-bond.
However, I've noticed ...
2
votes
0
answers
99
views
Quantlib match clean price with bbg clean price : Huge gap between calculated price and bloomberg
I am not able to make quantlib match bloomber price, maybe I don't use the right parameters into ql.Schedule or ql.FixedRateBond
...
0
votes
1
answer
173
views
Does QuantLib have a DayCount convention that supports India financial year calculations?
I'm currently using QuantLib to perform financial calculations in my application, but I'm having trouble finding a DayCount convention that supports the India financial year calendar (April 1 to March ...
0
votes
1
answer
234
views
Quantlib: How to bootstrap FedFunds Index having other tenors 3M, 1Wk, etc?
I am valuing few Basis Swaps having combination of USD-FedFunds-H.15-OIS-COMPOUND3M vs USD3MLibor. However, I can understand to value 'USD-FedFunds-H.15-OIS-COMPOUND1D' by using ql.FedFunds(). But ...
2
votes
1
answer
171
views
Using Yield Term Structure for Bond Pricing in QuantLib: Is a Zero-Coupon Curve Necessary?
I've been using QuantLib for constructing a yield curve and pricing a bond. I am wondering if I'm using the correct method to create my yield term structure (yts) ...
0
votes
1
answer
166
views
Discrepancy between Bootstraped Zero Rates: Gaps between Bloomberg and My Calculated Zero Rates
I have been attempting to bootstrap zero rates using quantlib, but I am perplexed by the significant discrepancies between my calculated zero rates and those ...
2
votes
0
answers
135
views
Seasonality adjustment within Quantlib Zero Coupon Inflation Swap
I am currently working on pricing a Zero Coupon Inflation Swap using Quantlib in Python. During my analysis, I have observed that when the start date and end date of the swap coincide exactly with X ...