Questions tagged [quantlib]
Quantlib is an open-source C++ library for quantitative finance.
46
questions
2
votes
1
answer
521
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 ...
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 ...
10
votes
1
answer
4k
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 ...
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 ...
7
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 ...
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 ...
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 ...
3
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 ...
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 ...
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?...
1
vote
0
answers
588
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 ...
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:
...
0
votes
2
answers
189
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.
...
12
votes
4
answers
4k
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 (...
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 ...
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%. ...
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 ...
5
votes
1
answer
5k
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:
...
5
votes
1
answer
6k
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 ...
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 ...
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:
...
4
votes
1
answer
767
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 ...
3
votes
1
answer
2k
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 ...
3
votes
1
answer
2k
views
How to sum interest rate curves in QuantLib
C++ code taken from Bonds.cpp and slightly amended:
...
3
votes
1
answer
2k
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 ...
3
votes
1
answer
455
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 ...
3
votes
1
answer
638
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 ...
2
votes
1
answer
568
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 ...
2
votes
1
answer
483
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 ...
2
votes
0
answers
648
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 ...
2
votes
1
answer
603
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 ...
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 ...
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(...
2
votes
1
answer
282
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 ...
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 ...
1
vote
1
answer
406
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% ...
1
vote
2
answers
474
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 ...
0
votes
2
answers
375
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 ...
0
votes
1
answer
899
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:
...
0
votes
1
answer
837
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
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). ...
0
votes
1
answer
202
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 ...
0
votes
0
answers
209
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 ...
-1
votes
1
answer
157
views
QuantLib Python: why is the NPV different? NPV(0.1,[0,110]) should be 100, not 99.53
I am trying to learn QuantLib for Python. Further to my previous question on the syntax for CashFlows.npv(), now that I understand how the syntax works, I have a question on why the output differs ...
-1
votes
1
answer
767
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:
...
-1
votes
2
answers
747
views
QuantLib Python: how to calculate the npv of irregular cashflows?
I am trying to learn QuantLib for Python but I must say I am banging my head against the documentation (I also bought Ballabio's python cookbook) - maybe it's me, but even finding the most basic ...