RQuantLib
Background
RQuantLib is an R interface to the C++ library QuantLib. Currently, no binary packages of RQuantLib are being provided by CRAN. So users typically need to install QuantLib in order to compile RQuantLib from source, and then run it.
NB:
- It may take considerable time (_i.e., possibly several hours) to compile
QuantLibfrom source. Thus, we recommend to install binary version directly if it is possible. -
RQuantLibrefers to the R package, whileQuantLibrefers to the C++ Quantitative library thatRQuantLibuses. Please do not confuse the two terms.
Windows
Starting with release 0.4.3, binaries of RQuantLib (including the required QuantLib object) are provided via the ghrr drat repo and can be installed in an R session with the following commands:
if (!require("drat")) install.packages("drat")
drat::addRepo("ghrr")
install.packages("RQuantLib", type="binary")Mac OSX (Sierra)
- Open the terminal, where you need to execute the commands;
- Install Homebrew, so that you can use Homebrew to manage packages on OSX:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -
brew install boostto install boost (a C++ library needed byQuantLib). You might need to accept the license of XCode or install XCode, just follow the message that pops up in the terminal; -
brew install quantlib --with-intradayto install the pre-built binary version ofQuantLibwith intraday feature; -
quantlib-config --versionto check yourQuantLibversion; - If the version of
QuantLibis lower than 1.9.1, you need to do an extra job that is to add fiveinlineinmulticurvesensitivities.hpp, see https://github.com/lballabio/QuantLib/pull/161. You can edit the file viasudo vi /usr/local/include/ql/experimental/termstructures/multicurvesensitivities.hpp; -
brew link quantlibto create the symbolic link forQuantLib, in case of failing to link automatically; - (In R console)
install.packages("RQuantLib", configure.args = "--with-boost-include=/usr/local/include/ --with-boost-lib=/usr/local/lib/", type = "source")to install RQuantLib packages from source.
Note:
If you want to install QuantLib from the source, please look up the instruction here. Be careful, when using Homebrew to install, you need to replace all the /opt/local/ in the instruction with /usr/local/.
Debian and Ubuntu
Simply sudo apt-get install r-cran-rquantlib installs the RQuantLib package for R. If you want the headers and examples of QuantLib as well, please execute sudo apt-get install r-cran-rquantlib quantlib-examples libquantlib0-dev.
Other platforms
- Check out http://quantlib.org/install.shtml to install
QuantLib; - Install
RQuantLibusinginstall.packages()orR CMD INSTALL.