Questions tagged [quantlib]

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

Filter by
Sorted by
Tagged with
3 votes
1 answer
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 ...
Wynn's user avatar
  • 95
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 ...
Wynn's user avatar
  • 95
0 votes
0 answers
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 ...
robin's user avatar
  • 93
3 votes
2 answers
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 ...
tsando's user avatar
  • 139
10 votes
1 answer
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 ...
opt's user avatar
  • 559
8 votes
1 answer
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 ...
fmc100's user avatar
  • 83
8 votes
1 answer
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 ...
lcheng's user avatar
  • 237
5 votes
1 answer
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 ...
Desi_Quant's user avatar
4 votes
1 answer
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 ...
imomushi8's user avatar
4 votes
2 answers
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 ...
Jose Pedro Melo's user avatar
3 votes
1 answer
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?...
AZhu's user avatar
  • 803
3 votes
3 answers
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 ...
Rob Taylor's user avatar
1 vote
0 answers
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 ...
robin's user avatar
  • 93
0 votes
2 answers
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. ...
Rohit Gajare's user avatar
0 votes
2 answers
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: ...
user51725's user avatar
0 votes
1 answer
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: ...
lcheng's user avatar
  • 237
12 votes
4 answers
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 (...
BigONotation's user avatar
10 votes
4 answers
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 ...
user avatar
8 votes
1 answer
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%. ...
cpage's user avatar
  • 261
7 votes
2 answers
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 ...
lcheng's user avatar
  • 237
5 votes
1 answer
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: ...
opt's user avatar
  • 559
5 votes
1 answer
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 ...
Kirill Dolmatov's user avatar
4 votes
2 answers
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: ...
Jose Pedro Melo's user avatar
4 votes
1 answer
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 ...
Lisa Ann's user avatar
  • 2,111
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 ...
TourEiffel's user avatar
4 votes
1 answer
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 ...
JVP3122's user avatar
  • 145
3 votes
1 answer
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 ...
amitbisai's user avatar
3 votes
1 answer
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 ...
supermastercode's user avatar
3 votes
1 answer
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 ...
chengcj's user avatar
  • 473
3 votes
1 answer
2k views

How to sum interest rate curves in QuantLib

C++ code taken from Bonds.cpp and slightly amended: ...
Lisa Ann's user avatar
  • 2,111
3 votes
0 answers
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 ...
Jose Pedro Melo's user avatar
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) ...
TourEiffel's user avatar
2 votes
1 answer
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 ...
ql.user2511's user avatar
2 votes
1 answer
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 ...
Danny's user avatar
  • 23
2 votes
1 answer
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(...
ayoub's user avatar
  • 53
2 votes
1 answer
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 ...
Bananach's user avatar
  • 151
2 votes
1 answer
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 ...
JonDoe's user avatar
  • 137
2 votes
1 answer
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 ...
HookahBoy's user avatar
  • 121
1 vote
1 answer
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 ...
Kyle's user avatar
  • 71
1 vote
2 answers
445 views

Cross currency swap valuation in QuantLib

Does QuantLib support valuation of Cross currency swaps ? Eg. SOFR / SONIA cross currency swap.
Rohit Gajare's user avatar
1 vote
1 answer
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 ...
nickos556's user avatar
  • 193
1 vote
2 answers
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 ...
Desi_Quant's user avatar
1 vote
1 answer
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 <...
AnonymousJ's user avatar
1 vote
1 answer
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% ...
TRex's user avatar
  • 179
0 votes
1 answer
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
Jose Andres Riveros's user avatar
0 votes
1 answer
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: ...
user avatar
0 votes
1 answer
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). ...
JVP3122's user avatar
  • 145
0 votes
1 answer
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 ...
Oliver Mohr Bonometti's user avatar
0 votes
2 answers
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 ...
robin's user avatar
  • 93
-1 votes
1 answer
1k views

Difference arising between Dirty Price and NPV using QuantLib Python

I have used QuantLib Python to price a fixed rate bond. My codes are as follows: ...
ql.user2511's user avatar