-
Notifications
You must be signed in to change notification settings - Fork 50
RQuantLib
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
QuantLib
from source. Thus, we recommend to install binary version directly if it is possible. -
RQuantLib
refers to the R package, whileQuantLib
refers to the C++ Quantitative library thatRQuantLib
uses. Please do not confuse the two terms.
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")
- 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 boost
to 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-intraday
to install the pre-built binary version ofQuantLib
with intraday feature; -
quantlib-config --version
to check yourQuantLib
version; - If the version of
QuantLib
is lower than 1.9.1, you need to do an extra job that is to add fiveinline
inmulticurvesensitivities.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 quantlib
to 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/
.
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
.
- Check out http://quantlib.org/install.shtml to install
QuantLib
; - Install
RQuantLib
usinginstall.packages()
orR CMD INSTALL
.