Questions tagged [quantlib]
Quantlib is an open-source C++ library for quantitative finance.
491
questions
0
votes
0
answers
30
views
When is the Quantlib's C++ to python package faster than just coding natively in python?
Every package I have used of the QL's python package thus far have been slower than my own local python functions. From what I understand, it's running C++ underneath, but if you are running loops/...
2
votes
1
answer
49
views
QuantLib: Pricing BRL zero coupon swap using relevant attributes in Quantlib
I am trying to price the BRL zero coupon swap. As we know that ZC swaps fixed payer pays a single payment at maturity and the float payer pays the interim payments till maturity. So in this case, ...
0
votes
1
answer
123
views
QuantLib: How to price or construct a zero coupon swap using Quantlib
I am trying to construct and price the zero coupon swap. However its giving me the AttributeError: module 'Quantlib' has no attribute 'ZeroCouponSwap'.
Please let me know how to price the zero coupon ...
0
votes
1
answer
107
views
Bumping forward rates in Quantlib for Bartlett SABR greeks
This might be a naive question, but in order to compute the Barlett vega: $$ \frac{d\sigma}{d\alpha} + \frac{d\sigma}{dF}\frac{\rho F^\beta}{\nu}$$ (for forward rate $F$, implied vol $\sigma$, and ...
1
vote
1
answer
101
views
Find the right module for CDI DI BRL swaps valuation Quantlib
I'm trying to find a way to price BRL CDI Swaps with Quantlib but I can't find any solutions so far - so I was wondering if anyone encountered this issue:
I don't see any solution on Quantlib. I ...
0
votes
0
answers
27
views
ConstNotionalCrossCurrencyBasisSwapRateHelper in QuantLib doesn't give expected result
I'm trying to bootstrap to get discount curve based on cross currency basis swap using ConstNotionalCrossCurrencyBasisSwapRateHelper in QuantLib. As a test, I tried to bootstrap the discount curve ...
0
votes
1
answer
103
views
Quantlib FRA and interpolated rate in Swaps vs BBG valuation
I am building a CZK swap pricer on quantlib, and I am trying to understand my differences with Bloomberg pricing.
I believe the way I set up my FRA is wrong, the reason is because even though I match ...
1
vote
1
answer
173
views
Quantlib - mismatch with BBG Swap
I'm trying to price a CZK swap via Quantlib with BBG data, so far nothing complicated but I can't seem to match the floating leg cashflows, and NPV, when I price my swaps, even if I find the right Par ...
0
votes
0
answers
37
views
Quantlib Bond yield jump on front end of the curve
I'm trying to build up a US treasury curves using Bills and bonds with the FixedRateBond class, however when I compared the ParYield from .bondYield() and zero_rate from yield curve instance.
The ...
1
vote
1
answer
39
views
Why the biz day convention of OIS Rate helper is hard coded as Modified Following in QL?
I am using QuantLib OIS Rate Helpers, and traced schedule creation back to the following function, and noticed that the business convention is hard coded as MF. Is the biz day convention hard coded ...
2
votes
2
answers
146
views
Extending/Subclassing QuantLib Classes in Python?
I'm using quantlib via the quantlib-python or open-source-risk-engine both on pypi. The question relates whether it's possible to extend QuantLib term structure base classes in python rather than C++....
0
votes
0
answers
82
views
Wrt speed, how optimised is QuantLib's Heston pricing class?
I have a pricing formula that is 300x the speed of the QuantLib's Heston pricing class. Is it incredibly slow?
For context, on a slow 1.6 GHz Dual-Core Intel Core i5 processor, my method can reliably ...
1
vote
0
answers
44
views
Quantlib's --enable-indexed-coupons flag
When building Quantlib from source there used to be an --enable-indexed-coupons flag option. This was an override for the default 'par coupon' setting which came with the standard Quantlib ...
2
votes
0
answers
157
views
Best practices for building an FX volatility surface with Quantlib in Python
Generally my question is: what are best practices for building FX volatility surfaces with Quantlib?
In FX options, I would like to price structures such as risk reversals, strangles and butterflies.
...
0
votes
0
answers
39
views
Commercial bank mortgages schedule calculation
I need to calculate the schedule of a fixed rate mortgage and an adjustable rate mortgage.
Is there an open source library, preferable in python, that already makes these calculations? I tried ...
0
votes
0
answers
32
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
330
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 ...
1
vote
1
answer
68
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 ...
0
votes
1
answer
65
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:
...
1
vote
1
answer
81
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
0
answers
231
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
214
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
1
answer
101
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 ...
3
votes
1
answer
196
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 ...
2
votes
1
answer
195
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 ...
2
votes
1
answer
142
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 ...
0
votes
1
answer
136
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
1
answer
186
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 ...
3
votes
1
answer
112
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 ...
1
vote
1
answer
365
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
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 ...
0
votes
1
answer
152
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
79
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 ...
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
...
6
votes
2
answers
253
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
...
2
votes
1
answer
251
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) ...
3
votes
0
answers
213
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 ...
0
votes
1
answer
264
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 ...
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 ...
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 ...
0
votes
1
answer
101
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/...
2
votes
1
answer
577
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
156
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.
...
1
vote
0
answers
171
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 ...
2
votes
2
answers
469
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:
...
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
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.
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:
...
1
vote
1
answer
141
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
...