Questions tagged [quantlib]
Quantlib is an open-source C++ library for quantitative finance.
491
questions
2
votes
1
answer
215
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 ...
2
votes
2
answers
147
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:...
2
votes
1
answer
196
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
198
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
137
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
931
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
188
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
49
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
2
answers
348
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
71
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
89
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
154
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 ...
3
votes
0
answers
80
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
113
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
108
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
180
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 ...
2
votes
1
answer
254
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
266
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 ...
3
votes
0
answers
216
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 ...
4
votes
1
answer
332
views
Yield curve bootstrapping not producing expected cash flow start date
I'm currently working on building a yield curve using OIS swaps. However, I'm encountering an issue with the cash flow start date that I'm struggling to understand. Here's a simplified version of my ...
2
votes
1
answer
579
views
BootStrap with quantlib USD SOFR (vs. FIXED RATE) swap curve
I struggle to understand why my market rates does not match my bootstrap model. So I wonder why the spread is that high between market & model.
...
0
votes
1
answer
102
views
QuantLib: How to implement custom FittingMethod in Python?
I am trying to implement MonotoneConvex by Hagan/West by extending FittingMethod class. As per this page:
https://rkapl123.github.io/QLAnnotatedSource/d7/d0d/...
1
vote
2
answers
163
views
CrossCurrencyBasisSwapRateHelper feature deprecated
I have been using the CrossCurrencyBasisSwapRateHelper feature to generate a colateralised discounting curve where the collateral is in a currency different to that of the asset. However, I noticed ...
2
votes
2
answers
741
views
parameter in FixedRateBondHelper of quantlib
I'm working with 10 bonds with different maturity and want to get the zero curve. I tried the quantlib. However, I cannot understand the parameter in FixedRateBondHelper. Here is my code:
...
0
votes
1
answer
158
views
QuantLib: null term structure set to this instance of index
I'm playing around with QuantLib and trying to price an interest rate cap using HW 1F model.
...
2
votes
1
answer
720
views
Question regarding fitting Euribor curve using different basis quotes using Quantlib Python
I am trying to fit a EUR curve based on the following instruments:-
EONIA quotes
1m vs 6m basis quotes
3m (outright) quotes
6m (outright) quotes
6m vs 12m quotes
(1) , (3) & (4) are simply ...
1
vote
0
answers
172
views
SabrSwaptionVolCube Class in Quantilib Python
Just noticed after upgrading to the most recent version of Quantlib Python that the class ql.SabrSwaptionVolCube is now available. This is a very useful class in that it behaves in very much the same ...
4
votes
1
answer
158
views
Quantlib Slow valuation of ois_swap on multiple eval days
I have bootstrapped a curve using several depo and swap rates and am trying to use that curve to get the NPV of a swap over a period of time. The generation of prices iteratively through time is ...
0
votes
0
answers
110
views
QuantLib: Getting the present value of a leg of cashflows using a 'risk-free' yield curve
I am trying to evaluate the present value of some cashflows and QuantLib does not return the discount factors that I am expecting.
I have a Risk Free (Zero Coupon Bond) Yield curve:
...
0
votes
1
answer
34
views
RangeAccrualFloaterCoupon not visible Quantlib Swig
I was wondering why RangeAccrualFloatersCoupon is not accessible through SWIG QuantLib. I am currently using QuantLib python. Can anyone help ?
Regards.
1
vote
1
answer
143
views
QuantLib: How to iterate over Cashflows in a Leg
I am looking for a way to obtain dates and amounts of each cashflow in a leg, without having to pop the cashflows out of the leg, like this
...
1
vote
1
answer
744
views
Python yield curve bootstrapping equivalent to Matlab IRDataCurve.bootstrap
I want to bootstrap the yield curve of multiple currencies using 3M futures. I have it implemented in Matlab, but need to transfer to Python. I have a vector of dates and a vector of future prices.
...
3
votes
1
answer
55
views
1
vote
1
answer
97
views
Pricing near to expiration bonds using QuantLib
I want to get the theoretical price of a zero coupon bond each day using quantlib, I'm able do to this up to just before the maturity date where I get the following error: ...
0
votes
1
answer
102
views
QuantLib FixedRateLeg cashflow date shifting issue with Unadjusted convention
I'm using the QuantLib library in Python to generate a payment schedule and cashflows for a fixed-rate bond. I added a holiday to the calendar and used the ql.Unadjusted convention in the ql.Schedule()...
2
votes
1
answer
217
views
QuantLib including holiday in option price
I am trying to add a holiday to my calendar in QuantLib such that my option pricing model considers this in pricing where I would expect that the time to expiry should decrease with the inclusion of a ...
1
vote
0
answers
945
views
Schedule, Yield-to-Maturity, and NPV of Fixed Rate Bond from QuantLib Python
I would like to price a fixed rate bond using QuantLib Python.
The pricing is fine, however I would like to understand how to extract the Yield-to-Maturity (YTM) of the fixed rate bond, that is, the ...
3
votes
1
answer
359
views
Quantlib vol surface issue 'the black vol surface is not smooth enough'
I create a vol surface from the market and do smoothing(interpolation and extrapolation), and explicitly correct for any total variance decreasing on a given strike as we increase maturity. I create a ...
1
vote
1
answer
213
views
How to calculate the discount factors for two deposits in an interest rate curve [closed]
I am trying to calculate the zero rate for a piecewise linear zero curve. I have the following deposit on the short end
STIBOR 1D, is identified as a tomorrow next deposit: 0.02416
STIBOR 3 Month: 0....
0
votes
1
answer
253
views
Quantlib interpolated zero rates not as expected
I have created a piecewise linear zero curve using quantlib (c++). It's a NACA, modifiedFollowing swap curve. When I extract the zero rates on the pillar dates the rates line up with what is expected ...
0
votes
0
answers
87
views
Calculation of accruals using Actual/Actual AFB day count convention in QuantLib library
I am using the QuantLib library to calculate accruals for a fixed rate leg, using the "Actual/Actual AFB" day count convention. The payment period is annual, and the cash flows occur between ...
0
votes
1
answer
144
views
Pricing a fixed rate bond with ex-dividend date in QuantLib Python [duplicate]
I'm trying to price a fixed rate bond with ex-dividend date using Python QuantLib. This is a feature of UK Gilts.
On regular days, I'm able to get the correct accrued interest, but on days in the ex-...
1
vote
0
answers
66
views
Python Quant Lib - Bond Pricing ex coupon period [closed]
were wondering If anyone knows how to use rate bonds on Python Quantlib, that have
an ex-coupon period.
For example the link below shows the construction of such a bond in the c++ quantlib
using
...
0
votes
0
answers
142
views
How to calculate forward swap curves for different tenors using QuantLib in python
I am interested in calculating the forward curve for different swap tenors. I have the below code in Python, but I believe that this only calculates the forward discount curve. Are we able to modify ...
0
votes
0
answers
294
views
Quantlib: swap curve discount rate from spot rates
I'm new to Quantlib on Python and I'd like to use the overnight swap rate from Bloomberg to derive the swap curve discount factors.
I don't know which yield term structure I should specify?
I checked ...
0
votes
1
answer
100
views
Does QuantLib have functionality to value ILS Telbor swaps?
I didn't find the ILS Telbor class in QuantLib website and also reference online. Please let me know if we can value such swaps using QuantLib. For example ...
0
votes
1
answer
390
views
Option Prices And Calibrating The Heston Model Code Question
I'm trying to understand this Python code that uses Quantlib to calibrate the parameters of the Heston model. The data that is provided in the code is the spot price, the risk free interest rate, the ...
0
votes
0
answers
92
views
Quantlib GitHub and Documentation instructions mismatch
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 ...
1
vote
1
answer
162
views
Quantlib date hour time in ql.Date()
How does the quantlib set up hour time, say in the example below:
ql.Date(20, 1, 2023), US calendar,
what is the time, 12 AM US time? local machine time?
say I would like to set up a NY 4 pm time, is ...