RQuantLib is an interface from GNU R to QuantLib.
Version: 0.2.8RQuantLib is an interface from GNU R to QuantLib. RQuantLib connects GNU R with QuantLib.
Operating System: Linux
What is R?
GNU R, to quote from its highly recommended website, is `GNU S' - A language and environment for statistical computing and graphics. R is similar to the award-winning S system, which was developed at Bell Laboratories by John Chambers et al. It provides a wide variety of statistical and graphical techniques (linear and nonlinear modelling, statistical tests, time series analysis, classification, clustering, ...).
R is designed as a true computer language with control-flow constructions for iteration and alternation, and it allows users to add additional functionality by defining new functions. For computationally intensive tasks, C, C++ and Fortran code can be linked and called at run time. R is an official part for the GNU Project.
What is QuantLib?
QuantLib, to quote in turn from its website, is aiming to provide a comprehensive software framework for quantitative finance. QuantLib is a free/open source library for modeling, trading, and risk management in real-life. QuantLib is written in C++ with a clean object model, and is then exported to different languages such as Python, Ruby, Guile, MzScheme, Java, Perl, ... via SWIG. .
So what can RQuantLib (currently) do?
RQuantLib currently supports four basic Option types: European, American and, as examples of simple exotic options, Binaries and Barriers. Since release 0.2.0 of RQuantLib, support for Fixed Income curve generation as well as a Bermudan Swaption pricer have been added by Dominick Samperi.
So what does RQuantLib (currently) do with Options?
For all of the option types, upon evaluation an element of a simple class is returned. Each of the the specific option classes inherits from a base class Option, and print and summary methods are provided for the base class.
Moreover, another base class ImpliedVolatility is provided with methods print and summary and implied volatility solvers for European and American are provided (Binaries seem to trigger a QuantLib bug as far as I can tell).
For both option and implied volatility calculations, operations are limited to the scalar case. However, using the R, or rather, S object framework makes the work fairly convenient.
Lastly, for the basic European Option, an "array" interface is provided. Here, any of the usual input variables is allow to be in vector form. Solutions are then computed for the "multi-dimensional outer product" of all input vectors. Concretely, if called with three strike prices, four maturities and five volatilities, then 3 * 4 * 5 arrays are returned for the common variables of interest (i.e. value, delta, gamma, ...). In other words, value is now an array over all possible combination of all possible input values. This allows for very compact comparison and scenario analysis.
So what does RQuantLib (currently) do with Fixed Income?
The DiscountCurve function constructs the spot term structure of interest rates based on input market data including the settlement date, deposit rates, futures prices, FRA rates, or swap rates, in various combinations. It returns the corresponding discount factors, zero rates, and forward rates for a vector of times that is specified as input.
The BermudanSwaption function prices a Bermudan swaption with specified strike and maturity (in years), after calibrating the selected short-rate model to an input swaption volatility matrix. Swaption maturities are in years down the rows, and swap tenors are in years along the columns, in the usual fashion. It is assumed that the Bermudan swaption is exercisable on each reset date of the underlying swaps.
The Fixed Income functions are a good illustration of the R/C++ interface provided by the Rcpp package by Dominick Samperi (available on CRAN as a package of the same name).
What else is there?
There are lots more financial instruments covered in QuantLib, with support for interest rate models starting in release 0.3.0. RQuantLib should grow to accomodate these. Help in writing the R wrappers would accelerate the provision of RQuantLib hooks for these. The RQuantLib package also contains an animated OpenGL demo. Unfortunately, GL support is not very stable for a variety of graphics cards and drivers on both Linux and Windows, so this may in fact crash instead of run. This really appears to a hardware or driver issue as the code runs fine on some hardware combinations. It appears that Nvidia cards do better than ATI cards... As a simpler alternative, there is a webpage with a few animated gifs that tries to approximates the effect of the OpenGL animation.