# Tag Info

14

Based on anecdata (conversations with other quants), not much. Banks develop their own models and if they do outsource the effort, they pay someone for the code + support (there are companies like Numerix or Pricing Partners which do that). QuantLib is criticized for being poorly documented and convoluted. My own observation is that the parts of QuantLib I ...

14

This is off-topic and maybe belongs to StackOverflow, but here goes. 1. Compile QuantLib The best way is to open the Visual Studio Command Prompt using a shortcut under Programs→Microsoft Visual Studio→Visual Studio Tools. Now, you need to navigate to the QuantLib folder inside the folder where you have QuantLib (there are other folders such as ...

12

It's a very good and useful question. And it is bloody hard to answer just like many other questions relating to the proprietary nature of how banks and funds implement their core technology. A better route may be to ask on the QL lists, and/or to inquire as to who actually attented the first Quantlib forum in London last month. Another route would be to ...

12

Well, actually it's designed to use whatever discretization you throw at it---but for the time being only Euler discretization is implemented, mostly for lack of time or interest on the part of contributors. If you want to use exact numerics with a process, you can just code the corresponding discretization class (you'll have to inherit from ...

10

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 option. For example, in your example, you could have changed the payoff to binary payoff or giving a monte-carlo pricing engine (rather than ...

7

I'm familiar with the library, but not with the way it is exported to R. Anyway: gearings are optional multipliers of the LIBOR fixing (some bonds might pay, for instance, 0.8 times the LIBOR) and spreads are the added spreads. In your case, the gearing is 1 and the spread is 0.0140 (that is, 140 bps; rates and spread must be expressed in decimal form). ...

7

Assuming you're referring to the local-volatility class implemented in <QuantLib/ql/termstructures/volatility/equityfx/localvolsurface.hpp>, it's among the several classes that are not exported through SWIG. You'll have to add it to the SWIG interface files (probably in volatilities.i), regenerate the wrappers and recompile them. If you need ...

7

How at ease are you with programming, dynamic linking, Makefiles and the rest? In essence, there is no magic here. QL has a very liberal license, and you "merely" have to set up your project such that it finds the quantlib headers (and hence Boost headers) during compilation the quantlib library during linking and both of those can be automated by ...

6

Day-count conventions. You can't live with them, you can't live without them. The reason the prices differ is that the pricing engine can't calculate correctly the time over which the first coupon is discounted, and thus it gets slightly different discount factors to apply to the coupon amounts. Please sit down, it'll take some explaining. Ultimately, both ...

6

There's no class at this time to add two curves as you want, but it won't be much difficult to write it. The closest you'll get in the library is the ZeroSpreadedTermStructure class, that shows the general idea: it inherits from YieldTermStructure (by way of ZeroYieldStructure) takes a YieldTermStructure and a spread (constant, in this case) and override ...

6

And don't forget that there are wrappers as eq RQuantLib which I use on the command-line here: edd@max:~$r -l RQuantLib -e 'print(EuropeanOption("call", 47, 40, 0.05, 0.0, 4/12, 0.2))' Concise summary of valuation for EuropeanOption value delta gamma vega theta rho divRho 6.4728 0.8899 0.0307 4.5139 0.7372 ... 5 Numerical methods are only approximations. So binomial trees, Monte Carlo simulations, and finite difference methods should all produce different numbers. As for whether you should install it for your customers, that can only be answered by what you think your customers want. Do retail customers really want the potential confusion? Are they going to ... 5 I'm guessing you're simulating rate curves etc. inside your system, and you want to reprice your instruments over the simulated curves using QuantLib. In this case, most of the logic is in your system already, and you have to plug pricing functionality in. If so, I don't think there's many steps involved besides, well, pricing the instrument on the ... 5 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: boost::shared_ptr<BlackVarianceSurface> volatilitySurface( new BlackVarianceSurface(todaysDate, calendar, maturityArray, strikeArray, ... 5 There are two different issues at play here. One is that, of course, you want only the future cash flows to enter the calculation. This is taken care when you set the evaluation date to 6 months from today. In C++, you would say Settings::instance().evaluationDate() = today + 6*Months; I don't remember the corresponding function in QuantLibXL, but you ... 5 Ok, I've done some digging in the code. It's an issue with the LogLinear interpolation; while trying to find the correct rate for the 1-week node, the bootstrapper wanders unchecked into a region of negative rates and the logarithms blow up. At this time, I'm afraid the workaround is just to use some other interpolation. Or recompile the library and the ... 5 To add to Student T's answer, which I second: the complex setup starts making sense (and its cost gets amortized) once you start keeping the instruments around instead of throwing them away after the pricing. For instance, once the option above is built, you can change the market price of the underlying (or its volatility, or the risk free rate) by just ... 5 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: R> AmericanOption(type="put", underlying = 55, strike = 60, + dividendYield = 0.02, riskFreeRate = 0.03, + maturity = 0.02, ... 4 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 OG-Platform codebase referenced in the question and turns it into a library - no need for databases, servers or similar. Ease of use is a big focus and there ... 4 The formally supported way of adding extensions to QuantLib is by means of the Swig extension 'system' / library / tool. And the Swig site's page on compatibility has this to about Javascript: There is also SwigJS, a JavaScript module for SWIG so you could to familiarize yourself with a) how Swig works in the context of QuantLib and b) if/how you can ... 4 I believe it's correct. However, consider that it would be easy enough, and more clear, to create a new class (at least in C++; the task is more difficult if you also want to export it to Excel). The new instrument should only inherit from Bond and implement a constructor that builds the desired cash flows via a call to FixedLeg and another to IborLeg; you ... 4 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 luck. As far as I know, Excel for Mac only allows addins written in VBA, so QuantLibXL can't be built for it. 4 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?list=PLu_PrO8j6XAvOAlZND9WUPwTHY_GYhJVr) but which is far from exhaustive; there's just a few of them for now, and there's no definite learning path. However, the ... 4 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 be applied to BS model only and can’t be used for plain vanilla options or exotic options). The formula for implied volatility$\sigma$is :$\sigma = ...

4

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 pulished source code and algorithm details with careful numerical analysis of errors and convergence. This is a wheel you don't have to reinvent, any more than you ...

4

The installation process should be the same as on Linux. Once you have the C++ QuantLib library installed (instructions for that are on the QuantLib site, at http://quantlib.org/install/macosx.shtml) you can download the latest QuantLib-SWIG release, uncompress it and run: ./configure make -C Python sudo make -C Python install Note that the above work ...

4

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 logic of IRRSolver::operator() in Mick Hittesdorf's code, i.e., something like this (which I haven't tested): cashflows = fixedRateBond.cashflows() npv = fixedRateBond.NPV() def ...

3

As for the first question, the schedule should start from the issue date. The bond will manage cash flows correctly based on the evaluation date. The second is a bit trickier, and I don't think I have working code handy. The general idea is: if you want to add a spread to the rate of the bond (to go from discount margin to price) you'll have to modify the ...

3

I think to have the answer: use qlBondPreviousCashFlowDate() pointing at your FloatingRateBond object to get the last date of payment; use qlInterestRateIndexFixingDate() to get the fixing date referring to the last payment date; use qlIndexAddFixings() to add a fixing rate to the fixing date you got above; repeat for each one of your bonds if they share ...

3

Tenor is just a different term for time to maturity. A schedule is generated from startDate and endDate in combination with a time to maturity and some info on calendar specifics. Here is an example from Dimitri Reiswich' Presentation from quantlib.com, I hope it makes the use of schedule clearer to you: void testingSchedule1 (){ Date begin (30 , September ...

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