# Questions tagged [quantlib]

Quantlib is an open-source C++ library for quantitative finance.

52 questions
Filter by
Sorted by
Tagged with
1k 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 ...
• 95
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 ...
• 95
403 views

### How to compute the Brazilian Plain vanilla swap using Quantlib?

How to compute the BRL plain vanilla swap. I have followed the below methodology to calculate the valuation for other indexes but BRL-CDI is far off from actual valuation. Please suggest if anything ...
• 93
4k views

### Excel YIELD function equivalent in python Quantlib

I am struggling to get an equivalent of Excel's YIELD function using Quantlib in python. As you can see from the Excel documentation on YIELD here, only a few parameters are needed compared to this ...
• 139
5k views

### Mixed local-stochastic volatility model in Quantlib

At a conference the speaker mentioned that it is a standard approach today to use a mix of local and stochastic volatility model in equity, FX and interest rates. Can you please suggest the most ...
• 559
4k views

### Issue Using QuantLib and Python to Calculate Price and Greeks for American Option With Discrete Dividends

I am having trouble using QuantLib with Python to calculate American options with discrete dividends. I am using Anaconda, Spyder, Python 3.6, and the most recent version of QuantLib. I created ...
• 83
6k views

### Use QuantLib Python to calculate Swap DV01

I would want to use QuantLib Python to calculate DV01 of an interest rate swap. Initially I was thinking of calculating the fixed leg DV01 and floating leg DV01 separately, then add both legs DV01 ...
• 237
3k views

### SABR Model Pricing Engine in Python QuantLib

I am looking for a SABR model pricing engine in Python QuantLib setting. I do know that it exists in C++ version, but not sure if available in Python. Any suggestion/feedback with respect to Python ...
• 101
1k views

### How to permanently add holidays to QuantLib calendars?

I am aware of QuantLib's functions addHoliday() and removeHoliday(), but I am wondering if there is a better way to edit the ...
1k views

### Valuing structured loans in QuantLib

I'm trying to figure out if it's possible to value structured products, mainly loans, in quantlib. The idea is to build a bond class with different cash flows. For example, a loan could have coupons ...
1k views

### Using quantlib to price swaps with different payment and calculation resets for floating leg

I understand the VanillaSwap object assumes that payment and calculation resets are the same, so is there any way we could use quantlib to price a swap with different reset and calculation frequencies?...
• 803
8k views

### How to build a cross currency swap pricer?

We're looking to build a pricer to convert a funding spread in a given currency over a specific funding basis e.g. 20 bps EUR 3m€ and convert it to a funding spread to a different currency with a ...
1 vote
807 views

### Quantlib : Valuation of inflation swaps of EUR-RPI using quantlib python?

Below is the sample code to compute the inflation swaps. I have referred the Quantlib cookbook to get the flavor of Inflation swaps. But I feel that the term structure and final NPV is not accurate ...
• 93
397 views

### Quantlib yield curve - zerorate output differs from expectation

I was creating an yield curve using zeroRate, when I read back the value from the created yield curve - it differs from expectation. ...
3k views

### QuantLib python ql.schedule getting end of month dates

i'm trying to get payment schedule of a bond that pays coupon quarterly. value date is 2020-04-01, first coupon date is 2020-06-30, maturity date is 2022-09-30. so I expect to have a list of dates: ...
2k views

### QuantLib Python price same swap on different evaluation dates

I want to use QuantLib Python to price a swap at 2 different evaluation dates during the life time of the swap. The following is what I've tried so far: ...
• 237
5k views

### Why does it take so many lines of code to price even the simplest of options with QuantLib

I have been looking at QuantLib I am trying to figure out why I need to write so much boilerplate code even when pricing the "simplest" of European Options using the analytical Black-Scholes formula (...
• 490
1k views

### How do you check your option calculations?

I'm implementing a bunch of different algorithms to price options/find Greeks: finite difference, Monte Carlo, binomial... I'm not really sure how to check my calculations. I tried using QuantLib to ...
4k views

### Simple QuantLib Bond Math

I am new to QuantLib and am trying to get it to replicate some simple bond math. Suppose we have a 5-year bond with annual coupon payments of \$5 and face value of \$100, and interest rate of 4%. ...
• 261
3k views

### Use QuantLib Python to calculate roll-down of a swap

I would want to use QuantLib Python to calculate 6-month roll-down of a 5-year swap. I believe that the calculation I need to do is as follows: $Rolldown=r_{0,5Y}-r_{0,4.5Y}$ Where $r_{0,5Y}$ is ...
• 237
6k views

### Quantlib-Python: use zero rates to get the originally bootstrapped curve

Let's say I am trying to build a curve using deposits, future and swaps with one of the three Quantlib methods in Python as below: ...
• 559
7k views

### How to calculate bond yield in QuantLib - Python

I want to calculate yield of bond having market price and coupons. I try to replicate C++ from (https://mhittesdorf.wordpress.com/2013/03/03/introducing-quantlib-internal-rate-of-return/) in Python ...
3k views

### Swap Bootstrapping with quantlib

I've been trying to get the zero rates of the Chilean Swap curve with Quantlib in Python, but I haven't been able to set up the parameters correctly. This is my code: ...
873 views

### Black model: Delta - strike relationship regardless of expiry?

While wandering through some QuantLib experimental classes for FX trading, I've found this Black Delta Calculator. By reading its .cpp, it seems that no use of ...
• 2,111
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 ...
• 333
6k views

### QuantLib Python Swap Yield Curve Bootstrapping Dates and Maturities

This is somewhat related to the question I asked here but simpler. I am trying to bootstrap a yield curve from swaps, and am having a problem with the dates/maturities that are coming out. The code ...
• 145
3k views

### Calculate tenor wise DV01 of a Swap in Quantlib Python, i.e. Key-rate Duration

Is there a way I can get DV01 breakup of a Swap across different tenors of the deal in Quantlib-Python. The question asked here, follows the basic method of re-valuing the swap by shifting the curve ...
700 views

### forward + displacement

I I am trying to price a cap/floor using Quantlib in Python. the initial code from from this website: http://gouthamanbalaraman.com/blog/interest-rate-cap-floor-valuation-quantlib-python.html Here is ...
519 views

### Given QuantLib Python VanillaSwap object, how to get the iborIndex of the swap object?

I'm currently using QuantLib Python. Let's say that I've got a VanillaSwap object: import QuantLib as ql swap_obj = ql.VanillaSwap(... , iborIndex , ...) How can ...
• 473
2k views

### How to sum interest rate curves in QuantLib

C++ code taken from Bonds.cpp and slightly amended: ...
• 2,111
722 views

### Bootstraping CLP Swap with Quantlib

After reviewing and fixing my last code (Swap Bootstrapping with quantlib), i managed to get the zero rates for the ICP swap curve (CLP). Now the thing is that there is a considerable difference ...
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) ...
• 333
844 views

### Pricing a Forward Rate Agreement using QuantLib Python

Can someone please help with the pricing of the following forward rate agreement using QuantLib Python? A 3x6 forward rate agreement, with a notional of \$100,000, the FRA rate being 6%, The FRA ...
• 211
856 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 ...
• 23
1k views

### Why we should specify the evaluation date when using Quantlib yield curve? And why updating the evaluation Date is time consuming

I was runing some tests using the yield curve structure in quantlib mainly: PiecewiseYieldCurve It seems that I have to fix the evaluation date using such a line : Settings::instance().evaluationDate(...
• 53
308 views

### QuantLib: How to change polynomial order in MCAmericanBasketEngine?

My goal is to price American basket put options using the Least squares Monte Carlo, or Longstaff-Schwartz algorithm. I currently have the one-dimensional case working with the Python file below (I ...
• 151
725 views

### TOIS (CHF), TONAR (JPY), AONIA(AUD) in Quantlib

I am looking for the TOIS, TONAR, AONIA in Quantlib for discounting. I only could find the EOINA, FEDFUNDS, SONIA etc.Do I miss something? In case they don't exist how can I use the corresponding rate ...
• 137
2k views

### Setting up Schedule for an amortizing floater in QuantLib

I am unsure as to the exact arguments required for the Schedule function for an amortizing floater - my code is listed below. Specifically, my question pertains to whether the schedule should always ...
• 121
1 vote
2k views

### Calculating Discount Margin on a floating rate bond using QuantLib

Going off Luigi's hint on this answer: Setting up Schedule for an amortizing floater in QuantLib I was able to cobble something together but I'm unable to verify if it's correct. TLDR: I was able to ...
• 71
1 vote
445 views

### Cross currency swap valuation in QuantLib

Does QuantLib support valuation of Cross currency swaps ? Eg. SOFR / SONIA cross currency swap.
1 vote
374 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 ...
• 193
1 vote
629 views

### Unable to find Price of Asian Option using Explicit Finite Difference Method by implementing QuantLib in Python

I am trying to find price of Continuous Geometric Average Asian Option using Finite Difference methodology in QuantLib Python. I am unable to do so. However, I am able to find price of the same option ...
• 101
1 vote
194 views

### Which object in DateGeneration object when there are two short, long or combination in Schedule object for py QuantLib?

I'm pricing a vanilla swap. I have two stubs, front and back, and they can be short, long or a combination. In this case, what do I use in ql.Schedule object for <...
1 vote
501 views

### Quantlib: How do I price a bond after having built a term structure

I below are my codes using QuantLib to build a term structure What I would like to do is use that to price any hypothetical bond lets say startdate : 8 Feb 2016 end date : 8 Feb 2021 coupons : 10% ...
• 179
1k views

### how can i see the cashflows of a specific bond created in quantlib in Python? this is the code i have, how should i change it

This is the code i have, what would be the way to see the cashflows of this specific bond i created
1k views

### CDS Option pricing in quantlib python

I am newbie in Python and I am trying to price a CDS Option in quantlib Python. I have the below code: ...
2k views

### QL-Python Bootstrapping Yield Curve FuturesRateHelper throwing off results

I'm trying to perform a bootstrap of a yield curve from deposit rates, futures, and swaps, and the interpolation is "blowing up" for the futures maturities being off by two orders of magnitude (100x). ...
• 145
259 views

### Valuating Custom Amortization Schedule Libor IRS with QuantLib

I got to bootstrap the OIS and Libor 3M swap curves, and now I'd like to valuate some simple Libor3M - Fix IRS with QuantLib (in python). My problem is that some of the instruments I have to valuate ...
586 views

### QuantlIb: How to use maturities in place of Tenors in OIS rate helpers Quantlib?

I would like to know if I can use maturity dates from my rates dataframe to generate OISratehelpers. In the following code the OIS rate helper use 'tenors' and I want to replace those tenors with ...
• 93