13 votes
Accepted

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

I've been using QuantLib for quite a while. Let me share some experience: QuantLib is a highly sophisticated quantitative framework. It can do much and much more than a simple pricing of European ...
  • 2,255
13 votes
Accepted

Simple QuantLib Bond Math

To begin with, as Student T suggested, you can check that the cashflows are those you expect: ...
12 votes
Accepted

Use QuantLib Python to calculate Swap DV01

No, I'm afraid you're comparing apples with oranges. Your calculation of the DV01 of the swap is correct (with a caveat, see below), but the figure returned from ...
11 votes
Accepted

How to learn QuantLib-python at first?

At this time, there's no specific documentation for QuantLib-Python, except for a series of screencasts that I started a while ago (you can find them on YouTube at https://www.youtube.com/playlist?...
10 votes

Mixed local-stochastic volatility model in Quantlib

Stochastic-Local Vol (SLV) is an attempt to mix the strengths and weaknesses of both Stochastic Vol and Local Vol models. Below, I'll quickly summarise each model and their strengths and weaknesses, ...
  • 2,856
9 votes

What is the best alternative of Quantlib library

The Strata project is the new pure Java market risk quant library from OpenGamma. For more information, see the documentation and GitHub. It is Apache v2 licensed. Strata takes the experience of the ...
9 votes
Accepted

Quantlib python dual curve bootstrapping example

I reproduce the Ametrano-Bianchetti paper on dual-curve bootstrapping in Python with QuantLib in a chapter of the QuantLib Python Cookbook. (Note: I'm not sure what the etiquette is about plugging ...
8 votes

How to learn QuantLib-python at first?

You will find a tutorial of QuantLib using python with simple examples here: http://gouthamanbalaraman.com/blog/quantlib-python-tutorials-with-examples.html I have been writing these as a means to ...
  • 206
8 votes

How to use quantlib with excel?

The QuantLib you installed is just a C++ library. If you were on a Windows machine, you'd need the QuantLibXL addin to use it in Excel (http://quantlib.org/quantlibxl/). But on a Mac, you've no such ...
8 votes
Accepted

QuantLib: Black / BSM processes and pricing via volatility surface. Different results?

It's because of the settlement days you passed when you initialized the flat volatility curve. You're creating the spot, forward and flat volatilities as: ...
8 votes
Accepted

How to calculate bond yield in QuantLib - Python

In the call to Bisection.solve, the question mark must be the Python function whose zero you want to find. In your case, it should be something reproducing the ...
8 votes
Accepted

Multithreading Monte-Carlo pricing in QuantLib for a single product

Yes, it can work. However, keep in mind that: you'll be safer if you don't share any objects between threads; see my answer here, in particular the last point; even if you use different seeds, there'...
8 votes
Accepted

SABR Model Pricing Engine in Python QuantLib

Here is a simple example that might be useful. Basically finding parameters for a given section. Some of the parameters might be assumed at start instead of calibrated. ...
  • 5,375
7 votes
Accepted

AmericanOptionImpliedVolatility - root not bracketed issue in QuantLib/R

It is a simple root finder, and if you give it impossible starting values... well then it fails. Here, you can play with the values and it seems bounded at USD 5 whereas you start from USD 2.7: <...
7 votes

How to select the initial guess for implied volatility?

It is always better to use some closed form approximation first to get initial guess. Corrado and Miller (1996) produced a solution that is quite accurate across a range of moneyness ( though it can ...
  • 2,168
7 votes
Accepted

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

You're not setting the global evaluation date. If you don't, you're in December 2017 and your option has expired a good while ago. Adding ...
6 votes

What is the best solution to use QuantLib within Excel?

A free to use Excel wizard-based Add-In providing QuantLib-backed derivatives pricing analytics directly in Excel is available at https://www.deriscope.com Since August 18, 2017 Deriscope has moved ...
  • 156
6 votes

What is the best alternative of Quantlib library

I did not tested it by now, but Google released a library similar to quantlib written in TensorFlow (tf-quant-finance). It may be worthwhile to test it (and to post here your views on it), because ...
  • 10.7k
6 votes
Accepted

Black model: Delta - strike relationship regardless of expiry?

The time to expiry is required, but it's included in the inputs: the two discounts $e^{-rT}$ and $e^{-qT}$ and the standard deviation $\sigma\sqrt{T}$. You might argue it could be documented more ...
6 votes
Accepted

Why QuantLib computes the fixed-leg swap rate by this formula?

fixedLegBPS is the basis-point sensitivity of the fixed leg, that is, how much its NPV changes when the fixed rate changes by one basis point: it's calculated as ...
6 votes
Accepted

Quantlib bootstraping fails on 5y swap

You're not the first to trip on this, and unfortunately the fact that the provided example is from a different era doesn't help. Quite simply, you're not writing rates correctly. The 5-years swap ...
6 votes

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

And don't forget that there are wrappers as eq RQuantLib which I use on the command-line here: ...
6 votes

How to select the initial guess for implied volatility?

Do you really need to do this yourself? The absolute state of the art is Peter Jaeckel's work, where he makes an implied vol function as good as exp, cos, and log special functions. And he ...
  • 1,865
6 votes
Accepted

How do you check your option calculations?

1: Follow the calculations in The Complete Guide to Option Pricing Formulas. The book has many formulas, sample values and outputs. Highly recommended for validating your results. Apparently, this is ...
  • 2,255
6 votes
Accepted

QuantLib Gsr model

the model is described in Andersen, Piterbarg: Interest Rate Modeling. The formulas that are acutally implemented are derived here https://ssrn.com/abstract=2246013 Best Peter
6 votes

Install QuantLib on Mac OS X

I use Xcode for QuantLib. It works great. To compile the project, just put all the source files into the Xcode project like: That's the C++ compiler I use: That's how I configure my header files. ...
  • 2,255
6 votes
Accepted

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

To retrieve the original curve, you need to use the same key tenors of the original curve and with the same interpolation. For instance, when you create the original curve as: ...
6 votes

What are the best [free]resources to learn C++ particularly for quantitative finance?

I think it's best to learn generic C++. Most of the firms hiring for quant Dev roles usually need good general programming skills and interest in the markets. If you're learning for personal trading I'...
6 votes
Accepted

FX Forward rate agreement valuation in quantlib

You are not giving the constructor a discountCurve. The constructor is: ...
  • 5,375
6 votes
Accepted

Bootstrap with QuantLib: Fair Swap or zero NPV

The problem is that you are not pricing the same thing, and for two reasons: The vanilla instruments you are pricing should start on spot date and have a maturity with that start as reference The ...
  • 5,375

Only top scored, non community-wiki answers of a minimum length are eligible